Amit Dodiya (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-bug-716289-Robin into 
lp:openobject-addons/6.0.

Requested reviews:
  Priyesh (OpenERP) (pso-openerp)
Related bugs:
  Bug #716289 in OpenERP Addons: "Pricing Does Not Work When Multiple UOM On A 
Product"
  https://bugs.launchpad.net/openobject-addons/+bug/716289

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-bug-716289-Robin/+merge/64950
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-bug-716289-Robin/+merge/64950
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-bug-716289-Robin.
=== modified file 'product/pricelist.py'
--- product/pricelist.py	2011-04-21 07:45:29 +0000
+++ product/pricelist.py	2011-06-17 08:46:01 +0000
@@ -210,6 +210,12 @@
                 else:
                     categ_where = '(categ_id IS NULL)'
 
+                if 'uom' in context:
+                    sale_uom = context['uom']
+                    product_default_uom = product_template_obj.read(cr, uid, [tmpl_id], ['uom_id'])[0]['uom_id'][0]
+                if sale_uom and product_default_uom and product_default_uom != sale_uom:
+                        qty = product_uom_obj._compute_qty(cr, uid, sale_uom, qty, to_uom_id=product_default_uom)
+
                 cr.execute(
                     'SELECT i.*, pl.currency_id '
                     'FROM product_pricelist_item AS i, '
@@ -235,6 +241,7 @@
                                         qty, context=context)[res['base_pricelist_id']]
                                 ptype_src = self.browse(cr, uid, res['base_pricelist_id']).currency_id.id
                                 price = currency_obj.compute(cr, uid, ptype_src, res['currency_id'], price_tmp, round=False)
+                                uom_price_already_computed = True
                         elif res['base'] == -2:
                             # this section could be improved by moving the queries outside the loop:
                             where = []
@@ -285,7 +292,7 @@
                         # exception here because it breaks the search
                         price = False
 
-                if price:
+                if price and not uom_price_already_computed:
                     if 'uom' in context and not uom_price_already_computed:
                         product = products_dict[product_id]
                         uom = product.uos_id or product.uom_id

_______________________________________________
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