hey everybody, i'm working on how to inherit custom RML report parser calss in openERP , here my essay... python file:
from account.report import account_print_invoice
from tools.integerToWords_fr import final_result
from openerp.report import report_sxw
from netsvc import Service
del Service._services['report.account.print.invoice']
# create a custom parser inherited from sale order parser:
class new_invoice_report(account_print_invoice.account_invoice):
'''Custom parser with an additional method
'''
def __init__(self, cr, uid, name, context):
super(new_invoice_report, self).__init__(cr, uid, name, context)
self.localcontext.update({
'final_result':final_result,
})
# remove previous sale.report service :
# register the new report service :
report_sxw.report_sxw(
'report.account.print.invoice',
'account.print.invoice',
'addons/l10n/report/account_print_invoice_d.rml',
parser=new_invoice_report
)
xml file:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report
auto="False"
id="account_invoices_d"
model="account.invoice"
name="account.invoice_d"
rml="l10n/report/account_print_invoice_d.rml"
string="Invoices"
attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
attachment_use="True"
usage="default"
/>
</data>
</openerp>
i have done the code below but still taking the original parser