From 6b15d6040c993d50347a297d8d99efef45eb8b9c Mon Sep 17 00:00:00 2001 From: Virginia Bonservizi Date: Fri, 18 Nov 2022 16:44:51 +0000 Subject: [PATCH] [ADD] product_expiry_ux: create module. closes ingadhoc/product#504 X-original-commit: ecc7acc9aa002b50fb81b0dff319e98a357bf664 Signed-off-by: augusto-weiss Signed-off-by: Virginia Bonservizi --- product_expiry_ux/README.rst | 73 +++++++++++++++++++ product_expiry_ux/__init__.py | 1 + product_expiry_ux/__manifest__.py | 14 ++++ product_expiry_ux/models/__init__.py | 1 + product_expiry_ux/models/production_lot.py | 16 ++++ .../views/production_lot_views.xml | 17 +++++ 6 files changed, 122 insertions(+) create mode 100644 product_expiry_ux/README.rst create mode 100644 product_expiry_ux/__init__.py create mode 100644 product_expiry_ux/__manifest__.py create mode 100644 product_expiry_ux/models/__init__.py create mode 100644 product_expiry_ux/models/production_lot.py create mode 100644 product_expiry_ux/views/production_lot_views.xml diff --git a/product_expiry_ux/README.rst b/product_expiry_ux/README.rst new file mode 100644 index 000000000..c280e43f1 --- /dev/null +++ b/product_expiry_ux/README.rst @@ -0,0 +1,73 @@ +.. |company| replace:: ADHOC SA + +.. |company_logo| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-logo.png + :alt: ADHOC SA + :target: https://www.adhoc.com.ar + +.. |icon| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-icon.png + +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +================= +Product Expiry Ux +================= + +Change lots expiration tags. + +#. "Expired" according to expiration date + +#. "Expiration Alert" according to alert date + +Installation +============ + +To install this module, you need to: + +#. Just install module. + +Configuration +============= + +To configure this module, you need to: + +#. No configuration needed. + +Usage +===== + +To use this module, you need to: + + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: http://runbot.adhoc.com.ar/ + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed feedback. + +Credits +======= + +Images +------ + +* |company| |icon| + +Contributors +------------ + +Maintainer +---------- + +|company_logo| + +This module is maintained by the |company|. + +To contribute to this module, please visit https://www.adhoc.com.ar. diff --git a/product_expiry_ux/__init__.py b/product_expiry_ux/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/product_expiry_ux/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_expiry_ux/__manifest__.py b/product_expiry_ux/__manifest__.py new file mode 100644 index 000000000..2d3b0ab0e --- /dev/null +++ b/product_expiry_ux/__manifest__.py @@ -0,0 +1,14 @@ +{ + 'name': 'Products Expiration Date UX', + 'version': '15.0.1.0.0', + 'category': 'Inventory/Inventory', + 'author': 'ADHOC SA', + 'website': 'www.adhoc.com.ar', + 'depends': ['product_expiry'], + 'data': ['views/production_lot_views.xml'], + 'demo': [], + 'license': 'AGPL-3', + 'installable': False, + 'auto_install': True, + 'application': False, +} diff --git a/product_expiry_ux/models/__init__.py b/product_expiry_ux/models/__init__.py new file mode 100644 index 000000000..ea60a3392 --- /dev/null +++ b/product_expiry_ux/models/__init__.py @@ -0,0 +1 @@ +from . import production_lot diff --git a/product_expiry_ux/models/production_lot.py b/product_expiry_ux/models/production_lot.py new file mode 100644 index 000000000..d2be2f979 --- /dev/null +++ b/product_expiry_ux/models/production_lot.py @@ -0,0 +1,16 @@ +from odoo import api, fields, models +from odoo.tools import float_compare + +class StockProductionLot(models.Model): + _inherit = 'stock.production.lot' + + is_alert_date = fields.Boolean(compute='_compute_is_alert_date', help="The Alert Date has been reached") + + @api.depends('alert_date') + def _compute_is_alert_date(self): + current_date = fields.Datetime.now() + for lot in self: + if lot.alert_date: + lot.is_alert_date = (lot.alert_date <= current_date) + else: + lot.is_alert_date = False diff --git a/product_expiry_ux/views/production_lot_views.xml b/product_expiry_ux/views/production_lot_views.xml new file mode 100644 index 000000000..e960e8c2e --- /dev/null +++ b/product_expiry_ux/views/production_lot_views.xml @@ -0,0 +1,17 @@ + + + + stock.production.lot.inherit.form.ux + stock.production.lot + + + + Expired + + + + Expiration Alert + + + +