-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] product_expiry_ux: create module.
X-original-commit: ecc7acc
- Loading branch information
Showing
6 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
<https://github.com/ingadhoc/product/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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import production_lot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding='UTF-8'?> | ||
<odoo> | ||
<record id="view_move_form_expiry_ux" model="ir.ui.view"> | ||
<field name="name">stock.production.lot.inherit.form.ux</field> | ||
<field name="model">stock.production.lot</field> | ||
<field name="inherit_id" ref="product_expiry.view_move_form_expiry" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//span[hasclass('badge-danger')]" position="replace"> | ||
<span class="badge badge-danger" attrs="{'invisible': [('product_expiry_alert', '=', False)]}">Expired</span> | ||
</xpath> | ||
<xpath expr="//span[hasclass('badge-danger')]" position="after"> | ||
<field name="is_alert_date" invisible="1"/> | ||
<span class="badge badge-warning" attrs="{'invisible': [('is_alert_date', '=', False)]}">Expiration Alert</span> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |