跳至内容
菜单
此问题已终结
1 回复
6922 查看

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.

形象
丢弃
最佳答案

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

形象
丢弃
相关帖文 回复 查看 活动
5
8月 16
5810
1
7月 15
8046
0
8月 25
296
0
2月 25
1881
1
1月 25
11118