diff --git a/mrp_tag/README.rst b/mrp_tag/README.rst new file mode 100644 index 000000000..d9faac118 --- /dev/null +++ b/mrp_tag/README.rst @@ -0,0 +1,78 @@ +================= +MRP Tags +================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/14.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-14-0/manufacture-14-0-mrp_tag + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/142/14.0 + :alt: Try me on Runbot + +|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 smashing 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 + +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..18094d635 --- /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": "14.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/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..77c1aab1e --- /dev/null +++ b/mrp_tag/models/mrp_tag.py @@ -0,0 +1,22 @@ +# 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 fields, models + + +class MrpTag(models.Model): + _name = "mrp.tag" + _description = "mrp Tag" + + def _get_default_color(self): + return randint(1, 11) + + name = fields.Char("Tag Name", required=True, translate=True) + color = fields.Integer("Color", default=_get_default_color) + + _sql_constraints = [ + ("tag_name_uniq", "unique (name)", "Tag name already exists !"), + ] diff --git a/mrp_tag/readme/CONTRIBUTORS.rst b/mrp_tag/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..205106e55 --- /dev/null +++ b/mrp_tag/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Jasmin Solanki diff --git a/mrp_tag/readme/DESCRIPTION.rst b/mrp_tag/readme/DESCRIPTION.rst new file mode 100644 index 000000000..c66d43dc8 --- /dev/null +++ b/mrp_tag/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module allows to add multiple tags to Manufacturing Orders diff --git a/mrp_tag/readme/USAGE.rst b/mrp_tag/readme/USAGE.rst new file mode 100644 index 000000000..88caa0bcc --- /dev/null +++ b/mrp_tag/readme/USAGE.rst @@ -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/views/mrp_production_view.xml b/mrp_tag/views/mrp_production_view.xml new file mode 100644 index 000000000..8c9920534 --- /dev/null +++ b/mrp_tag/views/mrp_production_view.xml @@ -0,0 +1,41 @@ + + + + + + + mrp.production.form + mrp.production + + + + + + + + + + mrp.production.tree + 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..488b53112 --- /dev/null +++ b/mrp_tag/views/mrp_tag_view.xml @@ -0,0 +1,59 @@ + + + + + + + mrp.tag.view.form + mrp.tag + +
+ +
+
+
+

+ +

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

+ Create new tags for your manufacture order +

+
+
+ + +
diff --git a/setup/mrp_tag/odoo/addons/mrp_tag b/setup/mrp_tag/odoo/addons/mrp_tag new file mode 120000 index 000000000..d19c57e0c --- /dev/null +++ b/setup/mrp_tag/odoo/addons/mrp_tag @@ -0,0 +1 @@ +../../../../mrp_tag \ No newline at end of file diff --git a/setup/mrp_tag/setup.py b/setup/mrp_tag/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_tag/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)