From 7c136249551a5cea3fdea50728fa03ab6462adfd Mon Sep 17 00:00:00 2001 From: Alfredo Date: Thu, 14 Nov 2024 08:48:56 +0100 Subject: [PATCH] [16.0][ADD] mrp_workorder_scrap_button: In Work order form view new button "Scrap". --- mrp_workorder_scrap_button/README.rst | 29 +++++++++++++++ mrp_workorder_scrap_button/__init__.py | 1 + mrp_workorder_scrap_button/__manifest__.py | 15 ++++++++ mrp_workorder_scrap_button/i18n/ca_ES.po | 27 ++++++++++++++ mrp_workorder_scrap_button/i18n/en_GB.po | 27 ++++++++++++++ mrp_workorder_scrap_button/i18n/es.po | 27 ++++++++++++++ mrp_workorder_scrap_button/i18n/fr.po | 27 ++++++++++++++ .../i18n/mrp_workorder_scrap_button.pot | 27 ++++++++++++++ mrp_workorder_scrap_button/models/__init__.py | 1 + .../models/mrp_workorder.py | 17 +++++++++ .../views/mrp_workorder_views.xml | 35 +++++++++++++++++++ .../odoo/addons/mrp_workorder_scrap_button | 1 + setup/mrp_workorder_scrap_button/setup.py | 6 ++++ 13 files changed, 240 insertions(+) create mode 100644 mrp_workorder_scrap_button/README.rst create mode 100644 mrp_workorder_scrap_button/__init__.py create mode 100644 mrp_workorder_scrap_button/__manifest__.py create mode 100644 mrp_workorder_scrap_button/i18n/ca_ES.po create mode 100644 mrp_workorder_scrap_button/i18n/en_GB.po create mode 100644 mrp_workorder_scrap_button/i18n/es.po create mode 100644 mrp_workorder_scrap_button/i18n/fr.po create mode 100644 mrp_workorder_scrap_button/i18n/mrp_workorder_scrap_button.pot create mode 100644 mrp_workorder_scrap_button/models/__init__.py create mode 100644 mrp_workorder_scrap_button/models/mrp_workorder.py create mode 100644 mrp_workorder_scrap_button/views/mrp_workorder_views.xml create mode 120000 setup/mrp_workorder_scrap_button/odoo/addons/mrp_workorder_scrap_button create mode 100644 setup/mrp_workorder_scrap_button/setup.py diff --git a/mrp_workorder_scrap_button/README.rst b/mrp_workorder_scrap_button/README.rst new file mode 100644 index 000000000..1608094be --- /dev/null +++ b/mrp_workorder_scrap_button/README.rst @@ -0,0 +1,29 @@ +.. 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 Workorder scrap button +========================== + +* In Work order form view new button "Scrap", and in work order tree view + new icon "Scrap". + +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 +------------ + +* Ana Juaristi +* Alfredo de la Fuente diff --git a/mrp_workorder_scrap_button/__init__.py b/mrp_workorder_scrap_button/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/mrp_workorder_scrap_button/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/mrp_workorder_scrap_button/__manifest__.py b/mrp_workorder_scrap_button/__manifest__.py new file mode 100644 index 000000000..0e164bd13 --- /dev/null +++ b/mrp_workorder_scrap_button/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2024 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "Mrp Workorder Scrap Button", + "version": "16.0.1.0.0", + "author": "Avanzosc", + "website": "https://github.com/avanzosc/mrp-addons", + "category": "Manufacturing/Manufacturing", + "license": "AGPL-3", + "depends": ["mrp"], + "data": [ + "views/mrp_workorder_views.xml", + ], + "installable": True, +} diff --git a/mrp_workorder_scrap_button/i18n/ca_ES.po b/mrp_workorder_scrap_button/i18n/ca_ES.po new file mode 100644 index 000000000..6af131837 --- /dev/null +++ b/mrp_workorder_scrap_button/i18n/ca_ES.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_workorder_scrap_button +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-14 07:43+0000\n" +"PO-Revision-Date: 2024-11-14 07:43+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: mrp_workorder_scrap_button +#: model_terms:ir.ui.view,arch_db:mrp_workorder_scrap_button.mrp_production_workorder_form_view_inherit +#: model_terms:ir.ui.view,arch_db:mrp_workorder_scrap_button.mrp_production_workorder_tree_editable_view +msgid "Scrap" +msgstr "" + +#. module: mrp_workorder_scrap_button +#: model:ir.model,name:mrp_workorder_scrap_button.model_mrp_workorder +msgid "Work Order" +msgstr "Ordre de treball" diff --git a/mrp_workorder_scrap_button/i18n/en_GB.po b/mrp_workorder_scrap_button/i18n/en_GB.po new file mode 100644 index 000000000..c8226b489 --- /dev/null +++ b/mrp_workorder_scrap_button/i18n/en_GB.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_workorder_scrap_button +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-14 07:43+0000\n" +"PO-Revision-Date: 2024-11-14 07:43+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: mrp_workorder_scrap_button +#: model_terms:ir.ui.view,arch_db:mrp_workorder_scrap_button.mrp_production_workorder_form_view_inherit +#: model_terms:ir.ui.view,arch_db:mrp_workorder_scrap_button.mrp_production_workorder_tree_editable_view +msgid "Scrap" +msgstr "" + +#. module: mrp_workorder_scrap_button +#: model:ir.model,name:mrp_workorder_scrap_button.model_mrp_workorder +msgid "Work Order" +msgstr "" diff --git a/mrp_workorder_scrap_button/i18n/es.po b/mrp_workorder_scrap_button/i18n/es.po new file mode 100644 index 000000000..63d4fb5f0 --- /dev/null +++ b/mrp_workorder_scrap_button/i18n/es.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_workorder_scrap_button +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-14 07:44+0000\n" +"PO-Revision-Date: 2024-11-14 07:44+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: mrp_workorder_scrap_button +#: model_terms:ir.ui.view,arch_db:mrp_workorder_scrap_button.mrp_production_workorder_form_view_inherit +#: model_terms:ir.ui.view,arch_db:mrp_workorder_scrap_button.mrp_production_workorder_tree_editable_view +msgid "Scrap" +msgstr "Desechar" + +#. module: mrp_workorder_scrap_button +#: model:ir.model,name:mrp_workorder_scrap_button.model_mrp_workorder +msgid "Work Order" +msgstr "Orden de trabajo" diff --git a/mrp_workorder_scrap_button/i18n/fr.po b/mrp_workorder_scrap_button/i18n/fr.po new file mode 100644 index 000000000..bdc58b582 --- /dev/null +++ b/mrp_workorder_scrap_button/i18n/fr.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_workorder_scrap_button +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-14 07:44+0000\n" +"PO-Revision-Date: 2024-11-14 07:44+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: mrp_workorder_scrap_button +#: model_terms:ir.ui.view,arch_db:mrp_workorder_scrap_button.mrp_production_workorder_form_view_inherit +#: model_terms:ir.ui.view,arch_db:mrp_workorder_scrap_button.mrp_production_workorder_tree_editable_view +msgid "Scrap" +msgstr "" + +#. module: mrp_workorder_scrap_button +#: model:ir.model,name:mrp_workorder_scrap_button.model_mrp_workorder +msgid "Work Order" +msgstr "Ordre de travail" diff --git a/mrp_workorder_scrap_button/i18n/mrp_workorder_scrap_button.pot b/mrp_workorder_scrap_button/i18n/mrp_workorder_scrap_button.pot new file mode 100644 index 000000000..c8226b489 --- /dev/null +++ b/mrp_workorder_scrap_button/i18n/mrp_workorder_scrap_button.pot @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_workorder_scrap_button +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-14 07:43+0000\n" +"PO-Revision-Date: 2024-11-14 07:43+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: mrp_workorder_scrap_button +#: model_terms:ir.ui.view,arch_db:mrp_workorder_scrap_button.mrp_production_workorder_form_view_inherit +#: model_terms:ir.ui.view,arch_db:mrp_workorder_scrap_button.mrp_production_workorder_tree_editable_view +msgid "Scrap" +msgstr "" + +#. module: mrp_workorder_scrap_button +#: model:ir.model,name:mrp_workorder_scrap_button.model_mrp_workorder +msgid "Work Order" +msgstr "" diff --git a/mrp_workorder_scrap_button/models/__init__.py b/mrp_workorder_scrap_button/models/__init__.py new file mode 100644 index 000000000..ddc78464d --- /dev/null +++ b/mrp_workorder_scrap_button/models/__init__.py @@ -0,0 +1 @@ +from . import mrp_workorder diff --git a/mrp_workorder_scrap_button/models/mrp_workorder.py b/mrp_workorder_scrap_button/models/mrp_workorder.py new file mode 100644 index 000000000..276cb3cf7 --- /dev/null +++ b/mrp_workorder_scrap_button/models/mrp_workorder.py @@ -0,0 +1,17 @@ +# Copyright 2024 Alfredo de la Fuente - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +from odoo import models + + +class MrpWorkorder(models.Model): + _inherit = "mrp.workorder" + + def button_scrap(self): + self.ensure_one() + result = super().button_scrap() + result["context"]["product_ids"] = ( + self.move_raw_ids.filtered(lambda x: x.state not in ("done", "cancel")) + .mapped("product_id") + .ids + ) + return result diff --git a/mrp_workorder_scrap_button/views/mrp_workorder_views.xml b/mrp_workorder_scrap_button/views/mrp_workorder_views.xml new file mode 100644 index 000000000..c9f1f5b85 --- /dev/null +++ b/mrp_workorder_scrap_button/views/mrp_workorder_views.xml @@ -0,0 +1,35 @@ + + + mrp.workorder + + + + + + + diff --git a/setup/mrp_workorder_scrap_button/odoo/addons/mrp_workorder_scrap_button b/setup/mrp_workorder_scrap_button/odoo/addons/mrp_workorder_scrap_button new file mode 120000 index 000000000..eebfcb7e8 --- /dev/null +++ b/setup/mrp_workorder_scrap_button/odoo/addons/mrp_workorder_scrap_button @@ -0,0 +1 @@ +../../../../mrp_workorder_scrap_button \ No newline at end of file diff --git a/setup/mrp_workorder_scrap_button/setup.py b/setup/mrp_workorder_scrap_button/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_workorder_scrap_button/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)