From 483d66f93582f7b108f613c8d6e6e3768676b180 Mon Sep 17 00:00:00 2001 From: jordan <jordan@le-filament.com> Date: Thu, 1 Jul 2021 11:11:58 +0200 Subject: [PATCH] [add] DLC, DDM and alert_date related fields from lot_id in stock_quant --- README.rst | 1 + __manifest__.py | 1 + models/__init__.py | 1 + models/stock_quant.py | 21 +++++++++++++++++++++ views/stock_quant.xml | 22 ++++++++++++++++++++++ 5 files changed, 46 insertions(+) create mode 100644 models/stock_quant.py create mode 100644 views/stock_quant.xml diff --git a/README.rst b/README.rst index 3ff5851..de9f1aa 100755 --- a/README.rst +++ b/README.rst @@ -12,6 +12,7 @@ Fumaison Occ - Vente - Ajout de la note de facturation et de la DLC des lots dans les factures pdf - Ajout de la DLC dans la vue détaillée des opérations sur le bon de livraison - Calcul la DLC des lots en fonction du numéro de lot +- Ajout de la DLC, DDM et date d'alerte dans *stock_quant* Description =========== diff --git a/__manifest__.py b/__manifest__.py index e01de0f..116efd8 100755 --- a/__manifest__.py +++ b/__manifest__.py @@ -19,6 +19,7 @@ 'views/sale_order.xml', 'views/stock_move_line.xml', 'views/stock_picking.xml', + 'views/stock_quant.xml', # reports 'report/report_deliveryslip.xml', 'report/report_invoice.xml', diff --git a/models/__init__.py b/models/__init__.py index 1b456f6..63655f2 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -8,3 +8,4 @@ from . import res_config_settings from . import sale_order from . import stock_picking from . import stock_production_lot +from . import stock_quant diff --git a/models/stock_quant.py b/models/stock_quant.py new file mode 100644 index 0000000..51f5b54 --- /dev/null +++ b/models/stock_quant.py @@ -0,0 +1,21 @@ +# Copyright 2021 Le Filament (<http://www.le-filament.com>) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class FumocStockQuant(models.Model): + _inherit = 'stock.quant' + + # ------------------------------------------------------ + # Fields declaration + # ------------------------------------------------------ + expiration_date = fields.Datetime( + string="DLC", + related='lot_id.expiration_date', store=True) + use_date = fields.Datetime( + string="DDM", + related='lot_id.use_date', store=True) + alert_date = fields.Datetime( + string="Alerte", + related='lot_id.alert_date', store=True) diff --git a/views/stock_quant.xml b/views/stock_quant.xml new file mode 100644 index 0000000..cd12c96 --- /dev/null +++ b/views/stock_quant.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2021 Le Filament + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> +<odoo> + <data> + + <record id="fumoc_stock_quant_tree_inherit" model="ir.ui.view"> + <field name="name">fumoc_sale.stock.quant.tree</field> + <field name="model">stock.quant</field> + <field name="inherit_id" ref="product_expiry.view_stock_quant_tree_expiry"/> + <field name="priority" eval="8"/> + <field name="arch" type="xml"> + <xpath expr="//field[@name='removal_date']" position="before"> + <field name="use_date" optional="hide"/> + <field name="expiration_date" optional="show"/> + <field name="alert_date" optional="hide"/> + </xpath> + </field> + </record> + + </data> +</odoo> -- GitLab