From bc067ed3884da9c9a7a78e80f7ea85b138ffcddd Mon Sep 17 00:00:00 2001 From: Jinal Patel Date: Fri, 19 Jul 2019 10:26:25 +0000 Subject: [PATCH] [ADD] repair: add Tags field on Repair Order - add Configuration > Repair Orders Tags menu - Configuration menu should only be available for Stock/Manager task- 1945878 --- addons/repair/models/repair.py | 14 +++++++ addons/repair/security/ir.model.access.csv | 1 + addons/repair/views/repair_views.xml | 49 ++++++++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/addons/repair/models/repair.py b/addons/repair/models/repair.py index b9bc8e8fe7e..86094e3fcc4 100644 --- a/addons/repair/models/repair.py +++ b/addons/repair/models/repair.py @@ -108,6 +108,7 @@ class Repair(models.Model): company_id = fields.Many2one( 'res.company', 'Company', default=lambda self: self.env.company) + tag_ids = fields.Many2many('repair.tags', string="Tags") invoiced = fields.Boolean('Invoiced', copy=False, readonly=True) repaired = fields.Boolean('Repaired', copy=False, readonly=True) amount_untaxed = fields.Float('Untaxed Amount', compute='_amount_untaxed', store=True) @@ -725,3 +726,16 @@ class RepairFee(models.Model): return {'warning': warning} else: self.price_unit = price + + +class RepairTags(models.Model): + """ Tags of Repair's tasks """ + _name = "repair.tags" + _description = "Repair Tags" + + name = fields.Char('Tag Name', required=True) + color = fields.Integer(string='Color Index') + + _sql_constraints = [ + ('name_uniq', 'unique (name)', "Tag name already exists!"), + ] diff --git a/addons/repair/security/ir.model.access.csv b/addons/repair/security/ir.model.access.csv index 1a4c16a044f..eca832db8d3 100644 --- a/addons/repair/security/ir.model.access.csv +++ b/addons/repair/security/ir.model.access.csv @@ -1,6 +1,7 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_repair_fee_user,Repair Fee user,model_repair_fee,stock.group_stock_user,1,1,1,1 access_repair_user,Repair user,model_repair_order,stock.group_stock_user,1,1,1,1 +access_repair_tag_user,Repair Tags user,model_repair_tags,stock.group_stock_user,1,1,1,1 access_stock_production_lot_user,stock.production.lot user,stock.model_stock_production_lot,stock.group_stock_user,1,1,1,1 access_repair_line_user,repair.line user,model_repair_line,stock.group_stock_user,1,1,1,1 access_account_tax_user,account.tax,account.model_account_tax,stock.group_stock_user,1,1,1,1 diff --git a/addons/repair/views/repair_views.xml b/addons/repair/views/repair_views.xml index cf58577201f..42b24879a1b 100644 --- a/addons/repair/views/repair_views.xml +++ b/addons/repair/views/repair_views.xml @@ -78,6 +78,7 @@ + @@ -222,6 +223,7 @@
+
@@ -297,8 +299,55 @@ + + repair.tag.form + repair.tags + +
+ + + + + +
+
+
+ + + repair.tag.tree + repair.tags + + + + + + + + + repair.tag.search + repair.tags + + + + + + + + + Tags + repair.tags + +

+ Create a new tag +

+
+
+ + + +