odoo salary sum

Some deductions have a yearly limit per employee. Is there away to check these registers within a salary rule to determine if the maximum has been paid?

To elaborate:

In Canada we have two limited deductions, one of which is EI (employment Insurance) which deducts 1.88% of the total payslip up to a maximum of $891.12 within the year after which the deduction stops. In order to achieve this I am looking to add a Python Expression under condition that grabs the total contributions over the year period and if it is less then the $891.12 allow the payroll rule to proceed. My issue I am hitting is that I am unsure how to get the total of one register for the year to date within the condition rule.


3
Nicholas Linn
Okay found this out for myself under the example above, the following conditional statement will work assuming the rule name is EI:

result = payslip.sum(‘EI’,’2013-01-01′,’ 2013-12-31′) > -891.12

Still would be nice not to have to change the formula every year. Any ideas?

Bit of a hack but you can use the contract start and end date to define the fiscal year:

result = payslip.sum(‘EI’,contract.date_start,contract.date_end) > -891.12

Leave a Reply

Your email address will not be published. Required fields are marked *