[FIX] product: use new api to retrieve product standard price as SUPERUSER
authorDenis Ledoux <dle@odoo.com>
Tue, 14 Oct 2014 10:46:07 +0000 (12:46 +0200)
committerDenis Ledoux <dle@odoo.com>
Tue, 14 Oct 2014 10:46:07 +0000 (12:46 +0200)
As it looks like self is a product.template, and product can be a product.product. Using the new api avoid to have this problem.

addons/product/product.py

index 6fc5515..7f3a33c 100644 (file)
@@ -590,7 +590,7 @@ class product_template(osv.osv):
             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] = product.sudo()[ptype]
             if ptype == 'list_price':
                 res[product.id] += product._name == "product.product" and product.price_extra or 0.0
             if 'uom' in context: