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

Requested reviews:
  Naresh(OpenERP) (nch-openerp)
Related bugs:
  Bug #938728 in OpenERP Addons: "invoice line unit price"
  https://bugs.launchpad.net/openobject-addons/+bug/938728

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-383843-skh/+merge/94348

Hello,

[Fix]: Invoice line unit price is wrong when change the UOM on Invoice line.

Scenario: 

1. Create a product "test" Set UOM as "tonne" and Cost Price :"1000"
2. Create a supplier invoice. Add a Invoice line with the "test" product.
3. Now change the UOM (eg: "tonne"), See RESULT : Unit price is Wrong.

This branch fixes this issue.

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-383843-skh/+merge/94348
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-383843-skh.
=== modified file 'account/invoice.py'
--- account/invoice.py	2012-02-14 13:02:47 +0000
+++ account/invoice.py	2012-02-23 11:17:19 +0000
@@ -1357,9 +1357,11 @@
             res_final['value']['price_unit'] = new_price
 
         if uom:
-            uom = self.pool.get('product.uom').browse(cr, uid, uom, context=context)
+            old_price = result ['price_unit'] # Need to check the product price according to the Invoice Type
+            prod_uom_obj = self.pool.get('product.uom')
+            uom = prod_uom_obj.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
+                new_price = prod_uom_obj._compute_price(cr, uid, res.uom_id.id, old_price, 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