From c8e372cb4a8b8df267fd53cdf6853c02b575bb86 Mon Sep 17 00:00:00 2001 From: hitrosol Date: Sun, 16 Feb 2025 17:34:18 +0700 Subject: [PATCH] fix unit test --- .../tests/test_purchase_request_expense.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/purchase_request_expense/tests/test_purchase_request_expense.py b/purchase_request_expense/tests/test_purchase_request_expense.py index 36b12c174a9..33838e44be3 100644 --- a/purchase_request_expense/tests/test_purchase_request_expense.py +++ b/purchase_request_expense/tests/test_purchase_request_expense.py @@ -85,8 +85,19 @@ def test_01_module_installation_check(self): "employee_id": self.employee.id, } ) - # Since the module hr_expense_advance_clearing is installed in test - self.assertTrue(wizard._has_expense_advance_clearing()) + + # Check if hr_expense_advance_clearing is in the installed modules list + module = self.env["ir.module.module"].search( + [("name", "=", "hr_expense_advance_clearing")] + ) + is_installed = module.state == "installed" if module else False + + # Test should pass whether module is installed or not + self.assertEqual( + wizard._has_expense_advance_clearing(), + is_installed, + "Module installation check should match actual installation status", + ) def test_02_error_handling_no_items(self): """Test error when trying to create expense without items"""