Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
7603 Widoki

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).

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć

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 :-)

Powiązane posty Odpowiedzi Widoki Czynność
0
kwi 22
1868
1
mar 15
5734
0
mar 22
2
1
mar 15
7478
2
mar 15
5829