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
c.mano committed Aug 2, 2024
1 parent 9787b8a commit 9ed0523
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 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,12 @@ def create_returns(self):
)
vals_list = self._prepare_rma_vals_list()
rmas = self.env["rma"].create(vals_list)
for rma in rmas:
group_vals = rma._prepare_procurement_group_vals()
group_vals["name"] = self.picking_id.name
rma.procurement_group_id = self.env["procurement.group"].create(
group_vals
)
rmas.action_confirm()
picking = rmas.reception_move_id.picking_id
picking = picking and picking[0] or picking
Expand Down

0 comments on commit 9ed0523

Please sign in to comment.