Amit Bhavsar (Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-979672-amb into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #979672 in OpenERP Addons: "hr_expense UoM not changing"
  https://bugs.launchpad.net/openobject-addons/+bug/979672

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-979672-amb/+merge/101728

Hello,

Fixes the problem of UOM where onchange call "onchange_product_id" in Expanse 
lines.


Thanks


-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-979672-amb/+merge/101728
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-979672-amb.
=== modified file 'hr_expense/hr_expense.py'
--- hr_expense/hr_expense.py	2012-03-30 09:08:37 +0000
+++ hr_expense/hr_expense.py	2012-04-12 12:42:43 +0000
@@ -272,16 +272,16 @@
     }
     _order = "sequence, date_value desc"
 
-    def onchange_product_id(self, cr, uid, ids, product_id, uom_id, employee_id, context=None):
-        res = {}
+    def onchange_product_id(self, cr, uid, ids, product_id,unit_amount,context=None):
+        product_obj = self.pool.get('product.product')
+        uom_id = False
+        amount_unit = False
+        res={}
         if product_id:
-            product = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
-            res['name'] = product.name
-            amount_unit = product.price_get('standard_price')[product.id]
-            res['unit_amount'] = amount_unit
-            if not uom_id:
-                res['uom_id'] = product.uom_id.id
-        return {'value': res}
+           product = product_obj.browse(cr, uid, product_id, context=context)
+           uom_id = product.uom_id.id
+           amount_unit = product.price_get('standard_price')[product.id]
+        return {'value':{'uom_id':uom_id,'unit_amount':amount_unit}}
 
 hr_expense_line()
 

=== modified file 'hr_expense/hr_expense_view.xml'
--- hr_expense/hr_expense_view.xml	2012-03-22 17:23:05 +0000
+++ hr_expense/hr_expense_view.xml	2012-04-12 12:42:43 +0000
@@ -81,12 +81,12 @@
                             <field colspan="4" name="line_ids" nolabel="1" context="{'currency_id': currency_id}">
                                 <form string="Expense Lines">
                                     <group col="6" colspan="4">
-                                        <field name="product_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id, context)"/>
+                                        <field name="product_id" on_change="onchange_product_id(product_id, amount_unit)"/>
                                         <field name="name" colspan="4"/>
                                         <newline/>
                                         <field name="unit_amount"/>
                                         <field name="unit_quantity"/>
-                                        <field name="uom_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id, context)"/>
+                                        <field name="uom_id"/>
                                     </group>
                                     <group colspan="2" col="2" groups="analytic.group_analytic_accounting">
                                         <separator string="Customer Project" colspan="2"/>

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to