Skip to content

Commit

Permalink
[FIX] purchase_duplicate_check: functional is updated after confirmat…
Browse files Browse the repository at this point in the history
…ion_wizard is updated
  • Loading branch information
geomer198 committed Feb 28, 2025
1 parent d938a67 commit 17a59be
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
12 changes: 4 additions & 8 deletions purchase_duplicate_check/models/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,10 @@ def _is_activity_enabled(self) -> bool:

def _check_pending_order(self):
"""Check for pending orders and trigger confirmation wizard if needed."""
if self._is_activity_enabled() and not self._context.get(
"skip_rfq_confirmation"
):
return (
self.env["confirmation.wizard"]
.with_context(skip_rfq_confirmation=True)
.confirm_pending_order(self)
)
if self._is_activity_enabled():
action = self.env["confirmation.wizard"].confirm_pending_order(self)
if action:
return action

def button_confirm(self):
"""
Expand Down
6 changes: 3 additions & 3 deletions purchase_duplicate_check/tests/test_purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_check_pending_order(self):
result = self.order1._check_pending_order()
self.assertIsNone(result, "Result should be None")
order2 = self._get_and_create_purchase_order()
result = order2.with_context(skip_rfq_confirmation=True)._check_pending_order()
result = order2.with_context(skip_confirm_message=True)._check_pending_order()
self.assertIsNone(result, "Result should be None")
result = order2._check_pending_order()
self.assertIsInstance(result, dict, "Result should be dict")
Expand All @@ -68,7 +68,7 @@ def test_button_confirm(self):
order2 = self._get_and_create_purchase_order()
order3 = self._get_and_create_purchase_order()

order3.with_context(skip_rfq_confirmation=True).button_confirm()
order3.with_context(skip_confirm_message=True).button_confirm()

self.assertEqual(order2.state, "draft", "Order should be draft")
line1, line2 = order2.order_line
Expand All @@ -93,7 +93,7 @@ def test_button_confirm(self):
"Callback method must be 'nutton_confirm'",
)

result = wizard.with_context(skip_rfq_confirmation=True).action_confirm()
result = wizard.with_context(skip_confirm_message=True).action_confirm()
self.assertTrue(result, "Result should be True")
self.assertEqual(order2.state, "purchase", "Order state must be 'purchase'")
activity = order2.activity_ids
Expand Down
2 changes: 1 addition & 1 deletion purchase_duplicate_check/wizard/confirmation_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ def action_confirm(self):
"purchase_duplicate_check.repeating_orders_activity_type_id", False
)
)
if self._context.get("skip_rfq_confirmation") and action_type_id:
if action_type_id:
self._create_po_activity(int(action_type_id))
return super().action_confirm()

0 comments on commit 17a59be

Please sign in to comment.