[FIX] product: get_history_price recieves ids instead of a browse record for product...
authorMartin Trigaux <mat@openerp.com>
Fri, 9 May 2014 07:33:15 +0000 (09:33 +0200)
committerMartin Trigaux <mat@openerp.com>
Fri, 9 May 2014 07:33:15 +0000 (09:33 +0200)
bzr revid: mat@openerp.com-20140509073315-9q0igp9zh6d96bl6

addons/product/product.py

index 02813ab..a7a027d 100644 (file)
@@ -405,7 +405,7 @@ class product_template(osv.osv):
         if date is None:
             date = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
         price_history_obj = self.pool.get('product.price.history')
-        history_ids = price_history_obj.search(cr, uid, [('company_id', '=', company_id), ('product_template_id', '=', product_tmpl.id), ('datetime', '<=', date)], limit=1)
+        history_ids = price_history_obj.search(cr, uid, [('company_id', '=', company_id), ('product_template_id', '=', product_tmpl), ('datetime', '<=', date)], limit=1)
         if history_ids:
             return price_history_obj.read(cr, uid, history_ids[0], ['cost'], context=context)['cost']
         return 0.0