Skip to content
Snippets Groups Projects
Commit cf4c826a authored by Denis Ledoux's avatar Denis Ledoux
Browse files

[FIX] website_sale: set partner lang according to website lang

On ecommerce checkout, the language of the partner wasn't set according to the language in which he is visiting the website.
Therefore, its partner was set with the default language (English in most cases), and any emails sent to him were not translated in his own language (in the email templates, such as the quotation email he received on order confirmation)
parent f2c59460
No related branches found
No related tags found
No related merge requests found
......@@ -510,7 +510,12 @@ class website_sale(http.Controller):
orm_user = registry.get('res.users')
order_obj = request.registry.get('sale.order')
billing_info = self.checkout_parse('billing', checkout, True)
partner_lang = request.lang if request.lang in [lang.code for lang in request.website.language_ids] else None
billing_info = {}
if partner_lang:
billing_info['lang'] = partner_lang
billing_info.update(self.checkout_parse('billing', checkout, True))
# set partner_id
partner_id = None
......@@ -531,7 +536,10 @@ class website_sale(http.Controller):
# create a new shipping partner
if checkout.get('shipping_id') == -1:
shipping_info = self.checkout_parse('shipping', checkout, True)
shipping_info = {}
if partner_lang:
shipping_info['lang'] = partner_lang
shipping_info.update(self.checkout_parse('shipping', checkout, True))
shipping_info['type'] = 'delivery'
shipping_info['parent_id'] = partner_id
checkout['shipping_id'] = orm_partner.create(cr, SUPERUSER_ID, shipping_info, context)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment