2016-11-13 76 views
1

在Odoo系统中,如果您在产品模板中设置了product_code(interal reference),则该注释也会显示在qweb报告中。我想在销售订单qweb报告中只获取产品名称,是否可以删除(或隐藏)product_code字段报告?如果是这样,请帮我指出解决问题的正确步骤。谢谢 我qweb代码:如何删除Odoo-9销售订单报告qweb中的'product_code'字段?

    </tr> 
        <t t-set="index" t-value="0"/> 
        <t t-set="product" t-value="0"/> 
        <t t-foreach="doc.handle_orderline(doc.order_line)" t-as="product_line"> 
         <t t-set="product_num" t-value="0"/> 
         <t t-set="index" t-value="index + 1"/> 
         <t t-foreach="product_line" t-as="l"> 
          <t t-set="product_num" t-value="product_num+1"/> 
          <t t-if="not l.product_uom_qty"> 
           <t t-set="index" t-value="index - 1"/> 
          </t> 
          <tr t-if="l.product_uom_qty"> 
           <t t-if="product_num == 1"> 
            <td class="text-center" t-att-rowspan="len(product_line)"> 
             <span t-esc="index"/> 
            </td> 
            <td class="text-center" t-att-rowspan="len(product_line)"> 
             <strong><span t-field="l.name"/></strong> 
             <br/> 
             <t t-if="l.width_id">(<span style="font-style:italic" t-field="l.width_id.name"/>)</t> 
            </td> 
           </t> 
+0

你尝试过这么远吗?你能用你的尝试代码更新你的问题吗? –

+0

谢谢答复我,流动的代码显示我的sale_order_report_documents中的产品名称: –

回答

1

sale.order.line对象名称产品名称和代码的组合场储值。 名称字段值设置为onchange of 产品字段。

所以在QWEB报告中,我们需要从product_id字段获取值以显示产品名称。

替换下面的代码:

<strong><span t-field="l.name"/></strong> 

<strong><span t-field="l.product_id.name"/></strong> 
+0

感谢回复我,l.name已被删除,但报告没有被精确地发布出 –

+0

再次感谢。它在我再次登录后就像魅力一样。祝你有个愉快的一天。 –

+0

可否请你帮我回答1个问题,在我的报告中还有两个自定义字段,是否有可能将所有产品与qweb中提供的相同整数值归档如下:(1.55 + 2.50)x3(3 --->是整数字段的值,1.55和2.50是其他浮点字段的值)如果可能,我将创建另一个问题主题。 –