diff options
| author | qsm-odoo <qsm@odoo.com> | 2016-07-15 17:22:24 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2016-07-18 12:24:52 +0200 |
| commit | b22082ac8e64db704bc28466bc6b6bdd702ad373 (patch) | |
| tree | 2cc90606492784e36c6f0a7f71dc283fb9267658 /addons/website/static/src/js/website.contentMenu.js | |
| parent | fa9782d24d95a4b3d04a04a63ed220f0b60daeda (diff) | |
[FIX] website_sale: stop using field before its creation
Since using new api for the website_sale module with commit 788c1334e2cbe26fa26d4c6d4974dc413dbff608,
the website_sale module cannot be installed after the sale_stock module
is installed. The problem has not been detected on the runbot as, by
chance, the website_sale module seems to be installed before.
The problem here is that on installation, the _default_website_sequence
method is called to add a default value for the added website_sequence
field. In this method, a search() is done, ordered by this field values
then a read() is performed. The problem is that the read does not use
the given order value and use always the default one, which uses the
website_published field which happens to not be created at that time.
However the creation order of a model fields is difficult to determine
which is why when sale_stock is not installed, the bug does not appear,
the website_published being created, by chance, before calling the
_default_website_sequence method in that case.
To fix the problem, refactore the method by using a SQL query so that
the website_published field is not used. This also makes the method
easier to understand and more efficient.
Thanks to @rco-odoo
Diffstat (limited to 'addons/website/static/src/js/website.contentMenu.js')
0 files changed, 0 insertions, 0 deletions
