OpenUpgrade icon indicating copy to clipboard operation
OpenUpgrade copied to clipboard

[FIX][16.0] website: sync access token of partner on website visitor

Open daiduongnguyen-odoo opened this issue 1 year ago • 3 comments

Following pr https://github.com/odoo/odoo/pull/110870 this is needed

daiduongnguyen-odoo avatar Jan 23 '24 01:01 daiduongnguyen-odoo

@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 ?

daiduongnguyen-odoo avatar Feb 08 '24 09:02 daiduongnguyen-odoo

@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)

daiduongnguyen-odoo avatar Feb 08 '24 09:02 daiduongnguyen-odoo

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.

pedrobaeza avatar Feb 08 '24 12:02 pedrobaeza