[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
This commit is contained in:
@@ -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!"),
|
||||
]
|
||||
|
||||
@@ -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
|
||||
|
||||
|
@@ -78,6 +78,7 @@
|
||||
<field name="invoice_method"/>
|
||||
<field name="partner_invoice_id" attrs="{'invisible':[('invoice_method','=', 'none')],'required':[('invoice_method','!=','none')]}" groups="sale.group_delivery_invoice_address"/>
|
||||
<field name="pricelist_id" groups="product.group_sale_pricelist" context="{'product_id':product_id}" attrs="{'invisible':[('invoice_method','=', 'none')]}"/>
|
||||
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True}"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
@@ -222,6 +223,7 @@
|
||||
<div class="row">
|
||||
<div class="col-6 text-muted">
|
||||
<span><t t-esc="record.product_id.value"/></span>
|
||||
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<span class="float-right">
|
||||
@@ -297,8 +299,55 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_repair_tag_form" model="ir.ui.view">
|
||||
<field name="name">repair.tag.form</field>
|
||||
<field name="model">repair.tags</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Repair Tags">
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_repair_tag_tree" model="ir.ui.view">
|
||||
<field name="name">repair.tag.tree</field>
|
||||
<field name="model">repair.tags</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Tags" editable="bottom">
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_repair_tag_search" model="ir.ui.view">
|
||||
<field name="name">repair.tag.search</field>
|
||||
<field name="model">repair.tags</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Tags">
|
||||
<field name="name"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_repair_order_tag" model="ir.actions.act_window">
|
||||
<field name="name">Tags</field>
|
||||
<field name="res_model">repair.tags</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
Create a new tag
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_repair_order_tree" id="menu_repair_order" groups="stock.group_stock_user" name="Repairs" sequence="36"
|
||||
web_icon="repair,static/description/icon.png"/>
|
||||
|
||||
<menuitem id="repair_menu_config" name="Configuration" parent="menu_repair_order" groups="stock.group_stock_manager"/>
|
||||
|
||||
<menuitem id="repair_menu_tag" name="Repair Orders Tags" parent="repair_menu_config" action="action_repair_order_tag"/>
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user