tuấn anh phạm
tuấn anh phạm

Reputation: 81

How to remove 'product_code' field in sale order report qweb in Odoo-9?

In Odoo system, If you set the product_code (interal reference) in product template, the note also be showed on the qweb report. I would like to get only the product's name in sale order qweb report, Is it possible to remove(or hide) the product_code field report? If it is, please help me to specific the right steps to solve it. Thank you my qweb code :

                    </tr>
                    <t t-set="index" t-value="0"/>
                    <t t-set="product" t-value="0"/>
                    <t t-foreach="doc.handle_orderline(doc.order_line)" t-as="product_line">
                        <t t-set="product_num" t-value="0"/>
                        <t t-set="index" t-value="index + 1"/>
                        <t t-foreach="product_line" t-as="l">
                            <t t-set="product_num" t-value="product_num+1"/>
                            <t t-if="not l.product_uom_qty">
                                <t t-set="index" t-value="index - 1"/>
                            </t>
                            <tr t-if="l.product_uom_qty">
                                <t t-if="product_num == 1">
                                    <td class="text-center" t-att-rowspan="len(product_line)">
                                        <span t-esc="index"/>
                                    </td>
                                    <td class="text-center" t-att-rowspan="len(product_line)">
                                        <strong><span t-field="l.name"/></strong>
                                        <br/>
                                        <t t-if="l.width_id">( <span style="font-style:italic" t-field="l.width_id.name"/> )</t>
                                    </td>
                                </t>

Upvotes: 1

Views: 1585

Answers (1)

Bhavesh Odedra
Bhavesh Odedra

Reputation: 11143

In sale.order.line object name field store value in combination of product name and code. name field value set on onchange of Product field.

So in QWEB report, we need to get value from product_id field to display product name.

Replace following code:

<strong><span t-field="l.name"/></strong>

with

<strong><span t-field="l.product_id.name"/></strong>

Upvotes: 1

Related Questions