Skip to Content
Menu
This question has been flagged
1 Reply
7586 Views

My Modul for OpenERP 6.1 do not work with OpenERP 7.0 .

I believe the problem is the declaration 'report_name': 'sale.order' in the print_quotation method. (Report name instead of report id)

I used for my report the same name, as quick fix. This works, but i have problems with the translation (my po file is not used).

I want replace the "print" button with my own version and call my own "print_quotation_new" method, but i can not evaluate the consequences (for workflows or whatever).

Avatar
Discard
Best Answer

You can override the default report like below

1) Create a xml file in your module custom_report.xml with following content

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <report auto="False" id="sale.report_sale_order" model="sale.order" name="sale.order"
                rml="your_module/report/sale_order.rml" string="New Quotation / Order"
                usage="default"/>
    </data>
</openerp>

2) Copy your custom rml file to your_module/report/sale_order.rml

3) Create your custom parser your_module/report/sale_order.py

import time
from sale.report import sale_order
from openerp.report import report_sxw

class order(sale_order.order):
    def __init__(self, cr, uid, name, context):
        super(order, self).__init__(cr, uid, name, context=context)

from netsvc import Service
del Service._services['report.sale.order']

report_sxw.report_sxw('report.sale.order', 'sale.order', 'your_module/report/sale_order.rml', parser=order, header='external')

4) create your_module/report/__init__.py

import sale_order

5)update your __openerp__.py file

'data': ['custom_report.xml',]

6) Restart your server and update your module

Avatar
Discard

I have already wondered what is the right way to replace reports... Does this mean in v6, report name has to be changed and in v7, not name but id?

Report name should be same and the id should be changed to 'module.id' format.

Okay, thank you for that information. Very often, I read that name should be changed, but when doing like that, my module could not be fully uninstalled again. Maybe, this depends on OpenERP version. What I still do not understand is the think with the id changed to 'module.id' - is it really important that id is called like that? I thought id only has to be unique. What if you override same report twice? Then you need another id, anyway...

report name should be same and the id should be changed :-)

Related Posts Replies Views Activity
0
Apr 22
1848
1
Mar 15
5707
0
Mar 22
2
1
Mar 15
7439
2
Mar 15
5807