feat: Add custom delivery slip report with additional fields
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?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>
|
||||
</td>
|
||||
</xpath>
|
||||
|
||||
</template>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user