diff --git a/README.md b/README.md index ec7e5f3a5a61..c7f55f664743 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ addon | version | maintainers | summary [stock_cycle_count](stock_cycle_count/) | 16.0.1.1.0 | [![LoisRForgeFlow](https://github.com/LoisRForgeFlow.png?size=30px)](https://github.com/LoisRForgeFlow) | Adds the capability to schedule cycle counts in a warehouse through different rules defined by the user. [stock_demand_estimate](stock_demand_estimate/) | 16.0.1.2.0 | | Allows to create demand estimates. [stock_demand_estimate_matrix](stock_demand_estimate_matrix/) | 16.0.1.0.0 | | Allows to create demand estimates. -[stock_exception](stock_exception/) | 16.0.1.0.0 | | Custom exceptions on stock picking +[stock_exception](stock_exception/) | 16.0.1.1.0 | | Custom exceptions on stock picking [stock_helper](stock_helper/) | 16.0.1.1.0 | | Add methods shared between various stock modules [stock_inventory](stock_inventory/) | 16.0.2.5.0 | | Allows to do an easier follow up of the Inventory Adjustments [stock_inventory_count_to_zero](stock_inventory_count_to_zero/) | 16.0.1.0.0 | | Request an inventory count filling the quantities to zero as default diff --git a/stock_exception/README.rst b/stock_exception/README.rst index 75bdee9915e4..d76a4c826aaf 100644 --- a/stock_exception/README.rst +++ b/stock_exception/README.rst @@ -7,7 +7,7 @@ Stock Exception !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:9b8183c2a60002050aaae57962c63dba0c1d30762d8cc7f0f8273f52c62135a3 + !! source digest: sha256:3a8f0942ab573333c7f92bf4966bc4d210489d20b8e0aa3d3b5acf382a60d622 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/stock_exception/__manifest__.py b/stock_exception/__manifest__.py index 9136e21c3165..08cd84a5c880 100644 --- a/stock_exception/__manifest__.py +++ b/stock_exception/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Stock Exception", "summary": "Custom exceptions on stock picking", - "version": "16.0.1.0.0", + "version": "16.0.1.1.0", "category": "Generic Modules/Warehouse Management", "author": "Ecosoft, Odoo Community Association (OCA)", "website": "https://github.com/OCA/stock-logistics-warehouse", @@ -15,6 +15,7 @@ "data/stock_exception_data.xml", "wizard/stock_exception_confirm_view.xml", "views/stock_view.xml", + "views/base_exception_view.xml", ], "installable": True, } diff --git a/stock_exception/i18n/es.po b/stock_exception/i18n/es.po index e9cb6ef3c1a2..8c2ff2a289d0 100644 --- a/stock_exception/i18n/es.po +++ b/stock_exception/i18n/es.po @@ -29,3 +29,9 @@ msgstr "Chequear al Confirmar" #: model:ir.model.fields,field_description:stock_exception.field_exception_rule__check_on_validate msgid "Check On Validate" msgstr "Chequear al Validar" + +#. module: stock_exception +#: model:ir.actions.act_window,name:stock_exception.action_stock_test_tree +#: model:ir.ui.menu,name:stock_exception.menu_stock_test +msgid "Stock Exception Rules" +msgstr "Reglas de Excepción de Stock" diff --git a/stock_exception/models/exception_rule.py b/stock_exception/models/exception_rule.py index f47aa828cd6e..8bc3077e7749 100644 --- a/stock_exception/models/exception_rule.py +++ b/stock_exception/models/exception_rule.py @@ -15,3 +15,10 @@ class ExceptionRule(models.Model): ], ondelete={"stock.picking": "cascade", "stock.move": "cascade"}, ) + method = fields.Selection( + selection_add=[ + ("button_validate", "Validation"), + ("action_confirm", "Confirmation"), + ], + readonly=False, + ) diff --git a/stock_exception/models/stock.py b/stock_exception/models/stock.py index 5e690b112c11..d74186e6d9fe 100644 --- a/stock_exception/models/stock.py +++ b/stock_exception/models/stock.py @@ -39,13 +39,25 @@ def onchange_ignore_exception(self): def action_confirm(self): for rec in self: - if rec.detect_exceptions() and not rec.ignore_exception: + exception = self.env["exception.rule"].search( + [("model", "=", "stock.picking"), ("method", "=", "action_confirm")] + ) + if exception and not rec.ignore_exception: + rec.exception_ids = [(4, exception.id)] + return rec._popup_exceptions() + elif rec.detect_exceptions() and not rec.ignore_exception: return rec._popup_exceptions() return super().action_confirm() def button_validate(self): for rec in self: - if rec.detect_exceptions() and not rec.ignore_exception: + exception = self.env["exception.rule"].search( + [("model", "=", "stock.picking"), ("method", "=", "button_validate")] + ) + if exception and not rec.ignore_exception: + rec.exception_ids = [(4, exception.id)] + return rec._popup_exceptions() + elif rec.detect_exceptions() and not rec.ignore_exception: return rec._popup_exceptions() return super().button_validate() diff --git a/stock_exception/static/description/index.html b/stock_exception/static/description/index.html index 706b49df8709..003ead2a1fee 100644 --- a/stock_exception/static/description/index.html +++ b/stock_exception/static/description/index.html @@ -1,4 +1,3 @@ - @@ -9,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -275,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -301,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -367,7 +367,7 @@

Stock Exception

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:9b8183c2a60002050aaae57962c63dba0c1d30762d8cc7f0f8273f52c62135a3 +!! source digest: sha256:3a8f0942ab573333c7f92bf4966bc4d210489d20b8e0aa3d3b5acf382a60d622 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runboat

This module allows you attach several customizable exceptions to your @@ -412,7 +412,9 @@

Contributors

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

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.

diff --git a/stock_exception/views/base_exception_view.xml b/stock_exception/views/base_exception_view.xml new file mode 100644 index 000000000000..8b0c8feb35dc --- /dev/null +++ b/stock_exception/views/base_exception_view.xml @@ -0,0 +1,24 @@ + + + exception.rule.form.inherit + exception.rule + + + + + + + + + + + +