Merge lp:~openerp-dev/openobject-addons/6.0-bug-716289-Robin into lp:openobject-addons/6.0

Proposed by Amit Dodiya (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-bug-716289-Robin
Merge into: lp:openobject-addons/6.0
Diff against target: 33 lines (+8/-1)
1 file modified
product/pricelist.py (+8/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-bug-716289-Robin
Reviewer Review Type Date Requested Status
Priyesh (OpenERP) Pending
Review via email: mp+64950@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

4659. By Robin

[FIX]: Pricing does not work when multiple UOM on a Product

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'product/pricelist.py'
2--- product/pricelist.py 2011-04-21 07:45:29 +0000
3+++ product/pricelist.py 2011-06-17 08:46:01 +0000
4@@ -210,6 +210,12 @@
5 else:
6 categ_where = '(categ_id IS NULL)'
7
8+ if 'uom' in context:
9+ sale_uom = context['uom']
10+ product_default_uom = product_template_obj.read(cr, uid, [tmpl_id], ['uom_id'])[0]['uom_id'][0]
11+ if sale_uom and product_default_uom and product_default_uom != sale_uom:
12+ qty = product_uom_obj._compute_qty(cr, uid, sale_uom, qty, to_uom_id=product_default_uom)
13+
14 cr.execute(
15 'SELECT i.*, pl.currency_id '
16 'FROM product_pricelist_item AS i, '
17@@ -235,6 +241,7 @@
18 qty, context=context)[res['base_pricelist_id']]
19 ptype_src = self.browse(cr, uid, res['base_pricelist_id']).currency_id.id
20 price = currency_obj.compute(cr, uid, ptype_src, res['currency_id'], price_tmp, round=False)
21+ uom_price_already_computed = True
22 elif res['base'] == -2:
23 # this section could be improved by moving the queries outside the loop:
24 where = []
25@@ -285,7 +292,7 @@
26 # exception here because it breaks the search
27 price = False
28
29- if price:
30+ if price and not uom_price_already_computed:
31 if 'uom' in context and not uom_price_already_computed:
32 product = products_dict[product_id]
33 uom = product.uos_id or product.uom_id