-
-
Notifications
You must be signed in to change notification settings - Fork 722
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by dreispt
- Loading branch information
Showing
18 changed files
with
1,084 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,95 @@ | ||
================================= | ||
Stock production lot expired date | ||
================================= | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:49b6c3c903b80b6392d8329b053dbe35b67a3af804270014d7a5213d8eb0ab56 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
: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/17.0/stock_production_lot_expired_date | ||
: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-17-0/product-attribute-17-0-stock_production_lot_expired_date | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&target_branch=17.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows to facilitate the input of stock production lot | ||
expired dates: | ||
|
||
- Add settings on stock to choose the base date for stock production | ||
lot | ||
- Add onchanges on stock production lot to compute expired dates from | ||
base date | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
| # Go to *Settings > Inventory > Traceability* | ||
| There you can set the base date under *Base date to compute expiration | ||
dates* | ||
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 to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/product-attribute/issues/new?body=module:%20stock_production_lot_expired_date%0Aversion:%2017.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. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
------- | ||
|
||
* Camptocamp | ||
* ACSONE SA/NV | ||
|
||
Contributors | ||
------------ | ||
|
||
- Julien Coux <julien.coux@camptocamp.com> | ||
- Hughes Damry <hughes.damry@acsone.eu> | ||
|
||
- ``Binhex Systems Solutions <https://binhex.cloud/>``\ \_: | ||
|
||
- Deriman Alonso d.alonso@binhex.cloud | ||
|
||
Maintainers | ||
----------- | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
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/17.0/stock_production_lot_expired_date>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
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,15 @@ | ||
# Copyright 2016 Julien Coux (Camptocamp) | ||
# Copyright 2022 ACSONE SA/NV | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Stock production lot expired date", | ||
"version": "17.0.1.0.1", | ||
"author": "Camptocamp, ACSONE SA/NV, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"category": "Product", | ||
"depends": ["product_expiry", "stock"], | ||
"website": "https://github.com/OCA/product-attribute", | ||
"data": ["views/res_config_settings.xml"], | ||
"installable": True, | ||
} |
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,60 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_production_lot_expired_date | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2023-12-29 11:34+0000\n" | ||
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n" | ||
"Language-Team: none\n" | ||
"Language: es\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 4.17\n" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#. odoo-python | ||
#: code:addons/stock_production_lot_expired_date/models/res_config_settings.py:0 | ||
#, python-format | ||
msgid "Alert date" | ||
msgstr "Fecha de alerta" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#: model:ir.model.fields,field_description:stock_production_lot_expired_date.field_res_config_settings__production_lot_base_date | ||
msgid "Base date to compute expiration dates" | ||
msgstr "Fecha base para calcular las fechas de caducidad" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#: model:ir.model,name:stock_production_lot_expired_date.model_res_config_settings | ||
msgid "Config Settings" | ||
msgstr "Ajustes de Config" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#. odoo-python | ||
#: code:addons/stock_production_lot_expired_date/models/res_config_settings.py:0 | ||
#, python-format | ||
msgid "Expiration date" | ||
msgstr "Fecha de Expiración" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#: model:ir.model,name:stock_production_lot_expired_date.model_stock_lot | ||
msgid "Lot/Serial" | ||
msgstr "Lote/Número de serie" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#. odoo-python | ||
#: code:addons/stock_production_lot_expired_date/models/res_config_settings.py:0 | ||
#, python-format | ||
msgid "Removal date" | ||
msgstr "Fecha de retirada" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#. odoo-python | ||
#: code:addons/stock_production_lot_expired_date/models/res_config_settings.py:0 | ||
#, python-format | ||
msgid "Use date" | ||
msgstr "Fecha de uso" |
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,60 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_production_lot_expired_date | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2023-04-27 15:33+0000\n" | ||
"Last-Translator: Sebastiano Picchi <sebapicchi@yahoo.it>\n" | ||
"Language-Team: none\n" | ||
"Language: it\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 4.14.1\n" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#. odoo-python | ||
#: code:addons/stock_production_lot_expired_date/models/res_config_settings.py:0 | ||
#, python-format | ||
msgid "Alert date" | ||
msgstr "Data di avviso" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#: model:ir.model.fields,field_description:stock_production_lot_expired_date.field_res_config_settings__production_lot_base_date | ||
msgid "Base date to compute expiration dates" | ||
msgstr "Data base da cui computare la data di scadenza" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#: model:ir.model,name:stock_production_lot_expired_date.model_res_config_settings | ||
msgid "Config Settings" | ||
msgstr "Impostazioni di configurazione" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#. odoo-python | ||
#: code:addons/stock_production_lot_expired_date/models/res_config_settings.py:0 | ||
#, python-format | ||
msgid "Expiration date" | ||
msgstr "Data di scadenza" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#: model:ir.model,name:stock_production_lot_expired_date.model_stock_lot | ||
msgid "Lot/Serial" | ||
msgstr "Lotto/seriale" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#. odoo-python | ||
#: code:addons/stock_production_lot_expired_date/models/res_config_settings.py:0 | ||
#, python-format | ||
msgid "Removal date" | ||
msgstr "Data rimozione" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#. odoo-python | ||
#: code:addons/stock_production_lot_expired_date/models/res_config_settings.py:0 | ||
#, python-format | ||
msgid "Use date" | ||
msgstr "Data d'uso" |
57 changes: 57 additions & 0 deletions
57
stock_production_lot_expired_date/i18n/stock_production_lot_expired_date.pot
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,57 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_production_lot_expired_date | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#. odoo-python | ||
#: code:addons/stock_production_lot_expired_date/models/res_config_settings.py:0 | ||
#, python-format | ||
msgid "Alert date" | ||
msgstr "" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#: model:ir.model.fields,field_description:stock_production_lot_expired_date.field_res_config_settings__production_lot_base_date | ||
msgid "Base date to compute expiration dates" | ||
msgstr "" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#: model:ir.model,name:stock_production_lot_expired_date.model_res_config_settings | ||
msgid "Config Settings" | ||
msgstr "" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#. odoo-python | ||
#: code:addons/stock_production_lot_expired_date/models/res_config_settings.py:0 | ||
#, python-format | ||
msgid "Expiration date" | ||
msgstr "" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#: model:ir.model,name:stock_production_lot_expired_date.model_stock_lot | ||
msgid "Lot/Serial" | ||
msgstr "" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#. odoo-python | ||
#: code:addons/stock_production_lot_expired_date/models/res_config_settings.py:0 | ||
#, python-format | ||
msgid "Removal date" | ||
msgstr "" | ||
|
||
#. module: stock_production_lot_expired_date | ||
#. odoo-python | ||
#: code:addons/stock_production_lot_expired_date/models/res_config_settings.py:0 | ||
#, python-format | ||
msgid "Use date" | ||
msgstr "" |
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,2 @@ | ||
from . import res_config_settings | ||
from . import stock_lot |
23 changes: 23 additions & 0 deletions
23
stock_production_lot_expired_date/models/res_config_settings.py
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,23 @@ | ||
# Copyright 2016 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import _, api, fields, models | ||
|
||
|
||
class ResConfig(models.TransientModel): | ||
_inherit = "res.config.settings" | ||
|
||
production_lot_base_date = fields.Selection( | ||
selection="_selection_production_lot_base_date", | ||
string="Base date to compute expiration dates", | ||
config_parameter="stock_production_lot_expired_date.production_lot_base_date", | ||
) | ||
|
||
@api.model | ||
def _selection_production_lot_base_date(self): | ||
return [ | ||
("use", _("Use date")), | ||
("expiration", _("Expiration date")), | ||
("alert", _("Alert date")), | ||
("removal", _("Removal date")), | ||
] |
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,57 @@ | ||
# Copyright 2016-2018 Julien Coux (Camptocamp) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from dateutil.relativedelta import relativedelta | ||
|
||
from odoo import api, models | ||
|
||
|
||
class StockLot(models.Model): | ||
_inherit = "stock.lot" | ||
|
||
@api.model | ||
def _get_product_expired_times(self, product): | ||
return { | ||
"expiration_time": product.expiration_time, | ||
"use_time": product.use_time, | ||
"removal_time": product.removal_time, | ||
"alert_time": product.alert_time, | ||
} | ||
|
||
def _apply_onchange_interval_date(self, from_field): | ||
self.ensure_one() | ||
base_date = self.env["ir.config_parameter"].get_param( | ||
"stock_production_lot_expired_date.production_lot_base_date" | ||
) | ||
if self.product_id and base_date == from_field: | ||
if getattr(self, from_field + "_date"): | ||
to_fields = ["alert", "expiration", "removal", "use"] | ||
to_fields.remove(from_field) | ||
times = self._get_product_expired_times(self.product_id) | ||
from_time = times[from_field + "_time"] | ||
from_date = getattr(self, from_field + "_date") | ||
values = {} | ||
for index in [0, 1, 2]: | ||
if times[to_fields[index] + "_time"]: | ||
days = from_time - times[to_fields[index] + "_time"] | ||
values[to_fields[index] + "_date"] = from_date - relativedelta( | ||
days=days | ||
) | ||
if values: | ||
self.write(values) | ||
|
||
@api.onchange("removal_date") | ||
def onchange_removal_date(self): | ||
self._apply_onchange_interval_date("removal") | ||
|
||
@api.onchange("alert_date") | ||
def onchange_alert_date(self): | ||
self._apply_onchange_interval_date("alert") | ||
|
||
@api.onchange("expiration_date") | ||
def onchange_expiration_date(self): | ||
self._apply_onchange_interval_date("expiration") | ||
|
||
@api.onchange("use_date") | ||
def onchange_use_date(self): | ||
self._apply_onchange_interval_date("use") |
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,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
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,7 @@ | ||
- Julien Coux \<<julien.coux@camptocamp.com>\> | ||
- Hughes Damry \<<hughes.damry@acsone.eu>\> | ||
|
||
* `Binhex Systems Solutions <https://binhex.cloud/>`_: | ||
|
||
|
||
* Deriman Alonso <d.alonso@binhex.cloud> |
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,6 @@ | ||
This module allows to facilitate the input of stock production lot | ||
expired dates: | ||
|
||
- Add settings on stock to choose the base date for stock production lot | ||
- Add onchanges on stock production lot to compute expired dates from | ||
base date |
Oops, something went wrong.