Skip to content

Commit

Permalink
[MIG] hr_expense_tier_validation: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
WorrapongOngsakul committed Mar 15, 2024
1 parent 92b5996 commit 971df3b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion hr_expense_tier_validation/views/hr_expense_sheet_view.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="hr_expense_sheet_view_search" model="ir.ui.view">
<field
Expand Down

0 comments on commit 971df3b

Please sign in to comment.