[FIX] hr_payroll: Use date_to_str on work entries generation

Purpose
=======

This aim to avoid sending a datetime that will be converted into UTC
and that way have a wrong date set on the payslip.
This commit is contained in:
Yannick Tivisse
2019-03-19 09:35:32 +01:00
parent a8e8ef634f
commit 6806b8f8d8
2 changed files with 3 additions and 4 deletions
@@ -55,7 +55,7 @@ odoo.define('hr_payroll.WorkEntryControllerMixin', function(require) {
this._rpc({
model: 'hr.employee',
method: 'generate_work_entry',
args: [time.datetime_to_str(this.firstDay), time.datetime_to_str(this.lastDay)],
args: [time.date_to_str(this.firstDay), time.date_to_str(this.lastDay)],
}).then(function () {
self.reload();
});
@@ -64,8 +64,8 @@ odoo.define('hr_payroll.WorkEntryControllerMixin', function(require) {
_generatePayslips: function () {
this.do_action('hr_payroll.action_generate_payslips_from_work_entries', {
additional_context: {
default_date_start: time.datetime_to_str(this.firstDay),
default_date_end: time.datetime_to_str(this.lastDay),
default_date_start: time.date_to_str(this.firstDay),
default_date_end: time.date_to_str(this.lastDay),
},
});
},
@@ -74,7 +74,6 @@ class TestPayslipMultiContract(TestPayslipContractBase):
start = datetime.strptime('2015-11-05 07:00:00', '%Y-%m-%d %H:%M:%S')
end = datetime.strptime('2015-12-15 18:00:00', '%Y-%m-%d %H:%M:%S')
self.contract_cdi.write({'date_start': datetime.strptime('2015-12-30', '%Y-%m-%d').date()})
print(self.contract_cdi.date_start, 'test')
# begins during contract, ends after contract
leave = self.create_leave(start, end)
leave.action_approve()