how to print the product variants in report sale order

十年热恋 提交于 2019-12-24 22:55:09

问题


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>

回答1:


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>


来源:https://stackoverflow.com/questions/50642932/how-to-print-the-product-variants-in-report-sale-order

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