【问题标题】:How to remove 'product_code' field in sale order report qweb in Odoo-9?如何在 Odoo-9 中删除销售订单报告 qweb 中的“product_code”字段?
【发布时间】:2017-03-27 05:12:12
【问题描述】:

在Odoo系统中,如果您在产品模板中设置product_code(内部引用),该注释也会显示在qweb报告中。我只想在销售订单 qweb 报告中获取产品名称,是否可以删除(或隐藏)product_code 字段报告?如果是,请帮助我确定解决问题的正确步骤。谢谢 我的 qweb 代码:

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

【问题讨论】:

  • 到目前为止你有什么尝试?你能用你的尝试代码更新你的问题吗?
  • 感谢您的回复,流动的代码显示了我的 sale_order_report_documents 中的产品名称:

标签: odoo-9 qweb


【解决方案1】:

sale.order.line 对象name 字段中存储产品名称和代码组合的值。 name 字段值设置在 Product 字段的 onchange 上。

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

替换以下代码:

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

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

【讨论】:

  • 感谢您回复我,l.name 已被删除,但报告未及时发布
  • 再次感谢。我再次登录后,它就像魅力一样。祝兄弟今天愉快。
  • 能否请您再帮我回答 1 个问题,我的报告中还有两个自定义字段,是否可以将所有产品与 qweb 中的相同整数值进行分组,例如:( 1.55+2.50)x3(3 ---> 是整数字段的值,1.55 和 2.50 是其他浮点字段的值)如果可能,我将创建另一个问题主题。
  • 请打开一个新问题,提供详细信息以及您的尝试代码和输出。以便我们了解您的问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多