Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Calling an object method from within a salary rule

By
Nathan Carter
on 7/6/14, 12:05 AM 1,287 views

I am working on an Australian payroll module for Odoo and due to the complicated way our tax system works I need to be able to call a method in the employee object and pass it some parameters (such as date to and the taxable income for the payment period) which would then look up the relevant tax table and return the tax to be deducted from the employee's pay.

I have a method in hr.employee calculate_paygw(self, cr, uid, ids, date, taxin, context=None) and attempt to call it within a salary rule. The problem is that it is never called and I get an error - wrong python code defined for salary rule.

Is it possible to call a method on an object within a salary rule? If so, how do I do it?

0
Abdul Nazar
On 6/30/15, 5:22 AM

Try this code in salary rule

result = (employee.calculate_paygw(date,taxin)

Hi !!! This solution doesn't work for me. Is there any other trick available to call method or to define new object for custom module within a SALARY RULE ?

PujaBaa Zala
on 8/14/15, 7:42 AM

Your code should be like below In Python file: def calculate_paygw(self, cr, uid, ids, employee, date_from, date_to, context=None): # your code return total In Rule: result = employee.calculate_paygw(payslip.employee_id,payslip.date_from,payslip.date_to) I hope its work else send me your code....

Abdul Nazar
on 8/16/15, 3:03 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/6/14, 12:05 AM
Seen: 1287 times
Last updated: 6/30/15, 5:22 AM