[REF] stock_picking_report_valued_sale_mrp: delivery report

This commit is contained in:
Ernesto Tejeda
2023-04-19 12:16:01 +02:00
parent 3a37bc9f59
commit 6afc571700

View File

@@ -20,63 +20,54 @@
</template>
<template
id="valued_mrp_report_picking"
inherit_id="stock.report_delivery_document"
inherit_id="stock_picking_report_valued.valued_report_picking"
>
<!-- show only one row for kit products -->
<xpath
expr="//tr[@t-foreach='package_move_lines']/t[@t-call='stock.stock_report_delivery_has_serial_move_line']"
position="attributes"
>
<attribute
name="t-if"
>not move_line.phantom_product_id or move_line.phantom_line</attribute>
<xpath expr="//tr[@t-foreach='package_move_lines']" position="before">
<t t-if="can_display_valued_info">
<t
t-set="package_move_lines"
t-value="package_move_lines.filtered(lambda l: not l.phantom_product_id or l.phantom_line)"
/>
</t>
</xpath>
<xpath
expr="//tr[@t-foreach='move_lines']/t[@t-call='stock.stock_report_delivery_has_serial_move_line']"
position="attributes"
>
<attribute
name="t-if"
>not move_line.phantom_product_id or move_line.phantom_line</attribute>
<xpath expr="//tr[@t-foreach='move_lines']" position="before">
<t t-if="can_display_valued_info">
<t
t-set="move_lines"
t-value="move_lines.filtered(lambda l: not l.phantom_product_id or l.phantom_line)"
/>
</t>
</xpath>
<xpath
expr="//tr[@t-foreach='o.move_line_ids']/t[@t-call='stock.stock_report_delivery_has_serial_move_line']"
position="attributes"
>
<attribute
name="t-if"
>not move_line.phantom_product_id or move_line.phantom_line</attribute>
<xpath expr="//tr[@t-foreach='o.move_line_ids']" position="attributes">
<attribute name="t-foreach">has_no_packages_move_lines</attribute>
</xpath>
<xpath expr="//tr[@t-foreach='has_no_packages_move_lines']" position="before">
<t t-set="has_no_packages_move_lines" t-value="o.move_line_ids" />
<t t-if="can_display_valued_info">
<t
t-set="has_no_packages_move_lines"
t-value="has_no_packages_move_lines.filtered(lambda l: not l.phantom_product_id or l.phantom_line)"
/>
</t>
</xpath>
</template>
<template
id="valued_report_picking_has_serial_move_line"
inherit_id="stock_picking_report_valued.valued_report_picking_has_serial_move_line"
>
<!-- Show valued fields for only one of the components of a kit -->
<xpath expr="//td[@name='move_line_lot_qty_done']" position="attributes">
<attribute
name="t-if"
add="not (o.valued or o.sale_id or o.move_line_ids or is_outgoing or (move_line.phantom_line or not move_line.phantom_product_id))"
separator=" "
<xpath expr="//td[1]" position="before">
<t
t-set="can_display_phantom"
t-value="can_display_valued_info and move_line.phantom_line"
/>
</xpath>
<xpath
expr="//span[@t-field=&quot;move_line.sale_price_unit&quot;]/../.."
position="attributes"
>
<attribute name="t-if">
o.valued and o.sale_id and o.move_line_ids and is_outgoing and (move_line.phantom_line or not move_line.phantom_product_id)
</attribute>
</xpath>
<!-- Show the rest of the fields in a special way for the rows corresponding to kits -->
<!-- Show valued fields in a special way for the rows corresponding to kits -->
<xpath expr="//span[@t-field='move_line.product_id']" position="attributes">
<attribute name="t-if">not move_line.phantom_line</attribute>
<attribute name="t-if">not can_display_phantom</attribute>
</xpath>
<xpath expr="//span[@t-field='move_line.product_id']" position="before">
<span
t-field="move_line.sale_line.product_id"
t-if="move_line.phantom_line"
/>
<span t-field="move_line.sale_line.product_id" t-if="can_display_phantom" />
</xpath>
<xpath
expr="//t[@t-value='move_line.move_id.description_picking']"
@@ -84,28 +75,28 @@
>
<attribute
name="t-value"
add="if not move_line.phantom_line else move_line.sale_line.product_id.sudo()._get_description(o.picking_type_id)"
add="if not can_display_phantom else move_line.sale_line.product_id.sudo()._get_description(o.picking_type_id)"
separator=" "
/>
</xpath>
<xpath expr="//td[@name='move_line_lot_qty_done']" position="attributes">
<attribute name="t-if">not move_line.phantom_line</attribute>
<attribute name="t-if">not can_display_phantom</attribute>
</xpath>
<xpath expr="//td[@name='move_line_lot_qty_done']" position="after">
<td class="text-center" t-if="move_line.phantom_line">
<td class="text-center" t-if="can_display_phantom">
<span t-field="move_line.phantom_delivered_qty" />
<span t-field="move_line.sale_line.product_uom" />
</td>
</xpath>
<xpath expr="//span[@t-field='move_line.lot_id.name']" position="attributes">
<attribute name="t-if">not move_line.phantom_line</attribute>
<attribute name="t-if">not can_display_phantom</attribute>
</xpath>
<xpath expr="//span[@t-field='move_line.lot_id.name']" position="after">
<t
t-set="kit_move_lines"
t-value="move_line.sale_line.mapped('move_ids.move_line_ids').filtered(lambda x: x.sale_line == move_line.sale_line)"
/>
<t t-if="kit_move_lines and move_line.phantom_line">
<t t-if="kit_move_lines and can_display_phantom">
<table class="table-borderless">
<t
t-foreach="kit_move_lines.mapped('product_id')"