diff --git a/setup/stock_exception/odoo/addons/stock_exception b/setup/stock_exception/odoo/addons/stock_exception new file mode 120000 index 000000000..1e9cc1265 --- /dev/null +++ b/setup/stock_exception/odoo/addons/stock_exception @@ -0,0 +1 @@ +../../../../stock_exception \ No newline at end of file diff --git a/setup/stock_exception/setup.py b/setup/stock_exception/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/stock_exception/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_exception/README.rst b/stock_exception/README.rst new file mode 100644 index 000000000..75bdee991 --- /dev/null +++ b/stock_exception/README.rst @@ -0,0 +1,81 @@ +=============== +Stock Exception +=============== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:9b8183c2a60002050aaae57962c63dba0c1d30762d8cc7f0f8273f52c62135a3 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fstock--logistics--warehouse-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_exception + :alt: OCA/stock-logistics-warehouse +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_exception + :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/stock-logistics-warehouse&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows you attach several customizable exceptions to your +stock picking in a way that you can filter pickings by exceptions type and fix them. + +This is especially useful in an scenario for mass stock picking import, because it's likely some pickings have +errors when you import them (like product not found in Odoo, wrong line +format etc.) + +**Table of contents** + +.. contents:: + :local: + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Ecosoft + +Contributors +~~~~~~~~~~~~ + +* Tharathip Chaweewongphan + +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/stock-logistics-warehouse `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_exception/__init__.py b/stock_exception/__init__.py new file mode 100644 index 000000000..346c77968 --- /dev/null +++ b/stock_exception/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +from . import models, wizard diff --git a/stock_exception/__manifest__.py b/stock_exception/__manifest__.py new file mode 100644 index 000000000..9136e21c3 --- /dev/null +++ b/stock_exception/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2021 Ecosoft Co., Ltd (https://ecosoft.co.th) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +{ + "name": "Stock Exception", + "summary": "Custom exceptions on stock picking", + "version": "16.0.1.0.0", + "category": "Generic Modules/Warehouse Management", + "author": "Ecosoft, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/stock-logistics-warehouse", + "depends": ["stock", "base_exception"], + "license": "AGPL-3", + "data": [ + "security/ir.model.access.csv", + "data/stock_exception_data.xml", + "wizard/stock_exception_confirm_view.xml", + "views/stock_view.xml", + ], + "installable": True, +} diff --git a/stock_exception/data/stock_exception_data.xml b/stock_exception/data/stock_exception_data.xml new file mode 100644 index 000000000..cbda52fcd --- /dev/null +++ b/stock_exception/data/stock_exception_data.xml @@ -0,0 +1,33 @@ + + + + Stock: Test Draft Pickings Exception + + code + model.test_all_draft_pickings() + + 20 + minutes + -1 + + + + + No Partner + No Partner + 50 + stock.picking + if not self.partner_id: + failed=True + + + + Demand Quantity not positive + Demand quantity must be positive + 50 + stock.move + if self.product_uom_qty <= 0: + failed=True + + + diff --git a/stock_exception/i18n/es.po b/stock_exception/i18n/es.po new file mode 100644 index 000000000..e9cb6ef3c --- /dev/null +++ b/stock_exception/i18n/es.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_exception +# +# Translators: +# Matias Velazquez +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-06-28 22:06+0000\n" +"PO-Revision-Date: 2023-09-03 00:15+0000\n" +"Last-Translator: Matias Velazquez \n" +"Language-Team: \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_exception +#: model:ir.model.fields,field_description:stock_exception.field_exception_rule__check_on_confirm +msgid "Check On Confirm" +msgstr "Chequear al Confirmar" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_exception_rule__check_on_validate +msgid "Check On Validate" +msgstr "Chequear al Validar" diff --git a/stock_exception/i18n/it.po b/stock_exception/i18n/it.po new file mode 100644 index 000000000..cad9f97d2 --- /dev/null +++ b/stock_exception/i18n/it.po @@ -0,0 +1,175 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_exception +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\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" + +#. module: stock_exception +#: model_terms:ir.ui.view,arch_db:stock_exception.view_picking_form +msgid "There are exceptions blocking this stock picking:" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_exception_rule__model +msgid "Apply on" +msgstr "" + +#. module: stock_exception +#: model_terms:ir.ui.view,arch_db:stock_exception.view_picking_internal_search +msgid "Blocked in Draft" +msgstr "" + +#. module: stock_exception +#: model_terms:ir.ui.view,arch_db:stock_exception.view_picking_form +msgid "" +"Click here to be able to confirm this stock picking regardless of the " +"exceptions." +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm__create_uid +msgid "Created by" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm__create_date +msgid "Created on" +msgstr "" + +#. module: stock_exception +#: model:exception.rule,name:stock_exception.sm_excep_product_uom_qty_check +msgid "Demand Quantity not positive" +msgstr "" + +#. module: stock_exception +#: model:exception.rule,description:stock_exception.sm_excep_product_uom_qty_check +msgid "Demand quantity must be positive" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_exception_rule__display_name +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm__display_name +#: model:ir.model.fields,field_description:stock_exception.field_stock_move__display_name +#: model:ir.model.fields,field_description:stock_exception.field_stock_picking__display_name +msgid "Display Name" +msgstr "" + +#. module: stock_exception +#: model:ir.model,name:stock_exception.model_exception_rule +msgid "Exception Rule" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_picking__exception_ids +msgid "Exceptions" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_picking__exceptions_summary +msgid "Exceptions Summary" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm__exception_ids +msgid "Exceptions to resolve" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_exception_rule__id +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm__id +#: model:ir.model.fields,field_description:stock_exception.field_stock_move__id +#: model:ir.model.fields,field_description:stock_exception.field_stock_picking__id +msgid "ID" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm__ignore +#: model:ir.model.fields,field_description:stock_exception.field_stock_move__ignore_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_picking__ignore_exception +#: model_terms:ir.ui.view,arch_db:stock_exception.view_picking_form +msgid "Ignore Exceptions" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_exception_rule____last_update +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm____last_update +#: model:ir.model.fields,field_description:stock_exception.field_stock_move____last_update +#: model:ir.model.fields,field_description:stock_exception.field_stock_picking____last_update +msgid "Last Modified on" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm__write_date +msgid "Last Updated on" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_picking__main_exception_id +msgid "Main Exception" +msgstr "" + +#. module: stock_exception +#: model:exception.rule,description:stock_exception.sp_excep_no_partner +#: model:exception.rule,name:stock_exception.sp_excep_no_partner +msgid "No Partner" +msgstr "" + +#. module: stock_exception +#: model:ir.actions.act_window,name:stock_exception.action_stock_exception_confirm +msgid "Outstanding exceptions to manage" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_exception_rule__picking_ids +msgid "Pickings" +msgstr "" + +#. 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 "" + +#. module: stock_exception +#: model:ir.model,name:stock_exception.model_stock_move +#: model:ir.model.fields.selection,name:stock_exception.selection__exception_rule__model__stock_move +msgid "Stock Move" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm__related_model_id +#: model:ir.model.fields.selection,name:stock_exception.selection__exception_rule__model__stock_picking +msgid "Stock Picking" +msgstr "" + +#. module: stock_exception +#: model:ir.model,name:stock_exception.model_stock_exception_confirm +msgid "Stock exception wizard" +msgstr "" + +#. module: stock_exception +#: model:ir.actions.server,name:stock_exception.ir_cron_test_stock_picking_except_ir_actions_server +#: model:ir.cron,cron_name:stock_exception.ir_cron_test_stock_picking_except +#: model:ir.cron,name:stock_exception.ir_cron_test_stock_picking_except +msgid "Stock: Test Draft Pickings Exception" +msgstr "" + +#. module: stock_exception +#: model:ir.model,name:stock_exception.model_stock_picking +msgid "Transfer" +msgstr "" diff --git a/stock_exception/i18n/stock_exception.pot b/stock_exception/i18n/stock_exception.pot new file mode 100644 index 000000000..c2ee7017b --- /dev/null +++ b/stock_exception/i18n/stock_exception.pot @@ -0,0 +1,174 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_exception +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.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_exception +#: model_terms:ir.ui.view,arch_db:stock_exception.view_picking_form +msgid "There are exceptions blocking this stock picking:" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_exception_rule__model +msgid "Apply on" +msgstr "" + +#. module: stock_exception +#: model_terms:ir.ui.view,arch_db:stock_exception.view_picking_internal_search +msgid "Blocked in Draft" +msgstr "" + +#. module: stock_exception +#: model_terms:ir.ui.view,arch_db:stock_exception.view_picking_form +msgid "" +"Click here to be able to confirm this stock picking regardless of the " +"exceptions." +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm__create_uid +msgid "Created by" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm__create_date +msgid "Created on" +msgstr "" + +#. module: stock_exception +#: model:exception.rule,name:stock_exception.sm_excep_product_uom_qty_check +msgid "Demand Quantity not positive" +msgstr "" + +#. module: stock_exception +#: model:exception.rule,description:stock_exception.sm_excep_product_uom_qty_check +msgid "Demand quantity must be positive" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_exception_rule__display_name +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm__display_name +#: model:ir.model.fields,field_description:stock_exception.field_stock_move__display_name +#: model:ir.model.fields,field_description:stock_exception.field_stock_picking__display_name +msgid "Display Name" +msgstr "" + +#. module: stock_exception +#: model:ir.model,name:stock_exception.model_exception_rule +msgid "Exception Rule" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_picking__exception_ids +msgid "Exceptions" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_picking__exceptions_summary +msgid "Exceptions Summary" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm__exception_ids +msgid "Exceptions to resolve" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_exception_rule__id +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm__id +#: model:ir.model.fields,field_description:stock_exception.field_stock_move__id +#: model:ir.model.fields,field_description:stock_exception.field_stock_picking__id +msgid "ID" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm__ignore +#: model:ir.model.fields,field_description:stock_exception.field_stock_move__ignore_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_picking__ignore_exception +#: model_terms:ir.ui.view,arch_db:stock_exception.view_picking_form +msgid "Ignore Exceptions" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_exception_rule____last_update +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm____last_update +#: model:ir.model.fields,field_description:stock_exception.field_stock_move____last_update +#: model:ir.model.fields,field_description:stock_exception.field_stock_picking____last_update +msgid "Last Modified on" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm__write_date +msgid "Last Updated on" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_picking__main_exception_id +msgid "Main Exception" +msgstr "" + +#. module: stock_exception +#: model:exception.rule,description:stock_exception.sp_excep_no_partner +#: model:exception.rule,name:stock_exception.sp_excep_no_partner +msgid "No Partner" +msgstr "" + +#. module: stock_exception +#: model:ir.actions.act_window,name:stock_exception.action_stock_exception_confirm +msgid "Outstanding exceptions to manage" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_exception_rule__picking_ids +msgid "Pickings" +msgstr "" + +#. 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 "" + +#. module: stock_exception +#: model:ir.model,name:stock_exception.model_stock_move +#: model:ir.model.fields.selection,name:stock_exception.selection__exception_rule__model__stock_move +msgid "Stock Move" +msgstr "" + +#. module: stock_exception +#: model:ir.model.fields,field_description:stock_exception.field_stock_exception_confirm__related_model_id +#: model:ir.model.fields.selection,name:stock_exception.selection__exception_rule__model__stock_picking +msgid "Stock Picking" +msgstr "" + +#. module: stock_exception +#: model:ir.model,name:stock_exception.model_stock_exception_confirm +msgid "Stock exception wizard" +msgstr "" + +#. module: stock_exception +#: model:ir.actions.server,name:stock_exception.ir_cron_test_stock_picking_except_ir_actions_server +#: model:ir.cron,cron_name:stock_exception.ir_cron_test_stock_picking_except +#: model:ir.cron,name:stock_exception.ir_cron_test_stock_picking_except +msgid "Stock: Test Draft Pickings Exception" +msgstr "" + +#. module: stock_exception +#: model:ir.model,name:stock_exception.model_stock_picking +msgid "Transfer" +msgstr "" diff --git a/stock_exception/models/__init__.py b/stock_exception/models/__init__.py new file mode 100644 index 000000000..2ea20c654 --- /dev/null +++ b/stock_exception/models/__init__.py @@ -0,0 +1,5 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +from . import exception_rule +from . import stock +from . import stock_move diff --git a/stock_exception/models/exception_rule.py b/stock_exception/models/exception_rule.py new file mode 100644 index 000000000..f47aa828c --- /dev/null +++ b/stock_exception/models/exception_rule.py @@ -0,0 +1,17 @@ +# Copyright 2021 Ecosoft Co., Ltd (https://ecosoft.co.th) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +from odoo import fields, models + + +class ExceptionRule(models.Model): + _inherit = "exception.rule" + + picking_ids = fields.Many2many(comodel_name="stock.picking", string="Pickings") + model = fields.Selection( + selection_add=[ + ("stock.picking", "Stock Picking"), + ("stock.move", "Stock Move"), + ], + ondelete={"stock.picking": "cascade", "stock.move": "cascade"}, + ) diff --git a/stock_exception/models/stock.py b/stock_exception/models/stock.py new file mode 100644 index 000000000..341ef8c85 --- /dev/null +++ b/stock_exception/models/stock.py @@ -0,0 +1,49 @@ +# Copyright 2021 Ecosoft Co., Ltd (https://ecosoft.co.th) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +from odoo import api, models + + +class StockPicking(models.Model): + _inherit = ["stock.picking", "base.exception"] + _name = "stock.picking" + + @api.model + def test_all_draft_pickings(self): + picking_set = self.search([("state", "=", "draft")]) + picking_set.detect_exceptions() + return True + + @api.model + def _reverse_field(self): + return "picking_ids" + + def detect_exceptions(self): + all_exceptions = super().detect_exceptions() + moves = self.mapped("move_ids") + all_exceptions += moves.detect_exceptions() + return all_exceptions + + @api.constrains("ignore_exception", "move_ids", "state") + def stock_check_exception(self): + pickings = self.filtered( + lambda s: s.state in ["waiting", "confirmed", "assigned"] + ) + if pickings: + pickings._check_exception() + + @api.onchange("move_ids") + def onchange_ignore_exception(self): + if self.state in ["waiting", "confirmed", "assigned"]: + self.ignore_exception = False + + def action_confirm(self): + for rec in self: + if rec.detect_exceptions() and not rec.ignore_exception: + return rec._popup_exceptions() + return super().action_confirm() + + @api.model + def _get_popup_action(self): + action = self.env.ref("stock_exception.action_stock_exception_confirm") + return action diff --git a/stock_exception/models/stock_move.py b/stock_exception/models/stock_move.py new file mode 100644 index 000000000..3e1bb7980 --- /dev/null +++ b/stock_exception/models/stock_move.py @@ -0,0 +1,24 @@ +# Copyright 2021 Ecosoft Co., Ltd (https://ecosoft.co.th) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +from odoo import api, fields, models + + +class StockMove(models.Model): + _inherit = ["stock.move", "base.exception.method"] + _name = "stock.move" + + ignore_exception = fields.Boolean( + related="picking_id.ignore_exception", store=True, string="Ignore Exceptions" + ) + + def _get_main_records(self): + return self.mapped("picking_id") + + @api.model + def _reverse_field(self): + return "picking_ids" + + def _detect_exceptions(self, rule): + records = super()._detect_exceptions(rule) + return records.mapped("picking_id") diff --git a/stock_exception/readme/CONTRIBUTORS.rst b/stock_exception/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..ea15cb1bf --- /dev/null +++ b/stock_exception/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Tharathip Chaweewongphan diff --git a/stock_exception/readme/DESCRIPTION.rst b/stock_exception/readme/DESCRIPTION.rst new file mode 100644 index 000000000..5a7a03d78 --- /dev/null +++ b/stock_exception/readme/DESCRIPTION.rst @@ -0,0 +1,6 @@ +This module allows you attach several customizable exceptions to your +stock picking in a way that you can filter pickings by exceptions type and fix them. + +This is especially useful in an scenario for mass stock picking import, because it's likely some pickings have +errors when you import them (like product not found in Odoo, wrong line +format etc.) diff --git a/stock_exception/security/ir.model.access.csv b/stock_exception/security/ir.model.access.csv new file mode 100644 index 000000000..cf4423175 --- /dev/null +++ b/stock_exception/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_stock_exception_confirm,access_stock_exception_confirm,model_stock_exception_confirm,base.group_user,1,1,1,1 diff --git a/stock_exception/static/description/icon.png b/stock_exception/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/stock_exception/static/description/icon.png differ diff --git a/stock_exception/static/description/index.html b/stock_exception/static/description/index.html new file mode 100644 index 000000000..706b49df8 --- /dev/null +++ b/stock_exception/static/description/index.html @@ -0,0 +1,425 @@ + + + + + + +Stock Exception + + + +
+

Stock Exception

+ + +

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 +stock picking in a way that you can filter pickings by exceptions type and fix them.

+

This is especially useful in an scenario for mass stock picking import, because it’s likely some pickings have +errors when you import them (like product not found in Odoo, wrong line +format etc.)

+

Table of contents

+ +
+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Ecosoft
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+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.

+

This module is part of the OCA/stock-logistics-warehouse project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/stock_exception/views/stock_view.xml b/stock_exception/views/stock_view.xml new file mode 100644 index 000000000..cc4d30680 --- /dev/null +++ b/stock_exception/views/stock_view.xml @@ -0,0 +1,82 @@ + + + Stock Exception Rules + exception.rule + tree,form + + [('model', 'in', ['stock.picking', 'stock.move', 'stock.move.line'])] + {'active_test': False, 'default_model' : 'stock.picking'} + + + + stock_exception.view_picking_form + stock.picking + + + + + + + + + + + + + stock_exception.vpicktree + stock.picking + + + + + + + + + stock_exception.view_picking_internal_search + stock.picking + + + + + + + + + diff --git a/stock_exception/wizard/__init__.py b/stock_exception/wizard/__init__.py new file mode 100644 index 000000000..db10bd01b --- /dev/null +++ b/stock_exception/wizard/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +from . import stock_exception_confirm diff --git a/stock_exception/wizard/stock_exception_confirm.py b/stock_exception/wizard/stock_exception_confirm.py new file mode 100644 index 000000000..0c3e2964c --- /dev/null +++ b/stock_exception/wizard/stock_exception_confirm.py @@ -0,0 +1,19 @@ +# Copyright 2021 Ecosoft Co., Ltd (https://ecosoft.co.th) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +from odoo import fields, models + + +class StockExceptionConfirm(models.TransientModel): + _name = "stock.exception.confirm" + _description = "Stock exception wizard" + _inherit = ["exception.rule.confirm"] + + related_model_id = fields.Many2one("stock.picking", "Stock Picking") + + def action_confirm(self): + self.ensure_one() + if self.ignore: + self.related_model_id.ignore_exception = True + self.related_model_id.action_confirm() + return super().action_confirm() diff --git a/stock_exception/wizard/stock_exception_confirm_view.xml b/stock_exception/wizard/stock_exception_confirm_view.xml new file mode 100644 index 000000000..40734ca4b --- /dev/null +++ b/stock_exception/wizard/stock_exception_confirm_view.xml @@ -0,0 +1,10 @@ + + + Outstanding exceptions to manage + ir.actions.act_window + stock.exception.confirm + form + + new + +