[16.0][FIX] pms_partner_identification: look up partner document by its unique key - #437
Draft
DarioLodeiros wants to merge 1 commit into
Draft
Conversation
…que key The unique index on res.partner.id_number is (partner_id, category_id). Searching also by country_id misses existing rows whose country is not set (or differs), so the method falls into create() and crashes against the unique constraint when saving a check-in. Search by the uniqueness key only: the subsequent write() updates the existing document and backfills its country from the check-in data.
DarioLodeiros
marked this pull request as draft
August 20, 2026 08:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The unique index on
res.partner.id_numberis(partner_id, category_id)._create_or_update_partner_documentsearches the existing document also bycountry_id, so any legacy row whose country is not set (or differs from the one captured at check-in) is not found. The method then falls intocreate()and crashes against the unique constraint when the check-in is saved.This searches by the uniqueness key only: the subsequent
write()updates the existing document and backfills its country from the check-in data, so legacy documents self-correct on the guest's next check-in without any data migration.