Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
6742 Vistas

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
Mejor respuesta

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
Publicaciones relacionadas Respuestas Vistas Actividad
5
ago 16
5664
1
jul 15
7863
0
feb 25
1733
1
ene 25
10990
3
dic 24
2031