Payslip.sum - year to date gross

Asked by Sam Boateng on 2012-10-13

As suggest in the forums, I am trying to calculate the year to date Gross salary using the salary rule payslip.sum('GROSS', 01/01/2012, 31/12/2012) but I am getting an error "Wrong python code defined for salary rule". Is there something I am missing? This is for 6.1

Question information

English Edit question
Odoo Addons (MOVED TO GITHUB) Edit question
No assignee Edit question
Last query:
Last reply:

Hello Sam,

Accept Greetings from SerpentCS,

You need write following salary rule:

result = payslip.sum('GROSS','2012-01-01',' 2012-12-31')
result = payslip.sum('GROSS','2012-01-01')

>This is the date formate used by postgres database.
>You need to pass date as a string arguments.
>To Date is not compulsory field, If you will not pass ToDate it will take current date as a default ToDate.

Hope this will solve your issue.

Serpent Consulting Services,

Sam Boateng (samb) said : #2


I made the change but I only get the GROSS value for the month and not the sum of the GROSS from the Date_From specified

What am I doing wrong


Hello Sam,

Year to date computation is working well at my end.
Make sure that you previous payslips are confirmed because payslip.sum() will compute only confirmed payslips.
I am sure that your previous payslips are in draft state that's why its not computing Y2D calculations.

Please confirm your previous payslips and check computing new payslips.
Serpent Consulting Services,

Can you help with this problem?

Provide an answer of your own, or ask Sam Boateng for more information if necessary.

To post a message you must log in.