This commit fix wrong grouping when we format price via price_to_str.
where '[3,0]' was interpreted as string and not array in intersperse.
Thousand separator was duplicated ",,,320.00" e.g.
This commit fix also product page where amount for variant was formatted
js side before that RPC translation (website.ready() defered) was resolved.
'/website/translations' is only called when user have rights to edit page.
So a standard user didn't call it and l10n is not initialized.
After an update, now we format the amount with the l10n value.
To stay retro compatible, if l10n is not initialized (value = [])
we use [] for grouping as 'fallback value'.
To fix decimal precision you need to update the template product_price.
To fix the grouping, you need to update the website.layout
To fix the decimal separator, (and previous fix), you just need to pull the JS
This commit is related to #1103, #11553, #14772, #14874, ...
And fix the previous fix odoo/odoo@1f10ef8055
It should also fix (by side-effect) the translation JS for user without editor
right.
Already fixed in V9 - don't forward this commit...
The website `default_lang_id` was not required,
while the algorithm choosing the website language
expects it to be required.
This solves the below issue, when your browser language is en_US:
- add a second language to the website (e.g. fr_BE or es_VE),
- in the website settings, remove English from the languages
- in the website settings, unset the default language
- try to go on the website
You will have a crash:
```
File "/home/odoo/src/odoo/saas-11/addons/website/models/ir_http.py", line 193, in _dispatch
resp.set_cookie('website_lang', request.lang)
File "/usr/lib/python2.7/dist-packages/werkzeug/wrappers.py", line 992, in set_cookie
self.charset))
File "/usr/lib/python2.7/dist-packages/werkzeug/http.py", line 905, in dump_cookie
value = to_bytes(value, charset)
File "/usr/lib/python2.7/dist-packages/werkzeug/_compat.py", line 106, in to_bytes
raise TypeError('Expected bytes')
TypeError: Expected bytes
```
This is because the `request.lang` is set to `False`
because of the below algorithm in `ir_http.py`:
```
nearest_lang = not func and self.get_nearest_lang(path[1])
url_lang = nearest_lang and path[1]
preferred_lang = ((cook_lang if cook_lang in langs else False)
or self.get_nearest_lang(request.lang)
or request.website.default_lang_code)
is_a_bot = self.is_a_bot()
request.lang = request.context['lang'] = nearest_lang or preferred_lang
```
`nearest_lang` is `False`, because there is no nearest language
available for the browser lang (`en_US`)
`cook_lang` is `False` for users who never went on the website
`request.website.default_lang_code`, which is the last feedback,
is also `False` because you removed the default language
in the website settings.
opw-695621
Previous implementation did not allow the user to search for pages 'name'
but only on the slugified name.
Now we slugify the needles before to find a match.
1. Create a new page: 'The new'
2. add a link on your website and try to find this page...
- Before this commit, the only ways was to type 'the-new'
- After this commit 'the new', 'The new', 'The-new', ... will match
This commit closes#10771
When a user try to create a new page info, he is redirected
to the /page/info because the xmlid already exists...
The problem is that this view need to be rendered via the
controller /website/info which gives some extra values (version, ...)
The fix for v8 is to redirect /page/info to /website/info.
In V9, the behavior is changed and one page info-1 will be created.
But this fix is also required for direct access to /page/info.
To do in master: maybe use another xml_id that this basic name 'info'?
This commit fix issue #8022