From: Denis Ledoux Date: Tue, 4 Nov 2014 11:19:58 +0000 (+0100) Subject: [MERGE] forward port of branch 7.0 up to 5035c76 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=8c4a7cb37143285da0a1a25d0d5e720c45e4346a;p=odoo%2Fodoo.git [MERGE] forward port of branch 7.0 up to 5035c76 --- 8c4a7cb37143285da0a1a25d0d5e720c45e4346a diff --cc addons/product/product.py index 0c08dbb,b70fa03..2110f24 --- a/addons/product/product.py +++ b/addons/product/product.py @@@ -821,17 -718,10 +821,18 @@@ class product_product(osv.osv) price_type_currency_id = pricetype_obj.browse(cr,uid,price_type_id).currency_id.id res = {} - product_uom_obj = self.pool.get('product.uom') + company_id = self.pool['res.users'].read(cr, uid, uid, ['company_id'], context=context)['company_id'][0] - for product in self.browse(cr, SUPERUSER_ID, ids, context=dict(context, force_company=company_id)): - res[product.id] = product[ptype] or 0.0 + # standard_price field can only be seen by users in base.group_user + # Thus, in order to compute the sale price from the cost price for users not in this group + # We fetch the standard price as the superuser + for product in products: + if ptype != 'standard_price': + res[product.id] = product[ptype] or 0.0 + else: - res[product.id] = self.read(cr, SUPERUSER_ID, product.id, [ptype], context=context)[ptype] or 0.0 ++ res[product.id] = self.read(cr, SUPERUSER_ID, product.id, [ptype], context=dict(context, force_company=company_id))[ptype] or 0.0 + + product_uom_obj = self.pool.get('product.uom') + for product in products: if ptype == 'list_price': res[product.id] = (res[product.id] * (product.price_margin or 1.0)) + \ product.price_extra