[FIX] website_membership_registration: Added active and case insensitive checks for mail_uniqueness#140
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the member email uniqueness constraint in website_membership_registration to avoid false matches and to only consider active member records when checking for duplicates.
Changes:
- Switches the duplicate-email SQL check from
ILIKEpattern matching to case-insensitive equality viaLOWER(email) = LOWER(%s). - Restricts the duplicate-email check to active partners (
active = TRUE).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| WHERE LOWER(email) = LOWER(%s) | ||
| AND id != %s | ||
| AND membership_state != 'none' | ||
| AND active = TRUE |
There was a problem hiding this comment.
The SQL now filters duplicates to active = TRUE, but the constraint is only declared on email and membership_state. If a user archives/unarchives a partner (toggles active), this constraint won't run, which can allow creating two active members with the same email after reactivation. Include active in the @api.constrains(...) fields (or enforce uniqueness regardless of active) so activation changes also trigger the check.
…ive checks for mail_uniqueness
a2db998 to
e80f75c
Compare
No description provided.