[FIX] product: redo forward port 2832d2d for fix 12eb157 lost with 43977de
authorDenis Ledoux <dle@odoo.com>
Tue, 14 Oct 2014 09:59:57 +0000 (11:59 +0200)
committerDenis Ledoux <dle@odoo.com>
Tue, 14 Oct 2014 10:02:20 +0000 (12:02 +0200)
addons/product/product.py

index b29d6a5..6fc5515 100644 (file)
@@ -584,7 +584,13 @@ class product_template(osv.osv):
         res = {}
         product_uom_obj = self.pool.get('product.uom')
         for product in products:
-            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
+            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
             if ptype == 'list_price':
                 res[product.id] += product._name == "product.product" and product.price_extra or 0.0
             if 'uom' in context: