Commit Graph
9 Commits
Author SHA1 Message Date
Sébastien Theys 16f2b3809d [FIX] utm: prevent crash on /web/session/destroy
A similar fix was originally done in [1], where the access to `env` was done
before the parent dispatch.

The issue was then reintroduced with [2], where the `env` was possibly accessed
again after the dispatch. This works most of the time, but in the rare case
where the session is destroyed during dispatch, which is the case on
`/web/session/destroy`, accessing the environment after that point will crash.

This issue didn't manifest before [3], because the `env` was always initialized
during `checked_call` when calling the `clear` method on it (since `env` is a
magic property). After that commit, the `clear` is not called if not necessary,
therefore it might happen that the `env` is never initialized. This leads to the
crash when trying to initialize it for the first time after the `db` attribute
has been cleared during the destroy, since a `db` is required to initialize it.

The current fix aims to prevent the crash. As opposed to [1] that actually kept
the tracking fields by fetching them before the dispatch, it is decided on this
commit to voluntarily lose the tracking fields when destroying the session,
because keeping them would require too much refactoring for a fix in stable, but
we also feel that it makes sense functionally: those tracking fields were maybe
used for a specific purpose in the original database, but they might mean
something completely different on another database.

[1] 6780597f2d
[2] c78de22a09
[3] f6d56afba0

closes #42260

closes odoo/odoo#42314

X-original-commit: 2ac11ce7a3f36a1572d886bc872facf339cb6516
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2019-12-23 16:06:07 +00:00
Jeremy Kersten c78de22a09 [FIX] utm: set utm for website page
Before this commit, UTM was no more set for website.page.

Website.page mechanism uses the _handle_exception to check if an url match a
record in database, instead of use the method _dispatch that uses controllers.

Consequently, module UTM never set the utm into the cookies for website.page.
Now we override method '_handle_exception' that will anyway ignore to set utm
if it is a real exception and not a fallback (redirect, page, attachment, ...)
2018-03-28 17:59:30 +02:00
Simon Lejeune 6780597f2d [FIX] utm: correct ir_http's _dispatch override
When overriding dispatch, we have to make sure that we do the
database operations before calling super, because we are not sure
to have a valid database/env after (for example, in the case of a
drop of a database).
2016-09-21 14:40:05 +02:00
Raphael Collet 70dec2d896 [REF] registry: now mapping model name to model class 2016-08-31 17:21:59 +02:00
Raphael Collet 5c3a60eb50 [FIX] utm: in _dispatch, propagate errors
This avoids a miserable crash when switching between databases.
2016-08-19 16:35:25 +02:00
Yannick Tivisse 40561b0fb6 [MIG] utm: remaining self.pool in ir_http.py 2016-08-09 10:29:46 +02:00
Srushti Patel 8913853377 [MIG] utm:Migrated into new api. 2015-10-26 14:40:02 +01:00
Jeremy Kersten 018450752d [FIX] utm* - Allow to customize the cookies name 2015-04-02 22:50:41 +02:00
Jeremy Kersten c17bc5090d [FIX] hr_recruitment: use utm_mixin to allow to track the job applicant.
Remove old source_id
            Use hr.recruitment.source to generate link with utm and create
            alias with default value for utm
[FIX] crm/utm: Fix bug with utm (ddac26cdbb)
            Move demo into data
            Move ir_http to save the utm in the dispatch
2014-12-27 16:37:21 +01:00