c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #25273
[Bug 715682] Re: Prices are not correctly returned by price_get_multi method from product\pricelist.py
Hello,
For my opinion there is an error in price_get_multi. If there are passed
more than 1 pricelists always the price of the first pricelist-version
is returned. This is because of plversion_ids[0].
Here is my suggested patch:
--- pricelist.py.bak 2011-05-03 15:53:55.213832201 +0200
+++ pricelist.py 2011-05-11 15:26:47.948970453 +0200
@@ -184,6 +184,11 @@
msg = "At least one pricelist has no active version !\nPlease create or activate one."
raise osv.except_osv(_('Warning !'), _(msg))
+ versions = product_pricelist_version_obj.read(cr, uid, plversion_ids, ['pricelist_id','id'])
+ plversions_dict = {}
+ for v in versions:
+ plversions_dict[v['pricelist_id'][0]] = v['id']
+
# product.product:
product_ids = [i[0] for i in products_by_qty_by_partner]
#products = dict([(item['id'], item) for item in product_obj.read(cr, uid, product_ids, ['categ_id', 'product_tmpl_id', 'uos_id', 'uom_id'])])
@@ -220,7 +225,7 @@
'AND (min_quantity IS NULL OR min_quantity <= %s) '
'AND i.price_version_id = v.id AND v.pricelist_id = pl.id '
'ORDER BY sequence',
- (tmpl_id, product_id, plversion_ids[0], qty))
+ (tmpl_id, product_id, plversions_dict[pricelist_id], qty))
res1 = cr.dictfetchall()
uom_price_already_computed = False
for res in res1:
** Changed in: openobject-addons
Status: Invalid => Confirmed
--
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/715682
Title:
Prices are not correctly returned by price_get_multi method from
product\pricelist.py
Status in OpenERP Modules (addons):
Confirmed
Bug description:
The problem is on the line: (tmpl_id, product_id, plversion_ids[0],
qty))
The code returns for all the pricelist versions the price from the
first pricelist version.
To correct the error you must modify the line like this:(tmpl_id,
product_id, pricelist_id, qty))
References