From 56e3d2d51216aef3652b2fbca8a9d7b176cc480c Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 29 Jan 2016 17:48:02 +0100 Subject: [PATCH 1/3] [FIX] website_sale: get_pricelist_available from the backend. The method `get_pricelist_available` can be called from the backend. (e.g. when using `website.pricelist_id`, whic is a function field ultimately calling `get_pricelist_available`). In such a case, `request.website` is not available, as the request is not done from the website. Therefore, we have to fallback in a work-around to detect the website for which we would like to get the available pricelists. Passing the `website_id` in the context is kinda crappy, but as the website for which we would like the available pricelists is not passed in the method params (trough a parameter `ids` for instance), this is one way to put it through. opw-668230 --- addons/website_sale/models/sale_order.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/addons/website_sale/models/sale_order.py b/addons/website_sale/models/sale_order.py index 7e07c31f5f4..87a6aac943a 100644 --- a/addons/website_sale/models/sale_order.py +++ b/addons/website_sale/models/sale_order.py @@ -139,8 +139,8 @@ class website(orm.Model): def _get_pricelist_id(self, cr, uid, ids, name, args, context=None): res = {} - pricelist = self.get_current_pricelist(cr, uid, context=context) for data in self.browse(cr, uid, ids, context=context): + pricelist = self.get_current_pricelist(cr, uid, context=dict(context, website_id=data.id)) res[data.id] = pricelist.id return res @@ -198,11 +198,18 @@ class website(orm.Model): :returns: pricelist recordset """ + website = request.website + if not request.website: + if context.get('website_id'): + website_id = context['website_id'] + else: + website_id = self.search(cr, uid, [], context=context) + website = self.browse(cr, uid, website_id, context=context) isocountry = request.session.geoip and request.session.geoip.get('country_code') or False pl_ids = self._get_pl(cr, uid, isocountry, show_visible, - request.website.user_id.sudo().partner_id.property_product_pricelist.id, + website.user_id.sudo().partner_id.property_product_pricelist.id, request.session.get('website_sale_current_pl'), - request.website.website_pricelist_ids) + website.website_pricelist_ids) return self.pool['product.pricelist'].browse(cr, uid, pl_ids, context=context) def is_pricelist_available(self, cr, uid, pl_id, context=None): From 2077c7dff4c383d7f9b7bbbcfbc3994af39d818a Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 29 Jan 2016 18:23:28 +0100 Subject: [PATCH 2/3] [FIX] website: force (icon) update of "Website" menu item Note: only relevant for enterprise web client as icon is not display in ommunity version. --- addons/website/data/data.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/website/data/data.xml b/addons/website/data/data.xml index f30068b72e9..83d2d44b3ff 100644 --- a/addons/website/data/data.xml +++ b/addons/website/data/data.xml @@ -83,12 +83,14 @@ self + Website website,static/description/icon.png + open From 052da3e89a10ac5697bf62fb97aa0e644a2a861e Mon Sep 17 00:00:00 2001 From: Thomas Groutars Date: Thu, 28 Jan 2016 12:48:45 -0800 Subject: [PATCH 3/3] [FIX] lang: Add grouping when loading translation Closes #10669 --- openerp/addons/base/res/res_lang.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/res/res_lang.py b/openerp/addons/base/res/res_lang.py index fad27d7bdf1..e3466270fa4 100644 --- a/openerp/addons/base/res/res_lang.py +++ b/openerp/addons/base/res/res_lang.py @@ -85,6 +85,7 @@ class lang(osv.osv): format = format.replace(pattern, replacement) return str(format) + conv = locale.localeconv() lang_info = { 'code': lang, 'iso_code': iso_lang, @@ -92,8 +93,9 @@ class lang(osv.osv): 'translatable': 1, 'date_format' : fix_datetime_format(locale.nl_langinfo(locale.D_FMT)), 'time_format' : fix_datetime_format(locale.nl_langinfo(locale.T_FMT)), - 'decimal_point' : fix_xa0(str(locale.localeconv()['decimal_point'])), - 'thousands_sep' : fix_xa0(str(locale.localeconv()['thousands_sep'])), + 'decimal_point' : fix_xa0(str(conv['decimal_point'])), + 'thousands_sep' : fix_xa0(str(conv['thousands_sep'])), + 'grouping' : str(conv.get('grouping', [])), } lang_id = False try: