Skip to content

Commit

Permalink
[REF] purchase_receipt_expectation: fix create() side effects
Browse files Browse the repository at this point in the history
The create() modifies the vals dict assing the 'name' key to it.
This caused the several creastes to always use the same PO number,
and that can be a problem for other purchase modules.
  • Loading branch information
dreispt committed Sep 14, 2024
1 parent 0cd3f78 commit 83f6961
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_00_automatic_receipt(self):
- `receipt_expectation` must be "automatic" (as default value)
- At least one picking should have been created
"""
order = self.env["purchase.order"].create(self.po_vals)
order = self.env["purchase.order"].create(self.po_vals.copy())
self.assertEqual(order.receipt_expectation, "automatic")
order.button_confirm()
self.assertTrue(order.picking_ids)
Expand Down Expand Up @@ -91,14 +91,14 @@ def _create_picking_for_succeeding_receipt_expectation(self):
self.registry.setup_models(self.cr)

succeeding_order = self.env["purchase.order"].create(
dict(self.po_vals, receipt_expectation="succeeding")
dict(self.po_vals.copy(), receipt_expectation="succeeding")
)
self.assertEqual(succeeding_order.receipt_expectation, "succeeding")
succeeding_order.button_confirm()
self.assertTrue(succeeding_order.picking_ids)

failing_order = self.env["purchase.order"].create(
dict(self.po_vals, receipt_expectation="failing")
dict(self.po_vals.copy(), receipt_expectation="failing")
)
with self.assertRaises(NotImplementedError) as error:
failing_order.button_confirm()
Expand Down

0 comments on commit 83f6961

Please sign in to comment.