Forward port of branch saas-5 up to eda2f06

This commit is contained in:
Martin Trigaux 2014-07-28 16:37:56 +02:00
commit 6dc94f0c4e
5 changed files with 25 additions and 16 deletions

View File

@ -18,7 +18,7 @@
<field name="property_account_income" domain="[('type','=','other')]" groups="account.group_account_user"
attrs="{'readonly': [('is_product_variant', '=', True)]}"/>
<field name="taxes_id" colspan="2" widget="many2many_tags"
attrs="{'readonly':[ '|', ('sale_ok','=',0), ('is_product_variant', '=', True)]}"/>
attrs="{'readonly':[('sale_ok','=',0)]}"/>
</group>
<group>
<field name="property_account_expense" domain="[('type','=','other')]" groups="account.group_account_user"

View File

@ -236,7 +236,7 @@
<div class="oe_right">
<button class="oe_inline oe_stat_button" string="Variant Prices" name="%(variants_template_action)d" type="action" icon="fa-strikethrough"/>
<button class="oe_inline oe_stat_button" name="%(product.product_variant_action)d" type="action" icon="fa-sitemap">
<field string="Variants" name="product_variant_count" widget="statinfo" />
<field string="List of Variants" name="product_variant_count" widget="statinfo" />
</button>
</div>
<field name="attribute_line_ids" widget="one2many_list">
@ -270,7 +270,7 @@
<field name="name"/>
</a>
</h4>
<a name="%(product.product_variant_action)d" type="action" t-if="record.product_variant_count.raw_value&gt;1" >
<a name="%(product.product_variant_action)d" type="action">
<t t-esc="record.product_variant_count.value"/> Variants
</a>
<div name="tags"/>

View File

@ -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:

View File

@ -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)

View File

@ -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)