diff --git a/hr_expense_tier_validation/tests/test_hr_expense_tier_validation.py b/hr_expense_tier_validation/tests/test_hr_expense_tier_validation.py index 716913bbd..b947f86ff 100644 --- a/hr_expense_tier_validation/tests/test_hr_expense_tier_validation.py +++ b/hr_expense_tier_validation/tests/test_hr_expense_tier_validation.py @@ -26,12 +26,8 @@ def setUp(self): "reviewer_id": self.test_user_1.id, } ) - employee_home = self.env["res.partner"].create( - {"name": "Employee Home Address"} - ) - self.employee = self.env["hr.employee"].create( - {"name": "Employee A", "address_home_id": employee_home.id} - ) + + self.employee = self.env["hr.employee"].create({"name": "Employee A"}) self.product_1 = self.env.ref("product.product_product_1") def _create_expense( @@ -60,22 +56,14 @@ def test_edit_value_expense(self): self.product_1, ) sheet_dict = expense.action_submit_expenses() - sheet_dict = sheet_dict["context"] - with Form(self.env["hr.expense.sheet"]) as sheet: - sheet.name = (sheet_dict["default_name"],) - sheet.employee_id = self.employee - sheet = sheet.save() - sheet.expense_line_ids = [(6, 0, expense.id)] + sheet = self.env["hr.expense.sheet"].browse(sheet_dict["res_id"]) self.assertEqual(sheet.state, "draft") sheet.action_submit_sheet() self.assertEqual(sheet.state, "submit") # Must request validation before approve - with self.assertRaises(ValidationError): - sheet.approve_expense_sheets() sheet.request_validation() self.assertTrue(sheet) sheet.invalidate_model() - # tier validation but state still submit self.assertEqual(sheet.state, "submit") # not allow edit expense when under validation diff --git a/hr_expense_tier_validation/views/hr_expense_sheet_view.xml b/hr_expense_tier_validation/views/hr_expense_sheet_view.xml index e20223c02..41393f223 100644 --- a/hr_expense_tier_validation/views/hr_expense_sheet_view.xml +++ b/hr_expense_tier_validation/views/hr_expense_sheet_view.xml @@ -1,4 +1,3 @@ -