如何在报表销售订单中打印产品变体 [英] how to print the product variants in report sale order

查看:94
本文介绍了如何在报表销售订单中打印产品变体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打印变体产品作为报告销售订单中产品的描述.为此,我添加了一个新标签 th description ,并且我使用了 span t-esc =','.join([x.attribute_id for x in o.order_line.product_id.product_tmpl_id.attribute_line_ids])"/,但在评估时显示错误 QWebException:序列项0:预期的字符串,找到了product.attribute" ','.join([[doc.order_line.product_id.product_tmpl_id.attribute_line_ids中x的x.attribute_id])" .有什么帮助吗?

I want to print the variants product as a description of the product in report sale order. For that i have added a new tag th description and i have used span t-esc="', '.join([x.attribute_id for x in o.order_line.product_id.product_tmpl_id.attribute_line_ids])"/ but it shows error QWebException: "sequence item 0: expected string, product.attribute found" while evaluating "', '.join([x.attribute_id for x in doc.order_line.product_id.product_tmpl_id.attribute_line_ids])" .Any help please ?

                <t t-foreach="doc.order_line" t-as="l">
                    <tr t-if="l.product_uom_qty">
                        <td>
                            <span t-field="l.product_id.name"/>
                        </td>
                        <td>
                            <span><t t-esc="', '.join([x.attribute for x in doc.order_line.product_id.product_tmpl_id.seller_ids])"/> </span>
                        </td>
                        <td>
                            <span t-field="l.product_id.default_code"/>
                        </td>

                        <td>
                            <span><t t-esc="', '.join([x.product_code for x in doc.order_line.product_id.product_tmpl_id.attribute_line_ids])"/> </span>
                        </td>

                        <td class="text-right">
                            <span t-field="l.product_uom_qty"/>
                            <span groups="product.group_uom" t-field="l.product_uom"/>
                        </td>
                        <td class="text-right">
                            <span t-field="l.price_unit"/>
                        </td>

                        <td class="text-right">
                            <span t-esc="', '.join(map(lambda x: (x.description or x.name), l.tax_id))"/>
                        </td>
                    </tr>
                </t>
            </tbody>

推荐答案

我找到了解决方案并且有效

i find the solution and it works

  <td>

     <t t-foreach="l.product_id.attribute_line_ids" t-as="variant">
         -<span t-field="variant.attribute_id"/>:
              <span t-field="variant.value_ids.name"/>
                   </t>
  </td>

这篇关于如何在报表销售订单中打印产品变体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆