[IMP]product: removed unnecessary code from onchange_product_tmpl_id and improved indentation in template form view.

bzr revid: dka@tinyerp.com-20140117110544-y7lc0t2xc0bb6403
This commit is contained in:
Darshan Kalola (OpenERP)
2014-01-17 16:35:44 +05:30
parent 19bc4842c5
commit 82cdf9e4c0
2 changed files with 8 additions and 14 deletions
+2 -4
View File
@@ -727,15 +727,13 @@ class product_product(osv.osv):
return {'value': {'uom_po_id': uom_id}}
return False
def onchange_product_tmpl_id(self, cr, uid, ids, template_id, lst_price, price_margin, price_extra, context=None):
def onchange_product_tmpl_id(self, cr, uid, ids, template_id, context=None):
res = {}
if template_id:
template = self.pool.get('product.template').browse(cr, uid, template_id, context=context)
if not lst_price:
lst_price = template.list_price + ((template.list_price * price_margin) + price_extra)
res['value'] = {
'name': template.name,
'lst_price': lst_price,
'lst_price': template.list_price,
}
return res
+6 -10
View File
@@ -61,16 +61,13 @@
<form string="Product" version="7.0">
<sheet>
<field name="image_medium" widget="image" class="oe_avatar oe_left"/>
<field name="lst_price" invisible="1"/>
<field name="price_extra" invisible="1"/>
<field name="price_margin" invisible="1"/>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name" name='label_name' string="Product Name"/>
</div>
<h1>
<field name="name" class="oe_inline"/>
<field name="product_tmpl_id" groups="product.group_product_variant" on_change="onchange_product_tmpl_id(product_tmpl_id,lst_price,price_margin,price_extra)" class="oe_inline"/>
<field name="product_tmpl_id" groups="product.group_product_variant" on_change="onchange_product_tmpl_id(product_tmpl_id)" class="oe_inline"/>
<span attrs="{'invisible':[('variants','=',False)]}" groups="product.group_product_variant"> - </span>
<field name="variants" placeholder="Variant Name" groups="product.group_product_variant" class="oe_inline" readonly="0"/>
</h1>
@@ -725,8 +722,7 @@
<field name="active"/>
<field name="variants" required="1"/>
<field name="default_code"/>
<label for="price_margin"/>
<field name="price_margin" class="oe_inline"/>
<field name="price_margin"/>
<field name="price_extra"/>
</group>
</form>
@@ -841,12 +837,12 @@
<page string="Information">
<group colspan="4">
<group>
<field name="type"/>
<field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)" groups="product.group_uom"/>
<field name="list_price"/>
<field name="type"/>
<field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)" groups="product.group_uom"/>
<field name="list_price"/>
</group>
<group>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
</group>
<group colspan="4" string="Product Variants" groups="product.group_product_variant">