openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #12727
[Bug 1011927] Re: price_get_multi does not work for a list of pricelists
Hello Amit,
The issue is not quite like you have tested. It works for Sales Orders
because they request the current price for one pricelist only.
---------------
If I create two separate pricelists, call them "Selling Price" and "Alt
Selling Price", and for the case of simplicity, each only has one
pricelist version.
Now, assuming "Selling Price" is id "1" and "Alt Selling Price" is id
"2", and the version ids are "11" and "12" respectively.
And for product id 1000, the selling prices are $1500 and $2500
If I create my own piece of code which calls:
price_dict = self.pool.get('product.pricelist').price_get(cr, uid, [1], 1000, 1.0)
Then it will correctly return a dictionary:
{'item_id' : 1000, 1: 1500}
Similarly,
price_dict = self.pool.get('product.pricelist').price_get(cr, uid, [2], 1000, 1.0)
returns:
{'item_id' : 1000, 2: 2500}
If my piece of code wants to get both selling prices, I try:
price_dict = self.pool.get('product.pricelist').price_get(cr, uid, [1, 2], 1000, 1.0)
it returns:
{'item_id' : 1000, 1: 1500, 2: 1500}
Price 2 is in fact 2500. Actually, whether it returns 1500 or 2500 is
random, as it depends on the sequence of an unsorted list.
My use is that we need to get all the current prices for a product, and
we could do it efficiently with one call to price_get, however, we now
have to do it as a loop getting one price at a time.
As I said, the code in price_get_multi is wrong if more than one
pricelist is passed.
pricelist_version_ids =
self.pool.get('product.pricelist.version').search(cr, uid,
[('pricelist_id','in',pricelist_ids) .......
And then uses pricelist_version_ids[0] for every pricelist in the loop.
I hope this makes sense.
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1011927
Title:
price_get_multi does not work for a list of pricelists
Status in OpenERP Addons (modules):
Incomplete
Bug description:
In pricelist.py, in product, price_get calls price_get_multi
If a list of pricelist_ids is passed, the complete list returned is
the same price multiple times!
The bug is that pricelist_version_ids is retrieved as a list, which does not at all link to pricelist_ids.
Then, in the loop (for pricelist_id in pricelist_ids) the cr.execute always uses pricelist_version_ids[0]!, not the pricelist_version_id for current pricelist.
The only way for this to work is to retrieve one pricelist at a time.
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1011927/+subscriptions
References