mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[IMP] hr_payroll_hibou: Control the 'wage_type' at the HR Contract Level
This will make it possible to be more abstract with 'work_type' or 'worked days lines' and overtime.
This commit is contained in:
@@ -2,4 +2,5 @@
|
||||
|
||||
from . import common
|
||||
|
||||
from . import test_contract_wage_type
|
||||
from . import test_special
|
||||
|
||||
@@ -10,16 +10,21 @@ from odoo.tools.float_utils import float_round as odoo_float_round
|
||||
|
||||
def process_payslip(payslip):
|
||||
try:
|
||||
payslip.action_payslip_done()
|
||||
return payslip.action_payslip_done()
|
||||
except AttributeError:
|
||||
# v9
|
||||
payslip.process_sheet()
|
||||
return payslip.process_sheet()
|
||||
|
||||
|
||||
class TestPayslip(common.TransactionCase):
|
||||
debug = False
|
||||
_logger = getLogger(__name__)
|
||||
|
||||
def process_payslip(self, payslip=None):
|
||||
if not payslip:
|
||||
return process_payslip(self.payslip)
|
||||
return process_payslip(payslip)
|
||||
|
||||
def setUp(self):
|
||||
super(TestPayslip, self).setUp()
|
||||
self.contract_model = self.env['hr.contract']
|
||||
|
||||
26
hr_payroll_hibou/tests/test_contract_wage_type.py
Normal file
26
hr_payroll_hibou/tests/test_contract_wage_type.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from .common import TestPayslip, process_payslip
|
||||
|
||||
|
||||
class TestContractWageType(TestPayslip):
|
||||
|
||||
def test_per_contract_wage_type_salary(self):
|
||||
self.debug = True
|
||||
salary = 80000.0
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee, wage=salary, hourly_wage=salary/100.0, wage_type='monthly', schedule_pay='bi-weekly')
|
||||
payslip = self._createPayslip(employee, '2019-12-30', '2020-01-12')
|
||||
self.assertEqual(contract.wage_type, 'monthly')
|
||||
self.assertEqual(payslip.wage_type, 'monthly')
|
||||
cats = self._getCategories(payslip)
|
||||
self.assertEqual(cats['BASIC'], salary)
|
||||
|
||||
def test_per_contract_wage_type_hourly(self):
|
||||
self.debug = True
|
||||
hourly_wage = 21.50
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee, wage=hourly_wage*100.0, hourly_wage=hourly_wage, wage_type='hourly', schedule_pay='bi-weekly')
|
||||
payslip = self._createPayslip(employee, '2019-12-30', '2020-01-12')
|
||||
self.assertEqual(contract.wage_type, 'hourly')
|
||||
self.assertEqual(payslip.wage_type, 'hourly')
|
||||
cats = self._getCategories(payslip)
|
||||
self.assertEqual(cats['BASIC'], hourly_wage * 80.0)
|
||||
Reference in New Issue
Block a user