Skip to Content
Menú
This question has been flagged
1 Respondre
6769 Vistes

I have created a report xyz for product.template model, its definition is here

<openerp>

<data>

<report

id="report_prod_used_det"

model="product.template"

string="Stampa Consumo"

name="mymodule.report_prod_used_det_view"

file="mymodule.report_used_prod"

report_type="qweb-pdf" . . .

it is working as expected but visible only in product.template model, I need to view the same report for product.product.

My question is this, I have to create another report that must be based on product.product or there is some trick that can be used to view xyz report from both models, since product.template inherits from product.product.

Avatar
Descartar
Best Answer

Hi Shahid,
You need to make new template and call your original template.

For example:

<odoo>

<template id="report_producttemplatelabel">

     <t t-call="web.basic_layout">

         <div class="page">

         <t t-foreach="docs" t-as="template">

             <t t-foreach="template.product_variant_ids" t-as="product">

                 <t t-call="product.report_simple_label">

                 <t t-set="product" t-value="product"/>

            </t>

         </t>

     </t>

</div>

</t>

</template>

</odoo>

Make Definition :

<report

id="report_product_template_label"

string="Products Labels"

model="product.template"

report_type="qweb-pdf"

name="product.report_producttemplatelabel"

file="product.report_producttemplatelabel"

print_report_name="'Products Labels - %s' % (object.name)"

/>

Now, we want to use same Template 'product.report_simple_label' for product.product. So, we will create new template for product.product but will call original template.

Create Template for 'product.product'

<template id="report_productlabel">

     <t t-call="web.basic_layout">

     <div class="page">

         <t t-foreach="docs" t-as="product">

             <t t-call="product.report_simple_label">

             <t t-set="product" t-value="product"/>

         </t>

         </t>

     </div>

     </t>

</template>

Create Definiton for 'product.product'

<report

id="report_product_label"

string="Products Labels"

model="product.product"

report_type="qweb-pdf"

name="product.report_productlabel"

file="product.report_productlabel"

print_report_name="'Products Labels - %s' % (object.name)"

/>


Hope it helps,

Regards,

Mayank Gosai

Avatar
Descartar
Related Posts Respostes Vistes Activitat
5
d’ag. 16
5677
1
de jul. 15
7903
0
d’ag. 25
74
0
de febr. 25
1758
1
de gen. 25
11019