Skip to content

Commit

Permalink
[FIX] rma_sale: sale_id not assigned to procurement_group when creati…
Browse files Browse the repository at this point in the history
…ng from stock.picking return wizard
  • Loading branch information
claudio-mano committed Aug 20, 2024
1 parent 9787b8a commit 5f73bf6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions rma/wizard/stock_picking_return.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ def _prepare_rma_partner_values(self):
def _prepare_rma_vals(self):
partner, partner_invoice, partner_shipping = self._prepare_rma_partner_values()
origin = self.picking_id.name
vals = self.env["rma"]._prepare_procurement_group_vals()
vals["partner_id"] = partner_shipping.id
vals["name"] = origin
group = self.env["procurement.group"].create(vals)
return {
"user_id": self.env.user.id,
"partner_id": partner.id,
Expand All @@ -92,7 +88,6 @@ def _prepare_rma_vals(self):
"origin": origin,
"picking_id": self.picking_id.id,
"company_id": self.company_id.id,
"procurement_group_id": group.id,
}

def _prepare_rma_vals_list(self):
Expand Down Expand Up @@ -129,6 +124,10 @@ def create_returns(self):
)
vals_list = self._prepare_rma_vals_list()
rmas = self.env["rma"].create(vals_list)
proc_group_vals = rmas[:1]._prepare_procurement_group_vals()
proc_group_vals["name"] = self.picking_id.name
proc_group = self.env["procurement.group"].create(proc_group_vals)
rmas.write({"procurement_group_id": proc_group.id})
rmas.action_confirm()
picking = rmas.reception_move_id.picking_id
picking = picking and picking[0] or picking
Expand Down

0 comments on commit 5f73bf6

Please sign in to comment.