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

Language:
English Edit question
Status:
Answered
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
2012-10-16
Last reply:
2012-10-22

Hello Sam,

Accept Greetings from SerpentCS,

You need write following salary rule:

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

Reasons:
>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.

Regards,
Serpent Consulting Services,
http://www.serpentcs.com

Sam Boateng (samb) said : #2

Thanks,

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

Regards

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.
Regards,
Serpent Consulting Services,
http://www.serpentcs.com

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.