From cce5ad232cd0b0023a2d1a2130544024f033d7e8 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 6 May 2021 10:46:58 +0200 Subject: [PATCH] [IMP] rma: tags TT29594 --- rma/__manifest__.py | 1 + rma/models/__init__.py | 1 + rma/models/rma.py | 1 + rma/models/rma_tag.py | 21 +++++++++ rma/security/ir.model.access.csv | 2 + rma/views/rma_tag_views.xml | 76 ++++++++++++++++++++++++++++++++ rma/views/rma_views.xml | 7 +++ 7 files changed, 109 insertions(+) create mode 100644 rma/models/rma_tag.py create mode 100644 rma/views/rma_tag_views.xml diff --git a/rma/__manifest__.py b/rma/__manifest__.py index bc29c2ec..aa398b6c 100644 --- a/rma/__manifest__.py +++ b/rma/__manifest__.py @@ -27,6 +27,7 @@ "views/rma_portal_templates.xml", "views/rma_team_views.xml", "views/rma_views.xml", + "views/rma_tag_views.xml", "views/stock_picking_views.xml", "views/stock_warehouse_views.xml", "views/res_config_settings_views.xml", diff --git a/rma/models/__init__.py b/rma/models/__init__.py index 66a957a6..cc210923 100644 --- a/rma/models/__init__.py +++ b/rma/models/__init__.py @@ -3,6 +3,7 @@ from . import account_move from . import rma from . import rma_operation +from . import rma_tag from . import rma_team from . import res_company from . import res_config_settings diff --git a/rma/models/rma.py b/rma/models/rma.py index e2bf8fec..c125f93d 100644 --- a/rma/models/rma.py +++ b/rma/models/rma.py @@ -60,6 +60,7 @@ class Rma(models.Model): index=True, states={"locked": [("readonly", True)], "cancelled": [("readonly", True)]}, ) + tag_ids = fields.Many2many(comodel_name="rma.tag", string="Tags") company_id = fields.Many2one( comodel_name="res.company", default=lambda self: self.env.company, diff --git a/rma/models/rma_tag.py b/rma/models/rma_tag.py new file mode 100644 index 00000000..9f96059e --- /dev/null +++ b/rma/models/rma_tag.py @@ -0,0 +1,21 @@ +# Copyright 2021 Tecnativa - David Vidal +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class RmaTag(models.Model): + _description = "RMA Tags" + _name = "rma.tag" + _order = "name" + + active = fields.Boolean( + default=True, + help="The active field allows you to hide the category without " "removing it.", + ) + name = fields.Char(string="Tag Name", required=True, translate=True, copy=False,) + color = fields.Integer(string="Color Index") + rma_ids = fields.Many2many(comodel_name="rma") + + _sql_constraints = [ + ("name_uniq", "unique (name)", "Tag name already exists !"), + ] diff --git a/rma/security/ir.model.access.csv b/rma/security/ir.model.access.csv index 0afc4d55..ad209dc7 100644 --- a/rma/security/ir.model.access.csv +++ b/rma/security/ir.model.access.csv @@ -6,3 +6,5 @@ access_rma_user_own,rma.user.own,model_rma,rma_group_user_own,1,1,1,0 access_rma_manager,rma.manager,model_rma,rma_group_manager,1,1,1,1 access_rma_operation_user_own,rma.operation.user.own,model_rma_operation,rma_group_user_own,1,0,0,0 access_rma_operation_manager,rma.operation.manager,model_rma_operation,rma_group_manager,1,1,1,1 +access_rma_tag_user_own,rma.tag.user.own,model_rma_tag,rma_group_user_own,1,0,0,0 +access_rma_tag_manager,rma.tag.manager,model_rma_tag,rma_group_manager,1,1,1,1 diff --git a/rma/views/rma_tag_views.xml b/rma/views/rma_tag_views.xml new file mode 100644 index 00000000..78033211 --- /dev/null +++ b/rma/views/rma_tag_views.xml @@ -0,0 +1,76 @@ + + + + rma.tag + + + + + + + + + Rma Tags + rma.tag + +
+ +
+ +
+ + + +
+
+
+
+ + RMA Tags + rma.tag + + + + + + + + + + RMA Tags + ir.actions.act_window + rma.tag + +

+ Create a new RMA tag +

+ Manage RMA tags to better classify them for tracking and analysis purposes. +

+
+
+ +
diff --git a/rma/views/rma_views.xml b/rma/views/rma_views.xml index 5ac50e05..7147dd69 100644 --- a/rma/views/rma_views.xml +++ b/rma/views/rma_views.xml @@ -9,6 +9,7 @@ + +