如何在报表销售订单中打印产品变体

时间:2018-06-01 11:58:46

标签: python-2.7 odoo-9

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

                <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>

1 个答案:

答案 0 :(得分:0)

我找到解决方案并且有效

  <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>
相关问题