diff options
| author | Olivier Dony <odo@odoo.com> | 2018-10-08 19:29:22 +0200 |
|---|---|---|
| committer | Olivier Dony <odo@odoo.com> | 2018-10-08 19:29:24 +0200 |
| commit | f4041de4ed51aee4dc986d77fdf1f2dc9283318b (patch) | |
| tree | 17aaf23bcac2422c98dc17ca7326ee2b97aaffe0 /doc/reference/javascript_cheatsheet.rst | |
| parent | a362d0eb9f3b620c567e9517f7be790e7a1c7f9b (diff) | |
[FIX] website: use proper env in model methods
Using `request.env` should be reserved for code that lies outside of
model methods (typically: controllers). Model methods have to use the
appropriate `self.env`.
This particular case caused frequent Python-PostgreSQL undetected
deadlocks during installations of website-related modules in 12.0.
One way to reproduce it was to trigger the installation of both
`website` and `website_form` in a single transaction, with neither
pre-installed.
Installing Apps that depend on both would do the job, such as
`website_sale`, provided that GEOIP is available on the system.
In details:
During installation of `website`, new attachments creation would call
get_current_website (see 602807acdf20ff4f75a1abb7f5fa1be4db3f532d and
4f6ec1cd2a9253bb0c6c17d304490c7809facf8a), using the wrong database
cursor: the one from the request instead of the one for the
installation, as provided by `ir.module.module._button_immediate_function`.
This would acquire database locks on `res.country` and `ir.model` in
the wrong transaction, later blocking alterations to `ir.model` in
the installation transaction, e.g. for website_form's
'website_form_access' column.
This combination of events was possible before 12.0, but more difficult
to reproduce as module installations used to happen with a super-user
account, ignoring ACL checks and therefore not locking `ir.model`.
Diffstat (limited to 'doc/reference/javascript_cheatsheet.rst')
0 files changed, 0 insertions, 0 deletions
