[IMP] rma: tags

TT29594
This commit is contained in:
david
2021-05-06 10:46:58 +02:00
committed by Nikolaus Weingartmair
parent ef48e86c4b
commit cce5ad232c
7 changed files with 109 additions and 0 deletions

View File

@@ -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

View File

@@ -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,

21
rma/models/rma_tag.py Normal file
View File

@@ -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 !"),
]