Skip to content
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][16.0] website: sync access token of partner on website visitor #4282

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

duong77476-viindoo
Copy link
Sponsor Contributor

Following pr odoo/odoo#110870 this is needed

@pedrobaeza pedrobaeza added this to the 16.0 milestone Feb 8, 2024
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The access token is not computed that way:

https://github.com/odoo-dev/odoo/blob/98163e998763a954477e9785af81a8de48b57444/addons/website/models/website_visitor.py#L35

and you are here overwriting all the existing access tokens, no matter if they were previously generated or not.

Searching on previous versions, the access token exists since the beginning of this model (v13), so there's nothing to do on this side IMO.

@duong77476-viindoo
Copy link
Sponsor Contributor Author

duong77476-viindoo commented Feb 8, 2024

@pedrobaeza Did you check the PR i mention, just try install website module , migrate it to v16 , create some visitor using same portal account, then try to merge partner and you will get error. Or you need me to record a video for you ?

@duong77476-viindoo
Copy link
Sponsor Contributor Author

@pedrobaeza This happened will our production database after we migrated it to v16 , of course we have numerous record of visitor which has access_token is not partner_id , therefor we have to do a fix using migration script (Mean that if your database is alreay migrate to v16 and you haven't had this code in this PR , you will need to do something like merge the visitor yourself using another migration script)

@pedrobaeza
Copy link
Member

The question is that this is not an OU fix (although we can maybe handle it here). It's something that they screwed up when adding the token feature, not considering the effect when merging partners. Apart of judging if it's correct to put partner_id as the token in that cases (very different from the normal generated tokens), and not knowing the real utility of this token, this can happen the same in any DB from 13.0 that has partners merged. Thus, this should be added to all OU versions to get fixed "the next time you migrate to a major version".

Coming again to this PR with all the previous considerations, the code here is incorrect, reassigning the token for all the records, not only those without the token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants