Skip to Content
Menu
This question has been flagged
3 Replies
17794 Views

Could anybody tell me how to edit the qweb templat for the purchase order with a custom modul. I already tried it, but it doesent work and no error is given. If I add an id to the template it even shows under the associated QWeb views of Purchase Order.

__openerp__.py

{
    'name': 'report test',
    'version': '1.0',
    'category': 'test',
    'summary': 'test',
    'description': """
    test
    """,
    'author': 'test',
    'website': 'test',
    'depends': ['sales_team','account_voucher', 'procurement', 'report'],
    'data': [
        'views/report_purchase_extend.xml',
    ],
    'demo': [],
    'installable': True,
    'auto_install': False,
    'application': True,
}

views/report_purchase_extend.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template>
    <tr t-extend="purchase.report_purchaseorder">
        <t t-jquery="div.page" t-operation="replace">
                <t t-foreach="docs" t-as="o"/>
            <div class ="page">
            </div>
        </t>
    </tr>
</template>
</data>
</openerp>

and an empty __init__.py file.

Avatar
Discard

I have the same problem. No install error but nothing changes in template. Take a look to my post too, because maybe someone could give us a solution there. https://www.odoo.com/forum/Help-1/question/Inherit-Qweb-54163

Author Best Answer

I solved it with the following code.

__openerp__.py

{
    'name': 'report test',
    'version': '1.0',
    'category': 'test',
    'summary': 'test',
    'description': """
    test
    """,
    'author': 'test',
    'website': 'test',
    'depends': ['base_setup', 'purchase', 'report'],
    'data': [
        'views/report_purchase_extend.xml',
    ],
    'demo': [],
    'installable': True,
    'auto_install': False,
    'application': True,
}

views/report_purchase_extend.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <template id="report_purchaseorder_extend" inherit_id="purchase.report_purchaseorder">
            <xpath expr="//div[@class='page']" position="replace">
                <div class ="page">
                </div>
            </xpath>
        </template>
    </data>
</openerp>

and an empty __init__.py file.

Avatar
Discard
Best Answer

I think you need to inherit the menu which contains the link to the report. 

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <report 
            id="report_sale_order"
            string="Quotation / Order"
            model="sale.order" 
            report_type="qweb-pdf"
            file="sale.report_saleorder" 
            name="sale.report_saleorder" 
        />
    </data>
</openerp>

 

Avatar
Discard
Best Answer

Hi, try this:

<templates>
    <tr t-extend="purchase.report_purchaseorder">
        <t t-jquery=".page" t-operation="replace">
             <t t-foreach="docs" t-as="o"/>
            <div class ="page">

                <span id="change_test"/>
            </div>
        </t>
    </tr>
</templates>

if you can see the id change_test in fe. firebug the template is changed ... but I experience some strange behavior that also the template from which I inherit is changed -- so where is the use of inheritance here if everything is changed?

Avatar
Discard
Related Posts Replies Views Activity
0
Dec 15
4254
0
Mar 15
3392
1
Mar 15
14336
4
Feb 24
48042
11
Apr 23
92672