summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfp <fp@fp-laptop>2011-09-17 18:19:06 +0200
committerfp <fp@fp-laptop>2011-09-17 18:19:06 +0200
commit8ffc7eb7730d89d7d2f37002fcd55bb78b3b09cc (patch)
treef485dae3130468f767ced65403e13f19928fcfc8
parent5221d5faa51a124d7bfe47d48a3679cea9b10ab6 (diff)
parentfc735d0c786b2b73e27a920d626464a0128c6afd (diff)
merge
bzr revid: fp@fp-laptop-20110917161906-rae6djau18h6stmq
-rw-r--r--addons/sale_margin/sale_margin.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/sale_margin/sale_margin.py b/addons/sale_margin/sale_margin.py
index c5ba7f1ea56..74d6089b57d 100644
--- a/addons/sale_margin/sale_margin.py
+++ b/addons/sale_margin/sale_margin.py
@@ -29,8 +29,10 @@ class sale_order_line(osv.osv):
res = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty=qty,
uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id,
lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag)
+ if not pricelist:
+ return res
frm_cur = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id
- to_cur = self.pool.get('res.partner').browse(cr, uid, partner_id).property_product_pricelist.currency_id.id
+ to_cur = self.pool.get('product.pricelist').browse(cr, uid, [pricelist])[0].currency_id.id
if product:
purchase_price = self.pool.get('product.product').browse(cr, uid, product).standard_price
price = self.pool.get('res.currency').compute(cr, uid, frm_cur, to_cur, purchase_price, round=False)