[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

@@ -27,6 +27,7 @@
"views/rma_portal_templates.xml", "views/rma_portal_templates.xml",
"views/rma_team_views.xml", "views/rma_team_views.xml",
"views/rma_views.xml", "views/rma_views.xml",
"views/rma_tag_views.xml",
"views/stock_picking_views.xml", "views/stock_picking_views.xml",
"views/stock_warehouse_views.xml", "views/stock_warehouse_views.xml",
"views/res_config_settings_views.xml", "views/res_config_settings_views.xml",

View File

@@ -3,6 +3,7 @@
from . import account_move from . import account_move
from . import rma from . import rma
from . import rma_operation from . import rma_operation
from . import rma_tag
from . import rma_team from . import rma_team
from . import res_company from . import res_company
from . import res_config_settings from . import res_config_settings

View File

@@ -60,6 +60,7 @@ class Rma(models.Model):
index=True, index=True,
states={"locked": [("readonly", True)], "cancelled": [("readonly", True)]}, states={"locked": [("readonly", True)], "cancelled": [("readonly", True)]},
) )
tag_ids = fields.Many2many(comodel_name="rma.tag", string="Tags")
company_id = fields.Many2one( company_id = fields.Many2one(
comodel_name="res.company", comodel_name="res.company",
default=lambda self: self.env.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 !"),
]

View File

@@ -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_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_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_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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
6 access_rma_manager rma.manager model_rma rma_group_manager 1 1 1 1
7 access_rma_operation_user_own rma.operation.user.own model_rma_operation rma_group_user_own 1 0 0 0
8 access_rma_operation_manager rma.operation.manager model_rma_operation rma_group_manager 1 1 1 1
9 access_rma_tag_user_own rma.tag.user.own model_rma_tag rma_group_user_own 1 0 0 0
10 access_rma_tag_manager rma.tag.manager model_rma_tag rma_group_manager 1 1 1 1

View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="rma_tag_view_search" model="ir.ui.view">
<field name="model">rma.tag</field>
<field name="arch" type="xml">
<search string="RMA Tags">
<filter
string="Archived"
name="inactive"
domain="[('active','=',False)]"
/>
<filter
string="Active"
name="active"
domain="[('active','!=',False)]"
/>
</search>
</field>
</record>
<record id="view_rma_tag_form" model="ir.ui.view">
<field name="name">Rma Tags</field>
<field name="model">rma.tag</field>
<field name="arch" type="xml">
<form string="RMA Tag">
<sheet>
<div class="oe_button_box" name="button_box">
<button
class="oe_stat_button"
type="object"
name="toggle_active"
icon="fa-archive"
>
<field
name="active"
widget="boolean_button"
options='{"terminology": "archive"}'
/>
</button>
</div>
<group>
<field name="name" />
</group>
</sheet>
</form>
</field>
</record>
<record id="view_rma_tag_list" model="ir.ui.view">
<field name="name">RMA Tags</field>
<field name="model">rma.tag</field>
<field eval="6" name="priority" />
<field name="arch" type="xml">
<tree string="RMA Tags">
<field name="name" />
<field name="active" />
</tree>
</field>
</record>
<record id="action_rma_tag" model="ir.actions.act_window">
<field name="name">RMA Tags</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">rma.tag</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new RMA tag
</p><p>
Manage RMA tags to better classify them for tracking and analysis purposes.
</p>
</field>
</record>
<menuitem
id="rma_configuration_rma_tag_menu"
name="RMA Tags"
parent="rma_configuration_menu"
action="action_rma_tag"
/>
</odoo>

View File

@@ -9,6 +9,7 @@
<search> <search>
<field name="name" /> <field name="name" />
<field name="user_id" /> <field name="user_id" />
<field name="tag_ids" />
<filter <filter
name="draft_filter" name="draft_filter"
string="Draft" string="Draft"
@@ -267,6 +268,12 @@
<field name="date" /> <field name="date" />
<field name="user_id" /> <field name="user_id" />
<field name="team_id" /> <field name="team_id" />
<field
name="tag_ids"
widget="many2many_tags"
options="{'color_field': 'color', 'no_create_edit': True}"
placeholder="Tags..."
/>
<field name="origin" /> <field name="origin" />
<field name="operation_id" /> <field name="operation_id" />
<field <field