diff --git a/addons/hr_payroll/models/hr_payroll.py b/addons/hr_payroll/models/hr_payroll.py index 1de301eece7..8a5c5437196 100644 --- a/addons/hr_payroll/models/hr_payroll.py +++ b/addons/hr_payroll/models/hr_payroll.py @@ -579,21 +579,6 @@ class HrPayslip(models.Model): }) return res - # YTO TODO: employee_id and contract_id could be browse records - @api.multi - def onchange_contract_id(self, date_from, date_to, employee_id=False, contract_id=False): - # TODO it seems to be the mess in the onchanges - # we should have onchange_employee => onchange_contract => doing all the things - res = { - 'value': { - 'line_ids': [], - 'name': '', - } - } - if not contract_id: - res['value'].update({'struct_id': False}) - return self.with_context(contract=True).onchange_employee_id(date_from=date_from, date_to=date_to, employee_id=employee_id, contract_id=contract_id) - @api.onchange('employee_id', 'date_from') def onchange_employee(self): diff --git a/addons/hr_payroll_account/models/hr_payroll_account.py b/addons/hr_payroll_account/models/hr_payroll_account.py index a9871453885..788f0ff9939 100644 --- a/addons/hr_payroll_account/models/hr_payroll_account.py +++ b/addons/hr_payroll_account/models/hr_payroll_account.py @@ -64,13 +64,6 @@ class hr_payslip(osv.osv): vals.update({'journal_id': context.get('journal_id')}) return super(hr_payslip, self).create(cr, uid, vals, context=context) - def onchange_contract_id(self, cr, uid, ids, date_from, date_to, employee_id=False, contract_id=False, context=None): - contract_obj = self.pool.get('hr.contract') - res = super(hr_payslip, self).onchange_contract_id(cr, uid, ids, date_from=date_from, date_to=date_to, employee_id=employee_id, contract_id=contract_id, context=context) - journal_id = contract_id and contract_obj.browse(cr, uid, contract_id, context=context).journal_id.id or (not contract_id and self._get_default_journal(cr, uid, context=None)) - res['value'].update({'journal_id': journal_id}) - return res - @api.onchange('contract_id') def onchange_contract(self): super(hr_payslip, self).onchange_contract() diff --git a/addons/hr_payroll_account/test/hr_payroll_account.yml b/addons/hr_payroll_account/test/hr_payroll_account.yml index fc4e81c4ac5..1770b7f8848 100644 --- a/addons/hr_payroll_account/test/hr_payroll_account.yml +++ b/addons/hr_payroll_account/test/hr_payroll_account.yml @@ -76,7 +76,6 @@ } vals['worked_days_line_ids'] = [(0,0,i) for i in res['value']['worked_days_line_ids']] vals['input_line_ids'] = [(0,0,i) for i in res['value']['input_line_ids']] - res_contract = self.onchange_contract_id(cr, uid, [ref('hr_payslip_0')], date_from, date_to, ref('hr_employee_john'), ref('hr_contract_john'), None) vals.update({'contract_id': ref('hr_contract_john')}) self.write(cr, uid, ref("hr_payslip_0"), vals) -