Skip to content

Commit

Permalink
[FIX] rma: same procurement group for reception and delivery
Browse files Browse the repository at this point in the history
The procurement group created for reception was not being correctly assigned to the RMA,
resulting in a different group being generated for the delivery.

This fix ensures that the same procurement group is used for both operations.
  • Loading branch information
sbejaoui committed Aug 29, 2024
1 parent 6197962 commit a4ae789
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions rma/models/rma.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ def _prepare_reception_procurements(self):
group = rma.procurement_group_id
if not group:
group = group_model.create(rma._prepare_procurement_group_vals())
rma.procurement_group_id = group
procurements.append(
group_model.Procurement(
rma.product_id,
Expand Down
15 changes: 15 additions & 0 deletions rma/tests/test_rma.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,3 +848,18 @@ def test_autoconfirm_email(self):
)
self.assertTrue(rma.name in mail_receipt.subject)
self.assertTrue("products received" in mail_receipt.subject)

def test_same_procurement_group_for_reception_and_delivery(self):
rma = self._create_confirm_receive(self.partner, self.product, 10, self.rma_loc)
self.assertTrue(rma.procurement_group_id)
delivery_form = Form(
self.env["rma.delivery.wizard"].with_context(
active_ids=rma.ids,
rma_delivery_type="return",
)
)
delivery_form.product_uom_qty = 2
delivery_wizard = delivery_form.save()
delivery_wizard.action_deliver()
self.assertEqual(rma.delivery_move_ids.group_id, rma.procurement_group_id)
self.assertEqual(rma.delivery_move_ids.group_id, rma.reception_move_id.group_id)

0 comments on commit a4ae789

Please sign in to comment.