Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
2599 Widoki

Hello,

I want to add one custom field in payslip object used in python condition of salary rule.
and that field used in computation of salary rule.Can any one please tell me with example?How it can be done in python? I am using Odoo 10 version.

Thanks in Advance,

Awatar
Odrzuć
Najlepsza odpowiedź

Inherit the payslip model and add the field (add also to the form view)

class HrPyslip(models.Model):
_inherit = 'hr.payslip'

bonus_extra = fields.Float()
And use in your custome salary rule
<record id="my_custom_rule" model="hr.salary.rule">
<field name="name">Custom_Rule</field>
<field name="sequence">100</field>
<field name="code">100</field>
<field name="category_id" ref="hr_payroll.BASIC"/>
<field name="condition_select">python</field>
<field name="condition_python">result = bool(payslip.bonus_extra > 100)</field>
<field name="amount_select">code</field>
<field name="amount_python_compute">result=(payslip.bonus_extra*3.14)</field>
</record>


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
sie 22
2406
1
lip 22
20113
0
kwi 22
3074
3
wrz 21
3243
2
wrz 21
4543