diff --git a/setup/warning_mrp/odoo/addons/warning_mrp b/setup/warning_mrp/odoo/addons/warning_mrp new file mode 120000 index 00000000..658a8886 --- /dev/null +++ b/setup/warning_mrp/odoo/addons/warning_mrp @@ -0,0 +1 @@ +../../../../warning_mrp \ No newline at end of file diff --git a/setup/warning_mrp/setup.py b/setup/warning_mrp/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/warning_mrp/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/warning_mrp/README.rst b/warning_mrp/README.rst new file mode 100644 index 00000000..60389e4c --- /dev/null +++ b/warning_mrp/README.rst @@ -0,0 +1,38 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +============= +MRP - Warning +============= + +* This module extends the functionality of warning module to allow you to + configure messages for manufacturing. + + +Configuration +============= + +To configure this module, you need to: + +* Go to product and configure the message in Sales tab. + +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 smash it by providing detailed and welcomed feedback. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Contributors +------------ + +* Oihane Crucelaegui +* Pedro M. Baeza +* Ana Juaristi diff --git a/warning_mrp/__init__.py b/warning_mrp/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/warning_mrp/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/warning_mrp/__manifest__.py b/warning_mrp/__manifest__.py new file mode 100644 index 00000000..c7cba151 --- /dev/null +++ b/warning_mrp/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright 2015 Oihane Crucelaegui - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +{ + "name": "Warning Messages and Alerts in Manufacturing", + "version": "16.0.1.0.0", + "category": "Manufacturing/Manufacturing", + "license": "AGPL-3", + "author": "OdooMRP team, " "AvanzOSC, " "Serv. Tecnol. Avanzados - Pedro M. Baeza", + "website": "https://github.com/avanzosc/mrp-addons", + "contributors": [ + "Oihane Crucelaegui ", + "Pedro M. Baeza ", + "Ana Juaristi ", + ], + "depends": [ + "mrp", + ], + "data": [ + "views/product_template_views.xml", + "views/product_product_views.xml", + "views/mrp_production_views.xml", + ], + "installable": True, +} diff --git a/warning_mrp/i18n/ca_ES.po b/warning_mrp/i18n/ca_ES.po new file mode 100644 index 00000000..aac99aa2 --- /dev/null +++ b/warning_mrp/i18n/ca_ES.po @@ -0,0 +1,95 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * warning_mrp +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-19 12:57+0000\n" +"PO-Revision-Date: 2024-11-19 12:57+0000\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: warning_mrp +#: model:ir.model.fields.selection,name:warning_mrp.selection__product_template__mrp_production_warn__block +msgid "Blocking Message" +msgstr "" + +#. module: warning_mrp +#: model:ir.model.fields,field_description:warning_mrp.field_mrp_production__mrp_production_warn +#: model:ir.model.fields,field_description:warning_mrp.field_product_product__mrp_production_warn +#: model:ir.model.fields,field_description:warning_mrp.field_product_template__mrp_production_warn +msgid "Manufacturing Order" +msgstr "" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Message" +msgstr "" + +#. module: warning_mrp +#: model:ir.model.fields,field_description:warning_mrp.field_mrp_production__mrp_production_warn_msg +#: model:ir.model.fields,field_description:warning_mrp.field_product_product__mrp_production_warn_msg +#: model:ir.model.fields,field_description:warning_mrp.field_product_template__mrp_production_warn_msg +msgid "Message for Manufacturing Order" +msgstr "" + +#. module: warning_mrp +#: model:ir.model.fields.selection,name:warning_mrp.selection__product_template__mrp_production_warn__no-message +msgid "No Message" +msgstr "" + +#. module: warning_mrp +#: model:ir.model,name:warning_mrp.model_product_template +msgid "Product" +msgstr "Producte" + +#. module: warning_mrp +#: model:ir.model,name:warning_mrp.model_mrp_production +msgid "Production Order" +msgstr "Ordre de producció" + +#. module: warning_mrp +#: model:ir.model.fields,help:warning_mrp.field_mrp_production__mrp_production_warn +#: model:ir.model.fields,help:warning_mrp.field_product_product__mrp_production_warn +#: model:ir.model.fields,help:warning_mrp.field_product_template__mrp_production_warn +msgid "" +"Selecting the \"Warning\" option will notify user with the message, " +"Selecting \"Blocking Message\" will throw an exception with the message and " +"block the flow. The Message has to be written in the next field." +msgstr "" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_normal_form_view +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Type a message..." +msgstr "" + +#. module: warning_mrp +#: model:ir.model.fields.selection,name:warning_mrp.selection__product_template__mrp_production_warn__warning +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Warning" +msgstr "" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.mrp_production_form_view +msgid "Warning !!!!!" +msgstr "" + +#. module: warning_mrp +#. odoo-python +#: code:addons/warning_mrp/models/mrp_production.py:0 +#, python-format +msgid "Warning for %s" +msgstr "" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_normal_form_view +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Warning when Manufacturing this Product" +msgstr "" diff --git a/warning_mrp/i18n/en_GB.po b/warning_mrp/i18n/en_GB.po new file mode 100644 index 00000000..eb14f49e --- /dev/null +++ b/warning_mrp/i18n/en_GB.po @@ -0,0 +1,95 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * warning_mrp +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-19 12:58+0000\n" +"PO-Revision-Date: 2024-11-19 12:58+0000\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: warning_mrp +#: model:ir.model.fields.selection,name:warning_mrp.selection__product_template__mrp_production_warn__block +msgid "Blocking Message" +msgstr "" + +#. module: warning_mrp +#: model:ir.model.fields,field_description:warning_mrp.field_mrp_production__mrp_production_warn +#: model:ir.model.fields,field_description:warning_mrp.field_product_product__mrp_production_warn +#: model:ir.model.fields,field_description:warning_mrp.field_product_template__mrp_production_warn +msgid "Manufacturing Order" +msgstr "" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Message" +msgstr "" + +#. module: warning_mrp +#: model:ir.model.fields,field_description:warning_mrp.field_mrp_production__mrp_production_warn_msg +#: model:ir.model.fields,field_description:warning_mrp.field_product_product__mrp_production_warn_msg +#: model:ir.model.fields,field_description:warning_mrp.field_product_template__mrp_production_warn_msg +msgid "Message for Manufacturing Order" +msgstr "" + +#. module: warning_mrp +#: model:ir.model.fields.selection,name:warning_mrp.selection__product_template__mrp_production_warn__no-message +msgid "No Message" +msgstr "" + +#. module: warning_mrp +#: model:ir.model,name:warning_mrp.model_product_template +msgid "Product" +msgstr "" + +#. module: warning_mrp +#: model:ir.model,name:warning_mrp.model_mrp_production +msgid "Production Order" +msgstr "" + +#. module: warning_mrp +#: model:ir.model.fields,help:warning_mrp.field_mrp_production__mrp_production_warn +#: model:ir.model.fields,help:warning_mrp.field_product_product__mrp_production_warn +#: model:ir.model.fields,help:warning_mrp.field_product_template__mrp_production_warn +msgid "" +"Selecting the \"Warning\" option will notify user with the message, " +"Selecting \"Blocking Message\" will throw an exception with the message and " +"block the flow. The Message has to be written in the next field." +msgstr "" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_normal_form_view +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Type a message..." +msgstr "" + +#. module: warning_mrp +#: model:ir.model.fields.selection,name:warning_mrp.selection__product_template__mrp_production_warn__warning +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Warning" +msgstr "" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.mrp_production_form_view +msgid "Warning !!!!!" +msgstr "" + +#. module: warning_mrp +#. odoo-python +#: code:addons/warning_mrp/models/mrp_production.py:0 +#, python-format +msgid "Warning for %s" +msgstr "" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_normal_form_view +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Warning when Manufacturing this Product" +msgstr "" diff --git a/warning_mrp/i18n/es.po b/warning_mrp/i18n/es.po new file mode 100644 index 00000000..c6d5ac23 --- /dev/null +++ b/warning_mrp/i18n/es.po @@ -0,0 +1,99 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * warning_mrp +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-19 12:58+0000\n" +"PO-Revision-Date: 2024-11-19 12:58+0000\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: warning_mrp +#: model:ir.model.fields.selection,name:warning_mrp.selection__product_template__mrp_production_warn__block +msgid "Blocking Message" +msgstr "Mensaje de bloqueo" + +#. module: warning_mrp +#: model:ir.model.fields,field_description:warning_mrp.field_mrp_production__mrp_production_warn +#: model:ir.model.fields,field_description:warning_mrp.field_product_product__mrp_production_warn +#: model:ir.model.fields,field_description:warning_mrp.field_product_template__mrp_production_warn +msgid "Manufacturing Order" +msgstr "Orden de fabricación" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Message" +msgstr "Mensaje" + +#. module: warning_mrp +#: model:ir.model.fields,field_description:warning_mrp.field_mrp_production__mrp_production_warn_msg +#: model:ir.model.fields,field_description:warning_mrp.field_product_product__mrp_production_warn_msg +#: model:ir.model.fields,field_description:warning_mrp.field_product_template__mrp_production_warn_msg +msgid "Message for Manufacturing Order" +msgstr "Mensaje para orden de fabricación" + +#. module: warning_mrp +#: model:ir.model.fields.selection,name:warning_mrp.selection__product_template__mrp_production_warn__no-message +msgid "No Message" +msgstr "Sin mensaje" + +#. module: warning_mrp +#: model:ir.model,name:warning_mrp.model_product_template +msgid "Product" +msgstr "Producto" + +#. module: warning_mrp +#: model:ir.model,name:warning_mrp.model_mrp_production +msgid "Production Order" +msgstr "Orden de producción" + +#. module: warning_mrp +#: model:ir.model.fields,help:warning_mrp.field_mrp_production__mrp_production_warn +#: model:ir.model.fields,help:warning_mrp.field_product_product__mrp_production_warn +#: model:ir.model.fields,help:warning_mrp.field_product_template__mrp_production_warn +msgid "" +"Selecting the \"Warning\" option will notify user with the message, " +"Selecting \"Blocking Message\" will throw an exception with the message and " +"block the flow. The Message has to be written in the next field." +msgstr "" +"Si seleccionas la opción \"Advertencia\" se notificará a los usuarios con el" +" mensaje, si selecciona \"Mensaje de bloqueo\" se lanzará una excepción con " +"el mensaje y se bloqueará el flujo. El mensaje debe escribirse en el " +"siguiente campo." + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_normal_form_view +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Type a message..." +msgstr "Escriba un mensaje..." + +#. module: warning_mrp +#: model:ir.model.fields.selection,name:warning_mrp.selection__product_template__mrp_production_warn__warning +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Warning" +msgstr "Aviso" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.mrp_production_form_view +msgid "Warning !!!!!" +msgstr "¡¡¡¡¡ AVISO !!!!!" + +#. module: warning_mrp +#. odoo-python +#: code:addons/warning_mrp/models/mrp_production.py:0 +#, python-format +msgid "Warning for %s" +msgstr "Advertencia para %s" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_normal_form_view +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Warning when Manufacturing this Product" +msgstr "Advertencia al fabricar este producto" diff --git a/warning_mrp/i18n/fr.po b/warning_mrp/i18n/fr.po new file mode 100644 index 00000000..bc55bb81 --- /dev/null +++ b/warning_mrp/i18n/fr.po @@ -0,0 +1,95 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * warning_mrp +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-19 12:58+0000\n" +"PO-Revision-Date: 2024-11-19 12:58+0000\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: warning_mrp +#: model:ir.model.fields.selection,name:warning_mrp.selection__product_template__mrp_production_warn__block +msgid "Blocking Message" +msgstr "" + +#. module: warning_mrp +#: model:ir.model.fields,field_description:warning_mrp.field_mrp_production__mrp_production_warn +#: model:ir.model.fields,field_description:warning_mrp.field_product_product__mrp_production_warn +#: model:ir.model.fields,field_description:warning_mrp.field_product_template__mrp_production_warn +msgid "Manufacturing Order" +msgstr "" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Message" +msgstr "" + +#. module: warning_mrp +#: model:ir.model.fields,field_description:warning_mrp.field_mrp_production__mrp_production_warn_msg +#: model:ir.model.fields,field_description:warning_mrp.field_product_product__mrp_production_warn_msg +#: model:ir.model.fields,field_description:warning_mrp.field_product_template__mrp_production_warn_msg +msgid "Message for Manufacturing Order" +msgstr "" + +#. module: warning_mrp +#: model:ir.model.fields.selection,name:warning_mrp.selection__product_template__mrp_production_warn__no-message +msgid "No Message" +msgstr "" + +#. module: warning_mrp +#: model:ir.model,name:warning_mrp.model_product_template +msgid "Product" +msgstr "Produit" + +#. module: warning_mrp +#: model:ir.model,name:warning_mrp.model_mrp_production +msgid "Production Order" +msgstr "Ordre de production" + +#. module: warning_mrp +#: model:ir.model.fields,help:warning_mrp.field_mrp_production__mrp_production_warn +#: model:ir.model.fields,help:warning_mrp.field_product_product__mrp_production_warn +#: model:ir.model.fields,help:warning_mrp.field_product_template__mrp_production_warn +msgid "" +"Selecting the \"Warning\" option will notify user with the message, " +"Selecting \"Blocking Message\" will throw an exception with the message and " +"block the flow. The Message has to be written in the next field." +msgstr "" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_normal_form_view +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Type a message..." +msgstr "" + +#. module: warning_mrp +#: model:ir.model.fields.selection,name:warning_mrp.selection__product_template__mrp_production_warn__warning +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Warning" +msgstr "" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.mrp_production_form_view +msgid "Warning !!!!!" +msgstr "" + +#. module: warning_mrp +#. odoo-python +#: code:addons/warning_mrp/models/mrp_production.py:0 +#, python-format +msgid "Warning for %s" +msgstr "" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_normal_form_view +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Warning when Manufacturing this Product" +msgstr "" diff --git a/warning_mrp/i18n/warning_mrp.pot b/warning_mrp/i18n/warning_mrp.pot new file mode 100644 index 00000000..577fb233 --- /dev/null +++ b/warning_mrp/i18n/warning_mrp.pot @@ -0,0 +1,95 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * warning_mrp +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-19 12:57+0000\n" +"PO-Revision-Date: 2024-11-19 12:57+0000\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: warning_mrp +#: model:ir.model.fields.selection,name:warning_mrp.selection__product_template__mrp_production_warn__block +msgid "Blocking Message" +msgstr "" + +#. module: warning_mrp +#: model:ir.model.fields,field_description:warning_mrp.field_mrp_production__mrp_production_warn +#: model:ir.model.fields,field_description:warning_mrp.field_product_product__mrp_production_warn +#: model:ir.model.fields,field_description:warning_mrp.field_product_template__mrp_production_warn +msgid "Manufacturing Order" +msgstr "" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Message" +msgstr "" + +#. module: warning_mrp +#: model:ir.model.fields,field_description:warning_mrp.field_mrp_production__mrp_production_warn_msg +#: model:ir.model.fields,field_description:warning_mrp.field_product_product__mrp_production_warn_msg +#: model:ir.model.fields,field_description:warning_mrp.field_product_template__mrp_production_warn_msg +msgid "Message for Manufacturing Order" +msgstr "" + +#. module: warning_mrp +#: model:ir.model.fields.selection,name:warning_mrp.selection__product_template__mrp_production_warn__no-message +msgid "No Message" +msgstr "" + +#. module: warning_mrp +#: model:ir.model,name:warning_mrp.model_product_template +msgid "Product" +msgstr "" + +#. module: warning_mrp +#: model:ir.model,name:warning_mrp.model_mrp_production +msgid "Production Order" +msgstr "" + +#. module: warning_mrp +#: model:ir.model.fields,help:warning_mrp.field_mrp_production__mrp_production_warn +#: model:ir.model.fields,help:warning_mrp.field_product_product__mrp_production_warn +#: model:ir.model.fields,help:warning_mrp.field_product_template__mrp_production_warn +msgid "" +"Selecting the \"Warning\" option will notify user with the message, " +"Selecting \"Blocking Message\" will throw an exception with the message and " +"block the flow. The Message has to be written in the next field." +msgstr "" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_normal_form_view +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Type a message..." +msgstr "" + +#. module: warning_mrp +#: model:ir.model.fields.selection,name:warning_mrp.selection__product_template__mrp_production_warn__warning +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Warning" +msgstr "" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.mrp_production_form_view +msgid "Warning !!!!!" +msgstr "" + +#. module: warning_mrp +#. odoo-python +#: code:addons/warning_mrp/models/mrp_production.py:0 +#, python-format +msgid "Warning for %s" +msgstr "" + +#. module: warning_mrp +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_normal_form_view +#: model_terms:ir.ui.view,arch_db:warning_mrp.product_template_only_form_view +msgid "Warning when Manufacturing this Product" +msgstr "" diff --git a/warning_mrp/models/__init__.py b/warning_mrp/models/__init__.py new file mode 100644 index 00000000..0629d5b0 --- /dev/null +++ b/warning_mrp/models/__init__.py @@ -0,0 +1,2 @@ +from . import product_template +from . import mrp_production diff --git a/warning_mrp/models/mrp_production.py b/warning_mrp/models/mrp_production.py new file mode 100644 index 00000000..406a9d22 --- /dev/null +++ b/warning_mrp/models/mrp_production.py @@ -0,0 +1,53 @@ +# Copyright 2015 Oihane Crucelaegui - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +from odoo import _, api, fields, models + + +class MrpProduction(models.Model): + _inherit = "mrp.production" + + mrp_production_warn = fields.Selection( + string="Manufacturing Order", related="product_id.mrp_production_warn" + ) + mrp_production_warn_msg = fields.Text( + string="Message for Manufacturing Order", + related="product_id.mrp_production_warn_msg", + ) + + @api.onchange("product_id", "move_raw_ids") + def _onchange_product_id(self): + warning = {} + title = False + message = False + if self.product_id and self.product_id.mrp_production_warn != "no-message": + title = _("Warning for %s") % self.product_id.name + message = self.product_id.mrp_production_warn_msg + warning["title"] = title + warning["message"] = message + if self.product_id.mrp_production_warn == "block": + return { + "value": { + "product_id": False, + "bom_id": False, + "product_uom_id": False, + "product_uom_qty": 0, + }, + "warning": warning, + } + result = super()._onchange_product_id() + if result and "warning" in result and result.get("warning", False): + warning["title"] = ( + title + and title + " & " + result["warning"]["title"] + or result["warning"]["title"] + ) + warning["message"] = ( + message + and message + "\n\n" + result["warning"]["message"] + or result["warning"]["message"] + ) + if warning: + if result is None: + result = {} + result["warning"] = warning + return result diff --git a/warning_mrp/models/product_template.py b/warning_mrp/models/product_template.py new file mode 100644 index 00000000..3dd2e6b3 --- /dev/null +++ b/warning_mrp/models/product_template.py @@ -0,0 +1,18 @@ +# Copyright 2015 Oihane Crucelaegui - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +from odoo import fields, models + +from odoo.addons.base.models.res_partner import WARNING_HELP, WARNING_MESSAGE + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + mrp_production_warn = fields.Selection( + selection=WARNING_MESSAGE, + string="Manufacturing Order", + help=WARNING_HELP, + required=True, + default="no-message", + ) + mrp_production_warn_msg = fields.Text(string="Message for Manufacturing Order") diff --git a/warning_mrp/views/mrp_production_views.xml b/warning_mrp/views/mrp_production_views.xml new file mode 100644 index 00000000..20561f1e --- /dev/null +++ b/warning_mrp/views/mrp_production_views.xml @@ -0,0 +1,22 @@ + + + + mrp.production + + +

+ + + +

+
+
+
diff --git a/warning_mrp/views/product_product_views.xml b/warning_mrp/views/product_product_views.xml new file mode 100644 index 00000000..a6b644e9 --- /dev/null +++ b/warning_mrp/views/product_product_views.xml @@ -0,0 +1,26 @@ + + + + product.product + + + + + + + + + + + + + diff --git a/warning_mrp/views/product_template_views.xml b/warning_mrp/views/product_template_views.xml new file mode 100644 index 00000000..6c628292 --- /dev/null +++ b/warning_mrp/views/product_template_views.xml @@ -0,0 +1,22 @@ + + + + product.template + + + + + + + + + + + + +