diff --git a/addons/account/product_view.xml b/addons/account/product_view.xml
index 9c1b0ee39b7..44b9099a00a 100644
--- a/addons/account/product_view.xml
+++ b/addons/account/product_view.xml
@@ -18,7 +18,7 @@
+ attrs="{'readonly':[('sale_ok','=',0)]}"/>
@@ -270,7 +270,7 @@
-
+
Variants
diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py
index e62d8edc82d..91eada15295 100644
--- a/addons/website_sale/controllers/main.py
+++ b/addons/website_sale/controllers/main.py
@@ -820,9 +820,22 @@ class website_sale(http.Controller):
product = product_obj.browse(request.cr, request.uid, id, context=request.context)
return product.write({'website_size_x': x, 'website_size_y': y})
+ def order_lines_2_google_api(self, order_lines):
+ """ Transforms a list of order lines into a dict for google analytics """
+ ret = []
+ for line in order_lines:
+ ret.append({
+ 'id': line.order_id and line.order_id.id,
+ 'name': line.product_id.categ_id and line.product_id.categ_id.name or '-',
+ 'sku': line.product_id.id,
+ 'quantity': line.product_uom_qty,
+ 'price': line.price_unit,
+ })
+ return ret
+
@http.route(['/shop/tracking_last_order'], type='json', auth="public")
def tracking_cart(self, **post):
- """ return JS code for google analytics"""
+ """ return data about order in JSON needed for google analytics"""
cr, uid, context = request.cr, request.uid, request.context
ret = {}
sale_order_id = request.session.get('sale_last_order_id')
@@ -834,16 +847,7 @@ class website_sale(http.Controller):
'revenue': order.amount_total,
'currency': order.currency_id.name
}
- ret['lines'] = []
- for line in order.order_line:
- if not line.is_delivery:
- ret['lines'].append({
- 'id': line.order_id and line.order_id.id,
- 'name': line.product_id.categ_id and line.product_id.categ_id.name or '-',
- 'sku': line.product_id.id,
- 'quantity': line.product_uom_qty,
- 'price': line.price_unit,
- })
+ ret['lines'] = self.order_lines_2_google_api(order.order_line)
return ret
# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/website_sale_delivery/controllers/main.py b/addons/website_sale_delivery/controllers/main.py
index 93c6aa2bfaa..15bc881c364 100644
--- a/addons/website_sale_delivery/controllers/main.py
+++ b/addons/website_sale_delivery/controllers/main.py
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
import openerp
from openerp import http
-from openerp import SUPERUSER_ID
from openerp.http import request
import openerp.addons.website_sale.controllers.main
+
class website_sale(openerp.addons.website_sale.controllers.main.website_sale):
@http.route(['/shop/payment'], type='http', auth="public", website=True)
@@ -21,3 +21,8 @@ class website_sale(openerp.addons.website_sale.controllers.main.website_sale):
res = super(website_sale, self).payment(**post)
return res
+
+ def order_lines_2_google_api(self, order_lines):
+ """ Transforms a list of order lines into a dict for google analytics """
+ order_lines_not_delivery = [line for line in order_lines if not line.is_delivery]
+ return super(website_sale, self).order_lines_2_google_api(order_lines_not_delivery)
diff --git a/openerp/addons/base/ir/ir_attachment.py b/openerp/addons/base/ir/ir_attachment.py
index d868207eaed..de768d23cc6 100644
--- a/openerp/addons/base/ir/ir_attachment.py
+++ b/openerp/addons/base/ir/ir_attachment.py
@@ -69,7 +69,7 @@ class ir_attachment(osv.osv):
def _storage(self, cr, uid, context=None):
return self.pool['ir.config_parameter'].get_param(cr, SUPERUSER_ID, 'ir_attachment.location', 'file')
- @tools.ormcache_context()
+ @tools.ormcache(skiparg=3)
def _filestore(self, cr, uid, context=None):
return tools.config.filestore(cr.dbname)