基于odoo的拣配类型在继承的交货/收货qweb报告上打印产品说明

问题描述 投票:1回答:1

首先,对语法错误感到抱歉。您能帮我有关继承报告的问题吗?我在product.product中将交货说明和收货说明分开。我继承了stock.report_picking我要在其中打印基于picking_type_id的产品交付/收货说明。它工作正常。但它会为报告中的所有产品打印相同的描述。这是我的摘录。

<template id="report_picking_inherit" inherit_id="stock.report_picking">

    <xpath expr="//table[@class='table table-sm']//tbody//tr//td//span[2]" position="replace">

        <t t-foreach="o.move_ids_without_package.sorted(key=lambda m: m.product_id.id)" t-as="move">
            <t t-foreach="move.move_line_ids.sorted(key=lambda ml: ml.location_id.id)" t-as="ml">

                <t t-if="docs.picking_type_id.name == 'Receipts'">
                    <span t-field="move.product_id.description_for_receipt"/>
                </t>
                <t t-if="docs.picking_type_id.name == 'Delivery Orders'">
                    <span t-field="move.product_id.description_for_delivery"/>
                </t>

            </t>
        </t>

    </xpath>
</template>

并生成此结果。

[[E-COM12]会议主席(钢)LEGS:钢,交货说明LEGS:ALUMINIUM,交货说明

[[E-COM13]会议主席(铝)LEGS:钢,交货说明LEGS:ALUMINIUM,交货说明

i有两条记录,并且为产品和相同的描述打印两次。对于会议主席(钢制),应打印钢制说明,然后会议椅(铝),应打印铝的说明

python-3.x odoo odoo-12 qweb
1个回答
0
投票

尝试此代码

<xpath expr="//table[@class='table table-sm']//tbody//tr//td//span[2]" position="replace">
  <t t-if="docs.picking_type_id.name == 'Receipts'">
        <span t-field="ml.product_id.description_for_receipt"/>
  </t>
  <t t-if="docs.picking_type_id.name == 'Delivery Orders'">
        <span t-field="ml.product_id.description_for_delivery"/>
  </t>
</xpath>

© www.soinside.com 2019 - 2024. All rights reserved.