2 Commits

3 changed files with 49 additions and 0 deletions

View File

@@ -0,0 +1 @@
# -*- coding: utf-8 -*-

View File

@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
{
'name': 'Custom Delivery Slip',
'version': '19.0.1.0.0',
'category': 'Inventory',
'summary': 'Customize delivery slip with lot number, production date, expiration date',
'description': """
Adds the following fields to delivery slips:
- Lot/Serial number
- Production date (today's date)
- Expiration date (6 months from production)
- Product name
""",
'depends': ['stock'],
'data': [
'views/report_deliveryslip.xml',
],
'installable': True,
'application': False,
'auto_install': False,
}

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- 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>