This commit makes it so if a delivery slip contains 1 or more packages then move lines will be split by package (and non-package) groups with a "section line" between them. This only applies to when a stock.picking is 'State=Done'. In order to accomodate complexity of splitting by package + grouping by product unless printing serial numbers/lots + template inheritance, reoccurring parts of the template are split into their own templates and called. Relevant inheritance has been updated to match. Additionally, picking.shipping_weight calculation has been updated so if a pack.weight = 0 then calculation will default to the calculated product weight. This prevents inconsistency between the "Total Weight" at the top of the Delivery Slip and the package sections' displayed weights. To distinguish which value is being used, package sections that use the total product weight rather than the pack.weight have "(estimated)" after it. This completes subsection 3 of overall Improve delivery slip task. Task: 2039720
73 lines
3.5 KiB
XML
73 lines
3.5 KiB
XML
<odoo>
|
|
<template id="report_delivery_document2" inherit_id="stock.report_delivery_document">
|
|
<xpath expr="//div[@name='div_sched_date']" position="after">
|
|
<div t-if="o.picking_type_id.code == 'outgoing' and o.carrier_id" class="col-auto">
|
|
<strong>Carrier:</strong>
|
|
<p t-field="o.carrier_id"/>
|
|
</div>
|
|
<div t-if="o.shipping_weight" class="col-auto">
|
|
<strong>Total Weight:</strong>
|
|
<br/>
|
|
<span t-field="o.shipping_weight"/>
|
|
<span t-field="o.weight_uom_name"/>
|
|
</div>
|
|
<div t-if="o.carrier_tracking_ref" class="col-auto">
|
|
<strong>Tracking Number:</strong>
|
|
<p t-field="o.carrier_tracking_ref"/>
|
|
</div>
|
|
<t t-set="has_hs_code" t-value="o.move_lines.filtered(lambda l: l.product_id.hs_code)"/>
|
|
</xpath>
|
|
|
|
<xpath expr="//table[@name='stock_move_table']/thead/tr" position="inside">
|
|
<th t-if="has_hs_code"><strong>HS Code</strong></th>
|
|
</xpath>
|
|
|
|
<xpath expr="//table[@name='stock_move_line_table']/thead/tr" position="inside">
|
|
<th t-if="has_hs_code"><strong>HS Code</strong></th>
|
|
</xpath>
|
|
</template>
|
|
|
|
<!-- HS Code to table rows-->
|
|
<template id="stock_report_delivery_has_serial_move_line_inherit_delivery" inherit_id="stock.stock_report_delivery_has_serial_move_line">
|
|
<xpath expr="//td[@name='move_line_lot_qty_done']" position="after">
|
|
<td t-if="has_hs_code"><span t-field="move_line.product_id.hs_code"/></td>
|
|
</xpath>
|
|
</template>
|
|
<template id="stock_report_delivery_aggregated_move_lines_inherit_delivery" inherit_id="stock.stock_report_delivery_aggregated_move_lines">
|
|
<xpath expr="//td[@name='move_line_aggregated_qty_done']" position="after">
|
|
<td t-if="has_hs_code"><span t-esc="aggregated_lines[line]['hs_code']"/></td>
|
|
</xpath>
|
|
</template>
|
|
|
|
<!-- package related "section lines" -->
|
|
<template id="stock_report_delivery_package_section_line_inherit_delivery" inherit_id="stock.stock_report_delivery_package_section_line">
|
|
<!-- Add additional Package section line info -->
|
|
<xpath expr="//td[@name='package_info']" position="inside">
|
|
<t t-if="package.shipping_weight or package.weight">
|
|
<!-- assume manually typed in value = priority -->
|
|
<t t-if="package.shipping_weight">
|
|
<span> - Weight: </span>
|
|
<span t-field="package.shipping_weight"/>
|
|
<span t-field="package.weight_uom_name"/>
|
|
</t>
|
|
<!-- otherwise default to calculated value -->
|
|
<t t-else="">
|
|
<span> - Weight (estimated): </span>
|
|
<span t-field="package.weight"/>
|
|
<span t-field="package.weight_uom_name"/>
|
|
</t>
|
|
</t>
|
|
</xpath>
|
|
</template>
|
|
<template id="delivery_stock_report_delivery_no_package_section_line" inherit_id="stock.stock_report_delivery_no_package_section_line">
|
|
<!-- Add additional No Package section line info -->
|
|
<xpath expr="//td[@name='no_package_info']" position="inside">
|
|
<t t-if="o.weight_bulk">
|
|
<span> - Weight: </span>
|
|
<span t-field="o.weight_bulk"/>
|
|
<span t-field="o.weight_uom_name"/>
|
|
</t>
|
|
</xpath>
|
|
</template>
|
|
</odoo>
|