Merge PR #238 into 13.0

Signed-off-by pedrobaeza
This commit is contained in:
OCA-git-bot
2021-09-23 20:26:04 +00:00

View File

@@ -50,7 +50,6 @@ class Rma(models.Model):
comodel_name="res.users",
string="Responsible",
index=True,
default=lambda self: self.env.user,
tracking=True,
states={"locked": [("readonly", True)], "cancelled": [("readonly", True)]},
)
@@ -491,7 +490,7 @@ class Rma(models.Model):
)
vals["name"] = ir_sequence.next_by_code("rma")
# Assign a default team_id which will be the first in the sequence
if "team_id" not in vals:
if not vals.get("team_id"):
vals["team_id"] = self.env["rma.team"].search([], limit=1).id
rmas = super().create(vals_list)
# Send acknowledge when the RMA is created from the portal and the
@@ -864,11 +863,6 @@ class Rma(models.Model):
# Reception business methods
def _create_receptions_from_picking(self):
self.ensure_one()
create_vals = {}
if self.location_id:
create_vals.update(
location_id=self.location_id.id, picking_id=self.picking_id.id,
)
stock_return_picking_form = Form(
self.env["stock.return.picking"].with_context(
active_ids=self.picking_id.ids,
@@ -876,6 +870,8 @@ class Rma(models.Model):
active_model="stock.picking",
)
)
if self.location_id:
stock_return_picking_form.location_id = self.location_id
return_wizard = stock_return_picking_form.save()
return_wizard.product_return_moves.filtered(
lambda r: r.move_id != self.move_id