price_get_multi() code mismatching ids ?

Asked by snook on 2010-12-16

Version 6

I am getting no matching pricelist when my product_pricelist does not have the same "id" as the product_pricelist_version.

Some data:

product_pricelist_version:
id=7
pricelist_id=4

product_pricelist:
id=4

product_pricelist_item:
id=7
price_version_id=7

Arguments to price_get_multi() are:
self = <product.pricelist.product_pricelist object at 0xa60a2cc>
cr = <sql_db.Cursor object at 0xac63b4c>
uid = 1
pricelist_ids = [4L]
products_by_qty_by_partner = [(1, 1, 2)]
context = {'date': '2010-12-17', 'uom': False}

Generated sql as follows:

select i.*, pl.currency_id from
product_pricelist_item as i,
product_pricelist_version as v,
product_pricelist as pl
where (product_tmpl_id is NULL OR product_tmpl_id = 1)
and (product_id is NULL or product_id = 1)
AND (categ_id in (2,3,1) OR (categ_id IS NULL))
AND price_version_id = 4
AND (min_quantity IS NULL OR min_quantity <= 1)
AND i.price_version_id = v.id AND v.pricelist_id = pl.id
ORDER BY sequence;
---------------------------

product/pricelist.py code:

To my untrained eye it looks very strange.

Method "price_get_multi()" has code where "pricelist_version_ids = pricelist_ids" and "pricelist_version_ids = product_pricelist_version_obj.search(cr, uid, [])

This look wrong. It is saying "pricelist_version_ids" can contain two different types of object ids !!!!

In my case above, the sql is plugging using a pricelist_id of "4" in the where clause of "price_version_id" (should have value of 7)

Am I reading this right or going crazy ?

Question information

Language:
English Edit question
Status:
Open
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
2010-12-22
Last reply:
snook (snook) said : #1

Have created a bug report.

More information at https://bugs.launchpad.net/openobject-addons/+bug/693056

Can you help with this problem?

Provide an answer of your own, or ask snook for more information if necessary.

To post a message you must log in.