This question has been flagged
5 Replies
10990 Views

Hello everybody!!!!!!!

Please, i want to ask you i have a field in OpenERP.

And i want to know how can i call a salary rule that i have created to calculate a field that i will specify for my report.

Thanks a lot in advance.

Best Regards.


Avatar
Discard

Hello Drees, if you want to call a salary rule from a payslip, just go though get_payslip_lines() method, in that you can traverse salary rule. Hope this helps.

Best Answer

Hi Rihene,


Create a unique categorie for this rule than call it.


Ex: Rules 20, cat for this rule "CatUnic",

Call: Result = categories.CatUnic.


Hope it will help you.

Avatar
Discard
Best Answer

Hi

I am using odoo 12 enterprise. I added a field to the contract using studio (field name: x_studio_xxxx)

Then I created a salary rule , python code 

result=contract.x_studio_xxxx * 0.1

But that code won't run (error)

I think I am using a wrong way to access the new field, any Ideas please?


Avatar
Discard
Best Answer

Hello Drees,

You can use below variables in your salary rule:

payslip: object containing the payslips

employee: hr.employee object

contract: hr.contract object

rules: object containing the rules code (previously computed)

categories: object containing the computed salary rule categories (sum of amount of all rules belonging to that category).

worked_days: object containing the computed worked days

inputs: object containing the computed inputs

These variables will work as a browse record for respective object.

For example,

if you want to access employee from payslip, you just have to define payslip.employee_id.

Hope this helps..!

Regards,

Kalpana Hemnani

Avatar
Discard
Author

hi my friend :) thx a lot for your answer but what i want to know is how can i call a salary rule into a function and i will give it a specific field to work on its value plz