Somesh Khare(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw-579984-WrongUnitPrice-skh into 
lp:openobject-addons/6.1.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-579984-WrongUnitPrice-skh/+merge/128239

Hello Sir,

[FIX]account_invoice: Unit price of the product will be wrong in invoice line 
when the default UOM will be of type bigger.

Note: Check this issue in Web client.
Steps: 
1. Create a product and set the default UOM as "tonne" and with sale price 100.
2. Create a Invoice and select the product and see the Unit price of the 
product it will be 100000.
It should be 100 because the UOM of the product is tonne.

This branch fixes this issue, Kindly review the branch and please share your 
views in it.

Thanks,
Somesh Khare

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-579984-WrongUnitPrice-skh/+merge/128239
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-579984-WrongUnitPrice-skh.
=== modified file 'account/account_invoice.py'
--- account/account_invoice.py	2012-08-20 15:52:57 +0000
+++ account/account_invoice.py	2012-10-05 12:42:24 +0000
@@ -1404,9 +1404,10 @@
             res_final['value']['price_unit'] = new_price
 
         if uom:
-            uom = self.pool.get('product.uom').browse(cr, uid, uom, context=context)
-            if res.uom_id.category_id.id == uom.category_id.id:
-                new_price = res_final['value']['price_unit'] * uom.factor_inv
+            uom_obj = self.pool.get('product.uom')
+            uom = uom_obj.browse(cr, uid, uom, context=context)
+            if res.uom_id.category_id.id == uom.category_id.id and res.uom_id.id != uom.id:
+                new_price = uom_obj._compute_price(cr, uid, res.uom_id.id, res_final['value']['price_unit'], uom.id)
                 res_final['value']['price_unit'] = new_price
         return res_final
 

_______________________________________________
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