Fix price list when depending on product partner form

- pass in the part for margin etc...
- convert to the UOM

bzr revid: ced-50e4e07c7fd742815663080a3cf9828f9c7047f3
This commit is contained in:
ced 2008-01-07 15:14:59 +00:00
parent 364dc33df3
commit dd60552740
1 changed files with 11 additions and 15 deletions

View File

@ -190,21 +190,17 @@ class product_pricelist(osv.osv):
where = [('name', '=', partner) ]
sinfo = supplierinfo_obj.search(cr, uid,
[('product_id', '=', tmpl_id)] + where)
if not sinfo:
result[id] = 0
continue
cr.execute('SELECT * ' \
'FROM pricelist_partnerinfo ' \
'WHERE suppinfo_id IN (' + \
','.join(map(str, sinfo)) + ') ' \
'AND min_quantity <= %f ' \
'ORDER BY min_quantity DESC LIMIT 1', (qty,))
res = cr.dictfetchone()
if res:
result[id] = res['price']
else:
result[id] = 0
continue
price = 0.0
if sinfo:
cr.execute('SELECT * ' \
'FROM pricelist_partnerinfo ' \
'WHERE suppinfo_id IN (' + \
','.join(map(str, sinfo)) + ') ' \
'AND min_quantity <= %f ' \
'ORDER BY min_quantity DESC LIMIT 1', (qty,))
res2 = cr.dictfetchone()
if res2:
price = res2['price']
else:
price_type = price_type_obj.browse(cr, uid, res['base'])
price = currency_obj.compute(cr, uid,