(odoo10) how to add product attributes in pdf invoice

我只是一个虾纸丫 提交于 2019-12-11 15:49:08

问题


pls advice how to add product attributes into pdf invoice. Currently we printing product SCU:

                    <tr t-foreach="o.invoice_line_ids" t-as="l">
                    <td><span t-field="l.product_id.default_code"/></td>
                    <td class="hidden"><span t-field="l.origin"/></td>
                    <td class="text-right">

and it looks a bit ugly on invoice. pls advice how to add product template like l.product_id.name + attributes, like:

also, could you pls advice how to put attributes below product name? here is my code now:

        <tbody class="invoice_tbody">
            <tr t-foreach="o.invoice_line_ids" t-as="l">
                <td><span t-field="l.product_id.name"/></td>
                <t t-esc="', '.join(['%s: %s' % (attribute_value.attribute_id.name, attribute_value.name) for attribute_value in l.product_id.attribute_value_ids])"/>
                <td class="hidden"><span t-field="l.origin"/></td>

i'd like to have it like that: many thanks in advance!


回答1:


You will need to do something like this to output the product attributes name and value:

<t t-esc="', '.join(['%s: %s' % (attribute_value.attribute_id.name, attribute_value.name) for attribute_value in l.product_id.attribute_value_ids])"/>:


来源:https://stackoverflow.com/questions/52839299/odoo10-how-to-add-product-attributes-in-pdf-invoice

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!