Odoo Help

Welcome!

This community 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.

1

Edit the qweb template with a custom modul.

By
Artur Bertram
on 6/13/14, 9:12 AM 4,795 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.

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

Alex
on 6/14/14, 5:29 AM
0
Artur Bertram
On 8/4/14, 8:50 AM

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.

0
Peter Nietz
On 6/18/14, 5:46 AM

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?

0
Vũ Quốc Hoàng
On 6/16/14, 4:12 AM

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>

 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 6/13/14, 9:12 AM
Seen: 4795 times
Last updated: 3/16/15, 8:10 AM