feat: Update delivery slip report to include Production and Expiration dates
This commit is contained in:
@@ -1,59 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- Inherit the delivery slip report template -->
|
||||
<template id="report_deliveryslip_document_custom" inherit_id="stock.report_deliveryslip_document">
|
||||
|
||||
<!-- Add custom columns to the table header -->
|
||||
<xpath expr="//table[@name='stock_move_table']/thead/tr/th[@name='th_product']" position="after">
|
||||
<th><strong>Lot/Serial Number</strong></th>
|
||||
<th><strong>Production Date</strong></th>
|
||||
<th><strong>Expiration Date</strong></th>
|
||||
</xpath>
|
||||
|
||||
<!-- Add custom data columns to the table body -->
|
||||
<xpath expr="//table[@name='stock_move_table']/tbody//td[@name='td_product']" position="after">
|
||||
<!-- Lot/Serial Number Column -->
|
||||
<td>
|
||||
<span t-foreach="move.lot_ids" t-as="lot">
|
||||
<t t-esc="lot.name"/><br/>
|
||||
</span>
|
||||
<span t-if="not move.lot_ids and move.move_line_ids">
|
||||
<t t-foreach="move.move_line_ids" t-as="move_line">
|
||||
<t t-if="move_line.lot_id">
|
||||
<t t-esc="move_line.lot_id.name"/><br/>
|
||||
</t>
|
||||
</t>
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<!-- Production Date Column (Today's Date) -->
|
||||
<td>
|
||||
<span t-foreach="move.lot_ids" t-as="lot">
|
||||
<t t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d')"/><br/>
|
||||
</span>
|
||||
<span t-if="not move.lot_ids and move.move_line_ids">
|
||||
<t t-foreach="move.move_line_ids" t-as="move_line">
|
||||
<t t-if="move_line.lot_id">
|
||||
<t t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d')"/><br/>
|
||||
</t>
|
||||
</t>
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<!-- Expiration Date Column (6 months from now) -->
|
||||
<td>
|
||||
<span t-foreach="move.lot_ids" t-as="lot">
|
||||
<t t-esc="(context_timestamp(datetime.datetime.now()) + datetime.timedelta(days=180)).strftime('%Y-%m-%d')"/><br/>
|
||||
</span>
|
||||
<span t-if="not move.lot_ids and move.move_line_ids">
|
||||
<t t-foreach="move.move_line_ids" t-as="move_line">
|
||||
<t t-if="move_line.lot_id">
|
||||
<t t-esc="(context_timestamp(datetime.datetime.now()) + datetime.timedelta(days=180)).strftime('%Y-%m-%d')"/><br/>
|
||||
</t>
|
||||
</t>
|
||||
</span>
|
||||
<!-- Inherit the delivery slip report template for completed deliveries (state='done') -->
|
||||
<template id="stock_report_delivery_has_serial_move_line_custom" inherit_id="stock.stock_report_delivery_has_serial_move_line">
|
||||
<!-- Add Production Date after lot number -->
|
||||
<xpath expr="//td[@name='move_line_lot']" position="after">
|
||||
<td class="text-end">
|
||||
<span t-esc="datetime.datetime.now().strftime('%Y-%m-%d')"/>
|
||||
</td>
|
||||
</xpath>
|
||||
|
||||
<!-- Add Expiration Date after Production Date -->
|
||||
<xpath expr="//td[@name='move_line_lot_quantity']" position="before">
|
||||
<td class="text-end">
|
||||
<span t-esc="(datetime.datetime.now() + datetime.timedelta(days=180)).strftime('%Y-%m-%d')"/>
|
||||
</td>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<!-- Add column headers for Production and Expiration dates in the main table -->
|
||||
<template id="report_delivery_document_custom" inherit_id="stock.report_delivery_document">
|
||||
<!-- Add headers for completed deliveries table -->
|
||||
<xpath expr="//table[@name='stock_move_line_table']/thead/tr/th[@name='lot_serial']" position="after">
|
||||
<th name="th_production_date" class="text-end">Production Date</th>
|
||||
<th name="th_expiration_date" class="text-end">Expiration Date</th>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user