Skip to content

Commit

Permalink
[MIG][16.0] product_expiry_configurable
Browse files Browse the repository at this point in the history
- Rely mostly on Odoo core behaviour (expiration_date/use_expiration_date)
- Odoo computes correctly the expiration date from now() on stock lots
- Improve tests with a common
  • Loading branch information
rousseldenis committed Apr 7, 2023
1 parent f93d484 commit e70d132
Show file tree
Hide file tree
Showing 19 changed files with 310 additions and 644 deletions.
11 changes: 6 additions & 5 deletions product_expiry_configurable/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Product Expiry Configurable
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github
:target: https://github.com/OCA/product-attribute/tree/14.0/product_expiry_configurable
:target: https://github.com/OCA/product-attribute/tree/16.0/product_expiry_configurable
:alt: OCA/product-attribute
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/product-attribute-14-0/product-attribute-14-0-product_expiry_configurable
:target: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_expiry_configurable
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/135/14.0
:target: https://runbot.odoo-community.org/runbot/135/16.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -43,7 +43,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-attribute/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 <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_expiry_configurable%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_expiry_configurable%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand All @@ -56,6 +56,7 @@ Contributors
* `CreuBlanca <https://www.creublanca.es>`_:

* Alba Riera <[email protected]>
* Denis Roussel <[email protected]>

Maintainers
~~~~~~~~~~~
Expand All @@ -70,6 +71,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/14.0/product_expiry_configurable>`_ project on GitHub.
This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/16.0/product_expiry_configurable>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
6 changes: 2 additions & 4 deletions product_expiry_configurable/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
"summary": """
This model allows setting expiry times on category and
to use the 'end_of_life' date for the computation of lot dates""",
"version": "14.0.1.0.0",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/product-attribute",
"depends": ["product_expiry"],
"data": [
"data/product_expiry_data.xml",
"views/product_category.xml",
"views/product_template.xml",
"views/stock_production_lot.xml",
"views/stock_lot.xml",
],
"demo": [],
}
127 changes: 55 additions & 72 deletions product_expiry_configurable/data/product_expiry_data.xml
Original file line number Diff line number Diff line change
@@ -1,79 +1,62 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data noupdate="1">
<odoo noupdate="1">

<record id="mail_activity_type_expiry_date_reached" model="mail.activity.type">
<field name="name">Expiry Date Reached</field>
<field name="category">default</field>
<field name="res_model_id" ref="stock.model_stock_production_lot" />
<field name="icon">fa-tasks</field>
<field name="delay_count">0</field>
</record>
<record id="mail_activity_type_expiry_date_reached" model="mail.activity.type">
<field name="name">Expiry Date Reached</field>
<field name="category">default</field>
<field name="res_model">stock.lot</field>
<field name="icon">fa-tasks</field>
<field name="delay_count">0</field>
</record>

<record
model="ir.cron"
forcecreate="True"
id="ir_cron_product_expiry_removal_date"
>
<field name="name">Product Removal Date Reached</field>
<field name="active" eval="0" />
<field name="user_id" ref="base.user_root" />
<field name="model_id" ref="stock.model_stock_production_lot" />
<field name="state">code</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="0" />
<field
name="code"
>model._expiry_date_exceeded(date_field='removal_date')</field>
<field
name="nextcall"
eval="(DateTime.now()).strftime('%Y-%m-%d 22:00:00')"
/>
</record>
<record model="ir.cron" forcecreate="True" id="ir_cron_product_expiry_removal_date">
<field name="name">Product Removal Date Reached</field>
<field name="active" eval="0" />
<field name="user_id" ref="base.user_root" />
<field name="model_id" ref="stock.model_stock_lot" />
<field name="state">code</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="0" />
<field
name="code"
>model._expiry_date_exceeded(date_field='removal_date')</field>
<field name="nextcall" eval="(DateTime.now()).strftime('%Y-%m-%d 22:00:00')" />
</record>

<record model="ir.cron" forcecreate="True" id="ir_cron_product_expiry_use_date">
<field name="name">Product Use Date Reached</field>
<field name="active" eval="0" />
<field name="user_id" ref="base.user_root" />
<field name="model_id" ref="stock.model_stock_production_lot" />
<field name="state">code</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="0" />
<field
name="code"
>model._expiry_date_exceeded(date_field='use_date')</field>
<field
name="nextcall"
eval="(DateTime.now()).strftime('%Y-%m-%d 22:00:00')"
/>
</record>
<record model="ir.cron" forcecreate="True" id="ir_cron_product_expiry_use_date">
<field name="name">Product Use Date Reached</field>
<field name="active" eval="0" />
<field name="user_id" ref="base.user_root" />
<field name="model_id" ref="stock.model_stock_lot" />
<field name="state">code</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="0" />
<field name="code">model._expiry_date_exceeded(date_field='use_date')</field>
<field name="nextcall" eval="(DateTime.now()).strftime('%Y-%m-%d 22:00:00')" />
</record>

<record
model="ir.cron"
forcecreate="True"
id="ir_cron_product_expiry_expiration_date"
>
<field name="name">Product Expiration Date Reached</field>
<field name="active" eval="0" />
<field name="user_id" ref="base.user_root" />
<field name="model_id" ref="stock.model_stock_production_lot" />
<field name="state">code</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="0" />
<field
name="code"
>model._expiry_date_exceeded(date_field='expiration_date')</field>
<field
name="nextcall"
eval="(DateTime.now()).strftime('%Y-%m-%d 22:00:00')"
/>
</record>
<record
model="ir.cron"
forcecreate="True"
id="ir_cron_product_expiry_expiration_date"
>
<field name="name">Product Expiration Date Reached</field>
<field name="active" eval="0" />
<field name="user_id" ref="base.user_root" />
<field name="model_id" ref="stock.model_stock_lot" />
<field name="state">code</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="0" />
<field
name="code"
>model._expiry_date_exceeded(date_field='expiration_date')</field>
<field name="nextcall" eval="(DateTime.now()).strftime('%Y-%m-%d 22:00:00')" />
</record>

</data>
</odoo>

This file was deleted.

This file was deleted.

44 changes: 0 additions & 44 deletions product_expiry_configurable/migrations/14.0.1.0.0/pre-migration.py

This file was deleted.

2 changes: 1 addition & 1 deletion product_expiry_configurable/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from . import stock_production_lot
from . import stock_lot
from . import product_template
from . import product_category
Loading

0 comments on commit e70d132

Please sign in to comment.