Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
6904 Widoki

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.

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
5
sie 16
5771
1
lip 15
8010
0
sie 25
273
0
lut 25
1863
1
sty 25
11097