Odoo Help


Can't override rml report

Tomas Parnarauskas
on 6/7/13, 6:15 AM 6,369 views

I created module that overrides default invoice and it should use different rml file making it easy to change without changing anything in original account module. But somehow it still used old rml file even though in settings/actions/reports, it shows that report is using my custom rml which is located in my module. When I edit my rml file, nothing changes. When I edit original rml file (that should be overriden and shouldn't affect what will be printed in invoice) it changes my printed invoice, when I edit my rml file nothing changes. Is something went wrong?

My module: print_invoice.py

import time
from openerp.report import report_sxw

class account_invoice(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(account_invoice, self).__init__(cr, uid, name, context=context)
            'time': time,


xml file:

<?xml version="1.0" encoding="utf-8"?>
        attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"


    'name': 'Custom Invoice template',
    'version': '1.0',
    'depends': ['base_registry_code'],
    'author': 'OERP',
    'description': """
Account Print Invoice

This module customizes default invoice. It adds company registry code in invoice template.

    'website': '',
    'category': 'report',
    'demo': [],
    'test': [],
    'data': ['account_invoice_report.xml'
    'auto_install': False,
    'installable': True,

Make sure you have import py file in __init__.py.

Sudhir Arya (ERP Harbor Consulting Services)
on 6/7/13, 6:34 AM

I have import py file in report/__init__.py

NOD Baltic, UAB, Tomas Parnarauskas
on 6/7/13, 6:41 AM

Did you add xml file in __openerp__.py?

Sudhir Arya (ERP Harbor Consulting Services)
on 6/7/13, 8:36 AM
On 6/7/13, 12:11 PM

Did you use OpenERP Version 7 ?

In V7 there are different solutions to print. (A top print button with pulldown list, B below print button eg red) Print Button A maybe disappear if multi="True". The report id is hard coded in the method called if you click on print button B.

I have overwritten the invoice_print method and changed the return value to my report. It works for me, maybe there are better solutions.


from osv import osv, fields
from tools.translate import _

class account_invoice(osv.osv):

    def invoice_print(self, cr, uid, ids, context=None):
        res = super(account_invoice, self).invoice_print( cr, uid, ids,context) #self, cr, uid, ids, context)
        res["report_name"] = "custom.account.invoice"
        return res



import invoice

Yes I did use OpenERP 7. I used your code and it worked. Just needed a bit of modifications, because newer openerp revisions changed where osv and tools are located. Now it should be: from openerp.osv import osv, fields from openerp.tools.translate import _ .Thanks.

NOD Baltic, UAB, Tomas Parnarauskas
on 6/10/13, 3:57 AM

Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 




Sudhir Arya
ERP Harbor Consulting Services
Sudhir Arya (ERP Harbor Consulting Services)
On 6/7/13, 6:36 AM

I tried your code and I have doubt that you didn't add your xml file in __openerp__.py.

There is one more thing you need to change in xml that is you need to remove multi="True". Else everything is ok.

multi="True" is used when you want to remove your report from Print option in form view.

Make this changes, restart server and update your module.

Inherit Custom RML Report this may be help you.

Don't understan't why it does not work. I removed multi="True". I updated my answer with __openerp__.py file data.

NOD Baltic, UAB, Tomas Parnarauskas
on 6/7/13, 9:44 AM


--Borni DHIFI--
| 6 8 9
Tunis, Tunisia
--Borni DHIFI--

Techno Functional Consultant Odoo(OpenERP) 


Skype : dhifi.borni

On 6/7/13, 6:19 AM

I looked into this this one. But it seems like its code is the same as mine (just for different report)

NOD Baltic, UAB, Tomas Parnarauskas
on 6/7/13, 6:48 AM

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

0 follower(s)


Asked: 6/7/13, 6:15 AM
Seen: 6369 times
Last updated: 3/16/15, 8:10 AM