mirror of
https://github.com/OCA/stock-logistics-reporting.git
synced 2025-02-16 17:13:21 +02:00
@@ -20,7 +20,7 @@ class StockMoveLine(models.Model):
|
||||
sale_tax_id = fields.Many2many(
|
||||
related="sale_line.tax_id", readonly=True, string="Sale Tax"
|
||||
)
|
||||
sale_price_unit = fields.Float(
|
||||
sale_price_unit = fields.Monetary(
|
||||
compute="_compute_sale_order_line_fields",
|
||||
compute_sudo=True,
|
||||
)
|
||||
|
||||
@@ -4,16 +4,15 @@
|
||||
<template id="valued_report_picking" inherit_id="stock.report_delivery_document">
|
||||
<xpath expr="//div[hasclass('page')]" position="before">
|
||||
<t t-set="is_outgoing" t-value="o.picking_type_code == 'outgoing'" />
|
||||
<!-- Allows customization -->
|
||||
<t t-set="is_valued" t-value="o.valued" />
|
||||
<t
|
||||
t-set="can_display_valued_info"
|
||||
t-value="is_outgoing and is_valued and o.sale_id and o.move_line_ids"
|
||||
/>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//table[@t-if="o.move_line_ids and o.state=='done'"]/thead/tr"
|
||||
position="inside"
|
||||
>
|
||||
<t t-if="o.valued and o.sale_id and o.move_line_ids and is_outgoing">
|
||||
<t t-if="o.state != 'done'">
|
||||
<th name="th_qty_reserved" class="text-right"><strong
|
||||
>Qty Reserved</strong></th>
|
||||
</t>
|
||||
<xpath expr="//table[@name='stock_move_line_table']/thead/tr" position="inside">
|
||||
<t t-if="can_display_valued_info">
|
||||
<th name="th_unit_price" class="text-right"><strong
|
||||
>Unit Price</strong></th>
|
||||
<th
|
||||
@@ -30,7 +29,7 @@
|
||||
<xpath expr="//th[@name='th_sml_qty_ordered']" position="attributes">
|
||||
<attribute
|
||||
name="t-if"
|
||||
add="and (not is_outgoing or not (o.valued and o.sale_id and o.move_line_ids))"
|
||||
add="and not can_display_valued_info"
|
||||
separator=" "
|
||||
/>
|
||||
</xpath>
|
||||
@@ -38,37 +37,22 @@
|
||||
expr="//t[@t-foreach='packages']//t[@t-if='has_serial_number']"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute
|
||||
name="t-if"
|
||||
add="or (o.valued and o.sale_id and o.move_line_ids and is_outgoing)"
|
||||
separator=" "
|
||||
/>
|
||||
<attribute name="t-if" add="or can_display_valued_info" separator=" " />
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//t[@name='no_package_move_lines']//t[@t-if='has_serial_number']"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute
|
||||
name="t-if"
|
||||
add="or (o.valued and o.sale_id and o.move_line_ids and is_outgoing)"
|
||||
separator=" "
|
||||
/>
|
||||
<attribute name="t-if" add="or can_display_valued_info" separator=" " />
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//table[@name='stock_move_line_table']/tbody/t[@t-else='']//t[@t-if='has_serial_number']"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute
|
||||
name="t-if"
|
||||
add="or (o.valued and o.sale_id and o.move_line_ids and is_outgoing)"
|
||||
separator=" "
|
||||
/>
|
||||
<attribute name="t-if" add="or can_display_valued_info" separator=" " />
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//table[@t-if="o.move_line_ids and o.state=='done'"]"
|
||||
position="after"
|
||||
>
|
||||
<t t-if="o.valued and o.sale_id and o.move_line_ids and is_outgoing">
|
||||
<xpath expr="//table[@name='stock_move_line_table']" position="after">
|
||||
<t t-if="o.move_line_ids and o.state=='done' and can_display_valued_info">
|
||||
<table class="table table-sm mt32">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -103,17 +87,7 @@
|
||||
inherit_id="stock.stock_report_delivery_has_serial_move_line"
|
||||
>
|
||||
<xpath expr="//td[@name='move_line_lot_qty_done']" position="after">
|
||||
<t t-if="move_line.picking_id.state != 'done'">
|
||||
<td name="td_qty_reserved" class="text-right">
|
||||
<span t-field="move_line.product_uom_qty" />
|
||||
<span t-field="move_line.product_uom_id" /></td>
|
||||
</t>
|
||||
<t t-elif="move_line.picking_id.state == 'done'">
|
||||
<td name="td_qty_done" class="text-center">
|
||||
<span t-field="move_line.qty_done" />
|
||||
<span t-field="move_line.product_uom_id" /></td>
|
||||
</t>
|
||||
<t t-if="o.valued and o.sale_id and o.move_line_ids and is_outgoing">
|
||||
<t t-if="can_display_valued_info">
|
||||
<td name="td_unit_price" class="text-right"><span
|
||||
t-field="move_line.sale_price_unit"
|
||||
/></td>
|
||||
@@ -132,13 +106,6 @@
|
||||
/></td>
|
||||
</t>
|
||||
</xpath>
|
||||
<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)"
|
||||
separator=" "
|
||||
/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -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="move_line.sale_price_unit"]/../.."
|
||||
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')"
|
||||
|
||||
Reference in New Issue
Block a user