Go to file
Denis Ledoux 0105cbbcf9 [FIX] website: make website default language required
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
2016-12-01 11:37:03 +01:00
.tx [I18N] add Transifex config file 2015-05-27 11:28:22 +02:00
addons [FIX] website: make website default language required 2016-12-01 11:37:03 +01:00
debian [REF] packaging: debian: depend on python-babel 2016-10-24 16:22:17 +02:00
doc [CLA] Corporate signature for Diagram Software 2016-11-24 16:31:46 +01:00
openerp [I18N] Update translation terms from Transifex 2016-11-27 02:57:09 +01:00
setup [REF] packaging: debian: depend on python-babel 2016-10-24 16:22:17 +02:00
.gitignore [ADD] git mailmap and CLA stats 2015-02-08 23:00:10 +01:00
.mailmap [CLA] update mailmap 2015-09-08 15:45:09 +02:00
CONTRIBUTING.md [FIX] CONTRIBUTING:.md emphasize the fact that PRs supersede issues 2015-02-12 11:08:25 +01:00
LICENSE cleanup repo root 2014-05-15 10:43:02 +02:00
MANIFEST.in [FIX] packaging: include favicon 2015-10-21 13:45:37 +02:00
Makefile [IMP] *: one Makefile to rules them all. 2014-11-05 19:30:28 +01:00
README.md [IMP] README.md: badges for docs, help, nightly 2015-01-20 17:21:38 +01:00
odoo.py [FIX] odoo.py fix fetching of git remotes 2014-12-19 17:39:11 +01:00
openerp-gevent restore the original gevent detection 2013-09-10 01:19:46 +02:00
openerp-server openerp apps main moved to cli ready for new commands 2012-11-27 01:55:13 +01:00
openerp-wsgi.py [FIX] wsgi deployement with openerp-wsgi.py 2014-03-07 21:00:55 +01:00
requirements.txt [FIX] requirements.txt : gevent & greenlet versions updated 2015-09-18 00:55:02 +02:00
setup.cfg [FIX] Packaging: RedHat: dependencies management 2014-11-28 16:40:55 +01:00
setup.py [FIX] setup: backport of 6ceb0a2b1b92 2016-07-07 14:05:20 +02:00

README.md

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, Purchase Management, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

If you are a developer you may type the following command at your terminal:

wget -O- https://raw.githubusercontent.com/odoo/odoo/8.0/odoo.py | python

Then follow the developer tutorials

For Odoo employees

To add the odoo-dev remote use this command:

$ ./odoo.py setup_git_dev

To fetch odoo merge pull requests refs use this command:

$ ./odoo.py setup_git_review