New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] website : fix authenticate archived visitor #40199
[FIX] website : fix authenticate archived visitor #40199
Conversation
6c5520f
to
0c82243
Compare
0c82243
to
8cc4d93
Compare
8cc4d93
to
dc595c4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi.
Blup.
Bye.
addons/website/models/res_users.py
Outdated
visitor_sudo.website_track_ids.write({'visitor_id': partner_visitor.id}) | ||
visitor_sudo.unlink() | ||
# Reactivate the older Visitor & Update visitor's Cookie (TODO: check if necessary (maybe done in _handle_webpage_dispatch) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dc595c4
to
29a9526
Compare
29a9526
to
36dc88b
Compare
36dc88b
to
b6d70f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small readability comment and one remark.
Also, in that commit: "[FIX] website : fix authenticate archived visitor":
You should make bullet points with the second paragraph.
Makes it easier to see what's already done when you say "last two points were already done".
addons/website/models/res_users.py
Outdated
visitor_sudo.website_track_ids.write({'visitor_id': partner_visitor.id}) | ||
visitor_sudo.unlink() | ||
# Reactivate the older Visitor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Reactivate the archived visitor (most likely archived by the cron for inactivity reasons)
b6d70f1
to
b512fc6
Compare
b512fc6
to
bf449d1
Compare
@awa-odoo : tests added for this particular flow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blork test review
}) | ||
partner_demo = self.env.ref('base.partner_demo') | ||
old_visitor.partner_id = partner_demo.id | ||
partner_demo.visitor_ids = [(6, 0, [old_visitor.id])] # TODO DBE : To remove in Master (13.1) after visitor_ids field declaration master fix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to [4, old_visitor.id]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will remove this anyway after forward port (And I need to flush if I use [4, id]) sooooo
if self.target_visitor: | ||
return self.target_visitor | ||
else: | ||
return self.Visitor._create_visitor() if force_create else self.Visitor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you define self.target_visitor
just above, can you reach the else case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah indeed, oopsy (I defined it in the setup originally)
Merge method set to rebase and fast-forward |
This commit fixes the visitor's time_statistics computation. When creating a new visitor, last connection datetime is not set, so it's not retrieved in the search_read and crash at search_read_result[visitor.id]. This fix also speeds up and simplifies the time_statistics computation. As time_connection_datetime is always set (for already created visitor) and in the depends, no need to read values before looping, the data is already fetched in memory. We can then use directly the value for each visitor in self. Task ID: 2120464 PR #40199
If a visitor logs in (and has a visitor_id in his cookie), the partner will be linked to the visitor. If, after 1 week, the visitor tries to connect again with a different session (or another visitor_id in cookies), the authenticate will crash because * _cron_archive_visitors applies on visitor inactive since at least a week * there can be only one visitor per partner (sql constraint) * the visitor linked to the partner is not retrieved (because archived) and we try to link the partner to a new visitor. Further than that, if the visitor is archived and the linked partner wants to login again with a new visitor_id, we should * reactivate the previous visitor, * copy history from newest to previous one, * delete the newest one Note that last two points were already done before this commit. Task ID: 2120464 PR #40199 Fixes #40077 Fixes #40301 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
If a visitor logs in (and has a visitor_id in his cookie), the partner will be linked to the visitor. If, after 1 week, the visitor tries to connect again with a different session (or another visitor_id in cookies), the authenticate will crash because * _cron_archive_visitors applies on visitor inactive since at least a week * there can be only one visitor per partner (sql constraint) * the visitor linked to the partner is not retrieved (because archived) and we try to link the partner to a new visitor. Further than that, if the visitor is archived and the linked partner wants to login again with a new visitor_id, we should * reactivate the previous visitor, * copy history from newest to previous one, * delete the newest one Note that last two points were already done before this commit. Task ID: 2120464 PR odoo#40199 Fixes odoo#40077 Fixes odoo#40301 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
If a visitor logs in (and has a visitor_id in his cookie), the partner will be linked to the visitor. If, after 1 week, the visitor tries to connect again with a different session (or another visitor_id in cookies), the authenticate will crash because * _cron_archive_visitors applies on visitor inactive since at least a week * there can be only one visitor per partner (sql constraint) * the visitor linked to the partner is not retrieved (because archived) and we try to link the partner to a new visitor. Further than that, if the visitor is archived and the linked partner wants to login again with a new visitor_id, we should * reactivate the previous visitor, * copy history from newest to previous one, * delete the newest one Note that last two points were already done before this commit. Task ID: 2120464 PR #40199 Fixes #40077 Fixes #40301 closes #41220 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com> Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
If a visitor logs in (and has a visitor_id in his cookie), the partner will be linked to the visitor. If, after 1 week, the visitor tries to connect again with a different session (or another visitor_id in cookies), the authenticate will crash because * _cron_archive_visitors applies on visitor inactive since at least a week * there can be only one visitor per partner (sql constraint) * the visitor linked to the partner is not retrieved (because archived) and we try to link the partner to a new visitor. Further than that, if the visitor is archived and the linked partner wants to login again with a new visitor_id, we should * reactivate the previous visitor, * copy history from newest to previous one, * delete the newest one Note that last two points were already done before this commit. Task ID: 2120464 PR odoo#40199 Fixes odoo#40077 Fixes odoo#40301 Original-signed-off-by: Thibault Delavallee (tde) <tde@openerp.com> X-original-commit: 53a6bed
If a visitor logs in (and has a visitor_id in his cookie), the partner will be linked to the visitor. If, after 1 week, the visitor tries to connect again with a different session (or another visitor_id in cookies), the authenticate will crash because * _cron_archive_visitors applies on visitor inactive since at least a week * there can be only one visitor per partner (sql constraint) * the visitor linked to the partner is not retrieved (because archived) and we try to link the partner to a new visitor. Further than that, if the visitor is archived and the linked partner wants to login again with a new visitor_id, we should * reactivate the previous visitor, * copy history from newest to previous one, * delete the newest one Note that last two points were already done before this commit. Task ID: 2120464 PR #40199 Fixes #40077 Fixes #40301 closes #41273 Original-signed-off-by: Thibault Delavallee (tde) <tde@openerp.com> X-original-commit: 53a6bed Signed-off-by: David Beguin <dbeguin@users.noreply.github.com>
Ah, apparently, a part of this PR have been removed in the FW PR. strange.. |
This commit fixes the visitor's time_statistics computation. When creating a new visitor, last connection datetime is not set, so it's not retrieved in the search_read and crash at search_read_result[visitor.id]. This fix also speeds up and simplifies the time_statistics computation. As time_connection_datetime is always set (for already created visitor) and in the depends, no need to read values before looping, the data is already fetched in memory. We can then use directly the value for each visitor in self. Task ID: 2120464 PR odoo#40199
This commit fixes the visitor's time_statistics computation. When creating a new visitor, last connection datetime is not set, so it's not retrieved in the search_read and crash at search_read_result[visitor.id]. This fix also speeds up and simplifies the time_statistics computation. As time_connection_datetime is always set (for already created visitor) and in the depends, no need to read values before looping, the data is already fetched in memory. We can then use directly the value for each visitor in self. Task ID: 2120464 PR #40199 closes #43758 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit fixes the visitor's time_statistics computation. When creating a new visitor, last connection datetime is not set, so it's not retrieved in the search_read and crash at search_read_result[visitor.id]. This fix also speeds up and simplifies the time_statistics computation. As time_connection_datetime is always set (for already created visitor) and in the depends, no need to read values before looping, the data is already fetched in memory. We can then use directly the value for each visitor in self. Task ID: 2120464 PR odoo#40199 X-original-commit: 1f0c9f2
This commit fixes the visitor's time_statistics computation. When creating a new visitor, last connection datetime is not set, so it's not retrieved in the search_read and crash at search_read_result[visitor.id]. This fix also speeds up and simplifies the time_statistics computation. As time_connection_datetime is always set (for already created visitor) and in the depends, no need to read values before looping, the data is already fetched in memory. We can then use directly the value for each visitor in self. Task ID: 2120464 PR #40199 closes #43780 X-original-commit: 1f0c9f2 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
I think this following error is related to this PR, @dbeguin .
|
We will have a look. Thanks for pointing it out ! |
If a visitor logs in (and has a visitor_id in his cookie), the partner will be
linked to the visitor. If, after 1 week, the visitor tries to connect again
with a different session (or another visitor_id in cookies), the authenticate
will crash because:
we try to link the partner to a new visitor.
Further than that, if the visitor is archived and the linked partner wants to
login again with a new visitor_id, we should :
(last two points were already done before this commit).
This PR also fixes and simplifies the time_statistics computation.
As time_connection_datetime is always set and in the depends, no need to read
values before looping, the data is already fetched in memory. We can than
use directly the value for each visitor in self.
Task ID: 2120464