Browse Source

[IMP] add scale category model and m2one field on product to this new

model
pull/21/head
houssine 7 years ago
parent
commit
54e70572d2
  1. 12
      beesdoo_product/models/beesdoo_product.py
  2. 2
      beesdoo_product/security/ir.model.access.csv
  3. 35
      beesdoo_product/views/beesdoo_product.xml

12
beesdoo_product/models/beesdoo_product.py

@ -37,6 +37,8 @@ class BeesdooProduct(models.Model):
scale_label_info_1 = fields.Char(string="Scale lable info 1")
scale_label_info_2 = fields.Char(string="Scale lable info 2")
scale_sale_unit = fields.Char(compute="_get_scale_sale_uom", string="Scale sale unit", store=True)
scale_category = fields.Many2one('beesdoo.scale.category', string="Scale Category")
scale_category_code = fields.Integer(related='scale_category.code', string="Scale category code", readonly=True, store=True)
@api.depends('uom_id','uom_id.category_id','uom_id.category_id.type')
@api.multi
@ -111,6 +113,16 @@ class BeesdooProduct(models.Model):
if(len(suppliers) > 0):
self.suggested_price = (suppliers[0].price * self.uom_po_id.factor)* (1 + suppliers[0].product_tmpl_id.categ_id.profit_margin / 100)
class BeesdooScaleCategory(models.Model):
_name = "beesdoo.scale.category"
name = fields.Char(string="Scale name category")
code = fields.Integer(string="Category code")
_sql_constraints = [
('code_scale_categ_uniq', 'unique (code)', 'The code of the scale category must be unique !')
]
class BeesdooProductLabel(models.Model):
_name = "beesdoo.product.label"

2
beesdoo_product/security/ir.model.access.csv

@ -1,3 +1,5 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
beesdoo_product_label_read_all,beesdoo.product.label Read All,model_beesdoo_product_label,,1,0,0,0
beesdoo_product_label_all_access_sale_manager,beesdoo.product.label All Access Sale Manager,model_beesdoo_product_label,base.group_sale_manager,1,1,1,1
beesdoo_scale_category_read_all,beesdoo.scale.category Read All,model_beesdoo_scale_category,,1,0,0,0
beesdoo_scale_categoryl_all_access_sale_manager,beesdoo.scale.category All Access Sale Manager,model_beesdoo_scale_category,base.group_sale_manager,1,1,1,0

35
beesdoo_product/views/beesdoo_product.xml

@ -63,6 +63,8 @@
</group>
<group>
<field name="scale_sale_unit"/>
<field name="scale_category" widget="selection"/>
<field name="scale_category_code"/>
</group>
</group>
</page>
@ -150,4 +152,37 @@
</field>
</field>
</record>
<record model="ir.ui.view" id="beesdoo_scale_category_list">
<field name="name">beesdoo.scale.category.list</field>
<field name="model">beesdoo.scale.category</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="code"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="beesdoo_scale_category_form">
<field name="name">beesdoo.scale.category.form</field>
<field name="model">beesdoo.scale.category</field>
<field name="arch" type="xml">
<form>
<group>
<field name="name"/>
<field name="code"/>
</group>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_scale_categories">
<field name="name">Scale categories</field>
<field name="res_model">beesdoo.scale.category</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="scale_categories_configuration_menu" name="Scale categories" parent="product.prod_config_main"
action="action_scale_categories" sequence="15"/>
</odoo>
Loading…
Cancel
Save