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

If anyone could help me would highly appreciate. 

What I am trying to do is to be able to see in the description The name of the product, and not only the values names but also the attribute names. For example:

Chair Ezax

Wood Finish: Walnut

Upholstery: Davis

Chair Ezax = product name 

Wood finish = attribute name

Walnut = Value

形象
丢弃

Hii EZAX LTD,

Can please share you product table example??

最佳答案

Hi,

To include both the attribute names and their values in the product description, along with the product name in the PDF report, use the following code:

<template id="report_saleorder_document_inherited" inherit_id="sale.report_saleorder_document">
<xpath expr="//table[hasclass('o_main_table')]/tbody[@class='sale_tbody']//t[@t-if='not line.display_type']/td[@name='td_name']"
               position="replace">
            <td name="td_name">
<span t-field="line.name"/>
<t t-if="line.product_id.attribute_line_ids">
                    <br/>
<t t-foreach="line.product_id.attribute_line_ids" t-as="attr_line">
<span t-field="attr_line.attribute_id.name"/>:
<t t-set="values" t-value="attr_line.value_ids.mapped('name')"/>
                        <span t-esc="', '.join(values)"/>
                        <br/>
                    </t>
                </t>
            </td>
        </xpath>
    </template>


Hope it helps

形象
丢弃