OpenUpgrade icon indicating copy to clipboard operation
OpenUpgrade copied to clipboard

[15.0][mail]Duplicated entry in update mail_group_moderation_rel

Open dansanti opened this issue 1 year ago • 1 comments

If 2 mail channels haves the same moderator, and when is migrated to mail_group, the group id could by the same of channel, then when update is performed , could cause unique constraint error

Module

mail

Describe the bug

current 14.0 table mail_channel_moderator_rel: mail_channel_id, res_users_id 7, 2 1, 2

when migration is performed , may create mail_channel 7 with mail_group id 1, then the table will be renamed to mail_group_moderator_rel and mail_channel_id will be renamed to mail_group_id, so, in the SQL update mail_group_id 7 will be updated according old channel_id 1 . This cause unique error, because already exists that tuple 1, 2 ( not update yet)

here the update line:

https://github.com/OCA/OpenUpgrade/blob/9af4744ada76ae405cd290d04c052360ed66acb9/openupgrade_scripts/scripts/mail/15.0.1.5/pre-migration.py#L231

dansanti avatar Sep 12 '24 10:09 dansanti

Please propose a patch to fix this.

pedrobaeza avatar Sep 12 '24 10:09 pedrobaeza