Skip to content

Commit

Permalink
[FIX] Fix tests in payroll
Browse files Browse the repository at this point in the history
  • Loading branch information
cvinh committed Feb 3, 2024
1 parent 77a01d9 commit 5a9d584
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions payroll/tests/test_payslip_flow.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from datetime import timedelta

from odoo.fields import Date
from odoo.tests import Form
from odoo.tools import test_reports
Expand Down Expand Up @@ -222,12 +224,14 @@ def test_get_contracts_singleton(self):
len(contracts), 1, "There is one open contract for the employee"
)

self.sally.contract_id.date_end = Date.today().strftime("%Y-%m-15")
self.sally.contract_id.date_end = (Date.today() - timedelta(days=1)).strftime(
"%Y-%m-%d"
)
self.Contract.create(
{
"name": "Second contract for Sally",
"employee_id": self.sally.id,
"date_start": Date.today().strftime("%Y-%m-16"),
"date_start": Date.today().strftime("%Y-%m-%d"),
"struct_id": self.sales_pay_structure.id,
"wage": 6500.00,
"state": "open",
Expand All @@ -241,12 +245,14 @@ def test_get_contracts_singleton(self):

def test_get_contracts_multiple(self):

self.sally.contract_ids[0].date_end = Date.today().strftime("%Y-%m-15")
self.sally.contract_ids[0].date_end = (
Date.today() - timedelta(days=1)
).strftime("%Y-%m-%d")
self.Contract.create(
{
"name": "Second contract for Sally",
"employee_id": self.sally.id,
"date_start": Date.today().strftime("%Y-%m-16"),
"date_start": Date.today().strftime("%Y-%m-%d"),
"struct_id": self.sales_pay_structure.id,
"wage": 6500.00,
"state": "open",
Expand Down

0 comments on commit 5a9d584

Please sign in to comment.