diff --git a/purchase_duplicate_check/models/purchase_order.py b/purchase_duplicate_check/models/purchase_order.py index efff07d3d34..f1b5f5248f5 100644 --- a/purchase_duplicate_check/models/purchase_order.py +++ b/purchase_duplicate_check/models/purchase_order.py @@ -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): """ diff --git a/purchase_duplicate_check/tests/test_purchase_order.py b/purchase_duplicate_check/tests/test_purchase_order.py index 507e8ecb6af..331a3aba11f 100644 --- a/purchase_duplicate_check/tests/test_purchase_order.py +++ b/purchase_duplicate_check/tests/test_purchase_order.py @@ -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") @@ -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 @@ -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 diff --git a/purchase_duplicate_check/wizard/confirmation_wizard.py b/purchase_duplicate_check/wizard/confirmation_wizard.py index 3815ba4f610..50ecc935dbf 100644 --- a/purchase_duplicate_check/wizard/confirmation_wizard.py +++ b/purchase_duplicate_check/wizard/confirmation_wizard.py @@ -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()