Odoo Help


Compute the payslip batch total

on 3/8/16, 1:16 PM 1,038 views

I am trying to create a report for payslip batch (hr.payslip.run model) in odoo8. Everything is good. I have my report with the list of employee and their net salaries. I would like to have at the buttom of report, the sum or total of all net salaries. How can i do it?


How can i call this function in qweb report to have the payslip batch sum in my report?

def get_payslip_data(self, cr, uid, context=None):

retval = {}

payslip_ids = []

slip_run_ids = context.get('active_ids')

slip_runs = self.pool.get('hr.payslip.run').browse(cr, uid, slip_run_ids, context=context)

payslip_obj = self.pool.get('hr.payslip')

for run in slip_runs:

payslip_ids.extend([x.id for x in run.slip_ids])

payslips = payslip_obj.browse(cr, uid, payslip_ids, context=context)

net_total = 0

net_salary_rule_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'hr_payroll', 'hr_rule_net')[1]

for payslip in payslips:

lines = payslip_obj.get_visible_lines(cr, uid, payslip.id, context=context)

net_salary = sum(x.total for x in lines if x.salary_rule_id.id == net_salary_rule_id)

net_total += net_salary

retval[payslip] = {

'net_salary': net_salary,


return (retval, net_total)

on 7/7/16, 1:19 PM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 3/8/16, 1:16 PM
Seen: 1038 times
Last updated: 3/8/16, 1:16 PM