[FIX] hr_payroll: creation of a salary computation line
To create a payslip line the fields: -employee_id -contract_id -salary_rule_id are required. opw:681912
This commit is contained in:
@@ -955,6 +955,15 @@ class hr_payslip_line(osv.osv):
|
||||
'total': fields.function(_calculate_total, method=True, type='float', string='Total', digits_compute=dp.get_precision('Payroll'),store=True ),
|
||||
}
|
||||
|
||||
def create(self, cr, uid, values, context=None):
|
||||
if 'employee_id' not in values or 'contract_id' not in values:
|
||||
payslip = self.pool['hr.payslip'].browse(cr, uid, values.get('slip_id') or [])
|
||||
values['employee_id'] = values.get('employee_id') or payslip.employee_id.id
|
||||
values['contract_id'] = values.get('contract_id') or payslip.contract_id and payslip.contract_id.id
|
||||
if not values['contract_id']:
|
||||
raise UserError(_('You must set a contract to create a payslip line.'))
|
||||
return super(hr_payslip_line, self).create(cr, uid, values, context=context)
|
||||
|
||||
_defaults = {
|
||||
'quantity': 1.0,
|
||||
'rate': 100.0,
|
||||
|
||||
@@ -296,6 +296,7 @@
|
||||
<field name="sequence" invisible="1"/>
|
||||
<field name="quantity"/>
|
||||
<field name="rate"/>
|
||||
<field name="salary_rule_id"/>
|
||||
<field name="amount"/>
|
||||
<field name="total"/>
|
||||
</tree>
|
||||
|
||||
@@ -1351,6 +1351,12 @@ msgstr ""
|
||||
msgid "You must select employee(s) to generate payslip(s)."
|
||||
msgstr ""
|
||||
|
||||
#. module: hr_payroll
|
||||
#: code:addons/hr_payroll/hr_payroll.py:964
|
||||
#, python-format
|
||||
msgid "You must set a contract to create a payslip line."
|
||||
msgstr ""
|
||||
|
||||
#. module: hr_payroll
|
||||
#: model:ir.model,name:hr_payroll.model_hr_payroll_config_settings
|
||||
msgid "hr.payroll.config.settings"
|
||||
|
||||
Reference in New Issue
Block a user