diff --git a/mrp_tag/README.rst b/mrp_tag/README.rst new file mode 100644 index 000000000..857b3ca48 --- /dev/null +++ b/mrp_tag/README.rst @@ -0,0 +1,82 @@ +======== +MRP Tags +======== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:980944154e2337afc05a5a167eb2e360b8ac6948eebb8b455b6635a2563e5bb2 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fmanufacture-lightgray.png?logo=github + :target: https://github.com/OCA/manufacture/tree/17.0/mrp_tag + :alt: OCA/manufacture +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/manufacture-17-0/manufacture-17-0-mrp_tag + :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/manufacture&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to add multiple tags to Manufacturing Orders + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to go to Manufacture Order and select tag. + +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 +------- + +* ForgeFlow + +Contributors +------------ + +- Jasmin Solanki +- Arturo Arribas + +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/manufacture `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mrp_tag/__init__.py b/mrp_tag/__init__.py new file mode 100644 index 000000000..4b76c7b2d --- /dev/null +++ b/mrp_tag/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/mrp_tag/__manifest__.py b/mrp_tag/__manifest__.py new file mode 100644 index 000000000..fe9a1550d --- /dev/null +++ b/mrp_tag/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2022 ForgeFlow S.L. +# (http://www.forgeflow.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + "name": "MRP Tags", + "summary": "Allows to add multiple tags to Manufacturing Orders", + "version": "17.0.1.0.0", + "author": "ForgeFlow, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/manufacture", + "category": "Purchases", + "depends": ["mrp"], + "data": [ + "security/ir.model.access.csv", + "views/mrp_production_view.xml", + "views/mrp_tag_view.xml", + ], + "license": "AGPL-3", + "installable": True, + "application": False, +} diff --git a/mrp_tag/i18n/es.po b/mrp_tag/i18n/es.po new file mode 100644 index 000000000..6946c3b5a --- /dev/null +++ b/mrp_tag/i18n/es.po @@ -0,0 +1,117 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_tag +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-03-25 21:33+0000\n" +"Last-Translator: Ivorra78 \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: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__child_ids +msgid "Child" +msgstr "Hijo" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__color +msgid "Color" +msgstr "Color" + +#. module: mrp_tag +#: model_terms:ir.actions.act_window,help:mrp_tag.mrp_tag_action +msgid "Create new tags for your manufacture order" +msgstr "Crear nuevas etiquetas para su orden de fabricación" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__create_date +msgid "Created on" +msgstr "Creado el" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__id +msgid "ID" +msgstr "ID" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag____last_update +msgid "Last Modified on" +msgstr "Última Modificación el" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__write_uid +msgid "Last Updated by" +msgstr "Última Actualización por" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__write_date +msgid "Last Updated on" +msgstr "Última Actualización el" + +#. module: mrp_tag +#: model:ir.model,name:mrp_tag.model_mrp_tag +msgid "MRP Tag" +msgstr "Etiqueta MRP" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__parent_id +msgid "Parent" +msgstr "Parental" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__parent_path +msgid "Parent Path" +msgstr "Ruta Parental" + +#. module: mrp_tag +#: model:ir.model,name:mrp_tag.model_mrp_production +msgid "Production Order" +msgstr "Orden de Producción" + +#. module: mrp_tag +#: model_terms:ir.ui.view,arch_db:mrp_tag.view_mrp_production_filter +msgid "Tag" +msgstr "Etiqueta" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__name +msgid "Tag Name" +msgstr "Nombre de Etiqueta" + +#. module: mrp_tag +#: model:ir.model.constraint,message:mrp_tag.constraint_mrp_tag_tag_name_uniq +msgid "Tag name already exists !" +msgstr "¡Este nombre de etiqueta ya existe !" + +#. module: mrp_tag +#: model:ir.actions.act_window,name:mrp_tag.mrp_tag_action +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_production__tag_ids +#: model:ir.ui.menu,name:mrp_tag.menu_mrp_tag_config +#: model_terms:ir.ui.view,arch_db:mrp_tag.mrp_tag_view_form +msgid "Tags" +msgstr "Etiquetas" + +#. module: mrp_tag +#. odoo-python +#: code:addons/mrp_tag/models/mrp_tag.py:0 +#, python-format +msgid "Tags cannot be recursive." +msgstr "Las etiquetas no pueden ser recursivas." diff --git a/mrp_tag/i18n/it.po b/mrp_tag/i18n/it.po new file mode 100644 index 000000000..f32d173e8 --- /dev/null +++ b/mrp_tag/i18n/it.po @@ -0,0 +1,90 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_tag +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-12-19 14:44+0000\n" +"Last-Translator: mymage \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: mrp_tag +#: model_terms:ir.actions.act_window,help:mrp_tag.mrp_tag_action +msgid "Create new tags for your manufacture order" +msgstr "Crea nuove etichette per l'ordine di produzione" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__create_uid +msgid "Created by" +msgstr "Creato da" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__create_date +msgid "Created on" +msgstr "Creato il" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__id +msgid "ID" +msgstr "ID" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__write_uid +msgid "Last Updated by" +msgstr "Ultimo aggiornamento di" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__write_date +msgid "Last Updated on" +msgstr "Ultimo aggiornamento il" + +#. module: mrp_tag +#: model:ir.model,name:mrp_tag.model_mrp_tag +msgid "MRP Tag" +msgstr "Etichetta MRP" + +#. module: mrp_tag +#: model:ir.model,name:mrp_tag.model_mrp_production +msgid "Production Order" +msgstr "Ordine di produzione" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__color +msgid "Tag Color" +msgstr "Colore etichetta" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__name +msgid "Tag Name" +msgstr "Nome etichetta" + +#. module: mrp_tag +#: model:ir.model.constraint,message:mrp_tag.constraint_mrp_tag_tag_name_uniq +msgid "Tag name already exists !" +msgstr "Il nome etichetta esiste già!" + +#. module: mrp_tag +#: model:ir.actions.act_window,name:mrp_tag.mrp_tag_action +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_production__tag_ids +#: model:ir.ui.menu,name:mrp_tag.menu_mrp_tag_config +#: model_terms:ir.ui.view,arch_db:mrp_tag.mrp_tag_view_form +msgid "Tags" +msgstr "Etichette" diff --git a/mrp_tag/i18n/mrp_tag.pot b/mrp_tag/i18n/mrp_tag.pot new file mode 100644 index 000000000..b71f49b50 --- /dev/null +++ b/mrp_tag/i18n/mrp_tag.pot @@ -0,0 +1,114 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_tag +# +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: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__child_ids +msgid "Child" +msgstr "" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__color +msgid "Color" +msgstr "" + +#. module: mrp_tag +#: model_terms:ir.actions.act_window,help:mrp_tag.mrp_tag_action +msgid "Create new tags for your manufacture order" +msgstr "" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__create_uid +msgid "Created by" +msgstr "" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__create_date +msgid "Created on" +msgstr "" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__display_name +msgid "Display Name" +msgstr "" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__id +msgid "ID" +msgstr "" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag____last_update +msgid "Last Modified on" +msgstr "" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__write_date +msgid "Last Updated on" +msgstr "" + +#. module: mrp_tag +#: model:ir.model,name:mrp_tag.model_mrp_tag +msgid "MRP Tag" +msgstr "" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__parent_id +msgid "Parent" +msgstr "" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__parent_path +msgid "Parent Path" +msgstr "" + +#. module: mrp_tag +#: model:ir.model,name:mrp_tag.model_mrp_production +msgid "Production Order" +msgstr "" + +#. module: mrp_tag +#: model_terms:ir.ui.view,arch_db:mrp_tag.view_mrp_production_filter +msgid "Tag" +msgstr "" + +#. module: mrp_tag +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_tag__name +msgid "Tag Name" +msgstr "" + +#. module: mrp_tag +#: model:ir.model.constraint,message:mrp_tag.constraint_mrp_tag_tag_name_uniq +msgid "Tag name already exists !" +msgstr "" + +#. module: mrp_tag +#: model:ir.actions.act_window,name:mrp_tag.mrp_tag_action +#: model:ir.model.fields,field_description:mrp_tag.field_mrp_production__tag_ids +#: model:ir.ui.menu,name:mrp_tag.menu_mrp_tag_config +#: model_terms:ir.ui.view,arch_db:mrp_tag.mrp_tag_view_form +msgid "Tags" +msgstr "" + +#. module: mrp_tag +#. odoo-python +#: code:addons/mrp_tag/models/mrp_tag.py:0 +#, python-format +msgid "Tags cannot be recursive." +msgstr "" diff --git a/mrp_tag/models/__init__.py b/mrp_tag/models/__init__.py new file mode 100644 index 000000000..8eb5f3765 --- /dev/null +++ b/mrp_tag/models/__init__.py @@ -0,0 +1,2 @@ +from . import mrp_tag +from . import mrp_production diff --git a/mrp_tag/models/mrp_production.py b/mrp_tag/models/mrp_production.py new file mode 100644 index 000000000..8d1e4dd4b --- /dev/null +++ b/mrp_tag/models/mrp_production.py @@ -0,0 +1,17 @@ +# Copyright 2022 ForgeFlow S.L. +# (http://www.forgeflow.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class MrpProduction(models.Model): + _inherit = "mrp.production" + + tag_ids = fields.Many2many( + comodel_name="mrp.tag", + relation="mrp_production_tag_rel", + column1="mrp_production_id", + column2="tag_id", + string="Tags", + ) diff --git a/mrp_tag/models/mrp_tag.py b/mrp_tag/models/mrp_tag.py new file mode 100644 index 000000000..86159a4dc --- /dev/null +++ b/mrp_tag/models/mrp_tag.py @@ -0,0 +1,54 @@ +# Copyright 2022 ForgeFlow S.L. +# (http://www.forgeflow.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from random import randint + +from odoo import _, api, fields, models +from odoo.exceptions import ValidationError + + +class MrpTag(models.Model): + _name = "mrp.tag" + _description = "MRP Tag" + _parent_store = True + + def _get_default_color(self): + return randint(1, 11) + + name = fields.Char("Tag Name", required=True, translate=True) + color = fields.Integer(default=lambda self: self._get_default_color()) + parent_id = fields.Many2one("mrp.tag", index=True, ondelete="cascade") + child_ids = fields.One2many("mrp.tag", "parent_id") + parent_path = fields.Char(index=True, unaccent=False) + + _sql_constraints = [ + ("tag_name_uniq", "unique (name)", "Tag name already exists !"), + ] + + @api.depends("name", "parent_id") + def _compute_display_name(self): + for tag in self: + names = [] + current = tag + while current.name: + names.append(current.name) + current = current.parent_id + tag.display_name = " / ".join(reversed(names)) + + @api.model + def _name_search(self, name, domain=None, operator="ilike", limit=None, order=None): + if name: + domain = [("name", operator, name.split(" / ")[-1])] + list(domain or []) + return super()._name_search( + name=name, + domain=domain, + operator=operator, + limit=limit, + order=order, + ) + + @api.constrains("parent_id") + def _check_parent_recursion(self): + if not self._check_recursion("parent_id"): + raise ValidationError(_("Tags cannot be recursive.")) diff --git a/mrp_tag/pyproject.toml b/mrp_tag/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/mrp_tag/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/mrp_tag/readme/CONTRIBUTORS.md b/mrp_tag/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..69368a34f --- /dev/null +++ b/mrp_tag/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Jasmin Solanki \<\> +- Arturo Arribas \<\> diff --git a/mrp_tag/readme/DESCRIPTION.md b/mrp_tag/readme/DESCRIPTION.md new file mode 100644 index 000000000..c66d43dc8 --- /dev/null +++ b/mrp_tag/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module allows to add multiple tags to Manufacturing Orders diff --git a/mrp_tag/readme/USAGE.md b/mrp_tag/readme/USAGE.md new file mode 100644 index 000000000..88caa0bcc --- /dev/null +++ b/mrp_tag/readme/USAGE.md @@ -0,0 +1 @@ +To use this module, you need to go to Manufacture Order and select tag. diff --git a/mrp_tag/security/ir.model.access.csv b/mrp_tag/security/ir.model.access.csv new file mode 100644 index 000000000..7b52950a3 --- /dev/null +++ b/mrp_tag/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_mrp_tag,mrp_tag,model_mrp_tag,base.group_user,1,0,0,0 +access_mrp_tag_manager,mrp_tag_manager,model_mrp_tag,mrp.group_mrp_manager,1,1,1,1 diff --git a/mrp_tag/static/description/icon.png b/mrp_tag/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/mrp_tag/static/description/icon.png differ diff --git a/mrp_tag/static/description/index.html b/mrp_tag/static/description/index.html new file mode 100644 index 000000000..96d855eef --- /dev/null +++ b/mrp_tag/static/description/index.html @@ -0,0 +1,429 @@ + + + + + +MRP Tags + + + +
+

MRP Tags

+ + +

Beta License: AGPL-3 OCA/manufacture Translate me on Weblate Try me on Runboat

+

This module allows to add multiple tags to Manufacturing Orders

+

Table of contents

+ +
+

Usage

+

To use this module, you need to go to Manufacture Order and select tag.

+
+
+

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

+
    +
  • ForgeFlow
  • +
+
+
+

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/manufacture project on GitHub.

+

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

+
+
+
+ + diff --git a/mrp_tag/views/mrp_production_view.xml b/mrp_tag/views/mrp_production_view.xml new file mode 100644 index 000000000..833419a66 --- /dev/null +++ b/mrp_tag/views/mrp_production_view.xml @@ -0,0 +1,55 @@ + + + + + + + mrp.production.form + mrp.production + + + + + + + + + + mrp.production.tree + mrp.production + + + + + + + + + + mrp.production.search + mrp.production + + + + + + + + + diff --git a/mrp_tag/views/mrp_tag_view.xml b/mrp_tag/views/mrp_tag_view.xml new file mode 100644 index 000000000..03a73f5bd --- /dev/null +++ b/mrp_tag/views/mrp_tag_view.xml @@ -0,0 +1,61 @@ + + + + + + + mrp.tag.view.form + mrp.tag + +
+ +
+
+
+

+ +

+
+ + + + + + +
+
+
+
+ + + mrp.tag.view.tree + mrp.tag + + + + + + + + + + + Tags + mrp.tag + + +

+ Create new tags for your manufacture order +

+
+
+ + +