Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
424 Vistas

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

Avatar
Descartar

Hii EZAX LTD,

Can please share you product table example??

Mejor respuesta

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

Avatar
Descartar