Hello once again,
I'm still lost with all this inheritance problems!
COuld you help me to define this override?
I only want to redefine the method _get_payslip_lines in the class contribution_register_report.
For the moment, I have this code in my custom module :
import time
from datetime import datetime
from dateutil import relativedelta
from openerp.osv import osv
from openerp.report import report_sxw
class contribution_register_report(report_sxw.rml_parse):
_inherit = 'contribution_register_report'
def _get_payslip_lines(self, obj):
payslip_line = self.pool.get('hr.payslip.line')
payslip_lines = []
res = []
self.regi_total = 0.0
self.cr.execute("SELECT pl.id from hr_payslip_line as pl "\
"LEFT JOIN hr_payslip AS hp on (pl.slip_id = hp.id) "\
"WHERE (hp.date_from >= %s) AND (hp.date_to <= %s) "\
"AND pl.register_id = %s "\
"AND hp.state = 'done' "\
"ORDER BY pl.slip_id, pl.sequence",
(self.date_from, self.date_to, obj.id))
payslip_lines = [x[0] for x in self.cr.fetchall()]
for line in payslip_line.browse(self.cr, self.uid, payslip_lines):
res.append({
'payslip_name': line.slip_id.name,
'name': line.name,
'code': line.code,
'quantity': line.quantity,
'amount': line.amount,
'total': line.total,
'number': line.slip_id.number,
})
self.regi_total += line.total
return res
BIG THANKS!!!!
UPDATE :
Also tried
class contribution_register_report(report_sxw.rml_parse):
_inherit = 'hr_payroll.report.report.contribution_register_report'
Also tried
class contribution_register_report(report_sxw.rml_parse):
_inherit = 'hr_payroll.report.contribution_register_report'
May be I should use a « super » somewhere?
A little up here! I have still not found how to inherit contribution_register_report class to override the method _get_payslip_lines.... Do you know how to do it?