Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
6890 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
5
srp 16
5738
1
čvc 15
7988
0
srp 25
229
0
úno 25
1847
1
led 25
11067