[IMP]product: removed unnecessary code from onchange_product_tmpl_id and improved...
authorDarshan Kalola (OpenERP) <dka@tinyerp.com>
Fri, 17 Jan 2014 11:05:44 +0000 (16:35 +0530)
committerDarshan Kalola (OpenERP) <dka@tinyerp.com>
Fri, 17 Jan 2014 11:05:44 +0000 (16:35 +0530)
bzr revid: dka@tinyerp.com-20140117110544-y7lc0t2xc0bb6403

addons/product/product.py
addons/product/product_view.xml

index 6e0b01c..2e7eb3c 100644 (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
 
index d39a2d9..eedbda8 100644 (file)
                 <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>
                         <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>
                             <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">