Skip to content

[19.0][MIG] partner_event: Migration to 19.0#503

Merged
OCA-git-bot merged 44 commits into
OCA:19.0from
c4a8-odoo:19.0-mig-partner_event
May 22, 2026
Merged

[19.0][MIG] partner_event: Migration to 19.0#503
OCA-git-bot merged 44 commits into
OCA:19.0from
c4a8-odoo:19.0-mig-partner_event

Conversation

@CRogos
Copy link
Copy Markdown
Contributor

@CRogos CRogos commented May 21, 2026

supersede: #482

antespi and others added 30 commits October 6, 2025 14:00
These fields were stored. That usually is good, but if you add partners to an event from the wizard, it means each `res.partner` record gets its `registration_count` field updated.

When you update any record, fields `write_uid` and `write_date` are updated too.

Now imagine you want to add 4000 partners to an event. That would take time. If in the mean time any other user updates the `res.partner` record (along with their `write_UID` and `WRITE_DATE` fields), you would get this error:

```
openerp.sql_db: bad query: UPDATE "res_partner" SET "registration_count"=3,"write_uid"=5,"write_date"=(now() at time zone 'UTC') WHERE id IN (25578)
Traceback (most recent call last):
  File "/opt/odoo/common/openerp/v8/openerp/sql_db.py", line 234, in execute
    res = self._obj.execute(query, params)
TransactionRollbackError: could not serialize access due to concurrent update
CONTEXT:  SQL statement "SELECT 1 FROM ONLY "public"."res_users" x WHERE "id" OPERATOR(pg_catalog.=) $1 FOR KEY SHARE OF x"
```

By removing the `store=True` parameter, you simply avoid those concurrent updates and do not block other users.

But this changes the database structure, so remember to update your database!
If adding 1000 partners, we save now 999 queries.

(cherry picked from commit 89853ef)
Currently translated at 100.0% (24 of 24 strings)

Translation: event-12.0/event-12.0-partner_event
Translate-URL: https://translation.odoo-community.org/projects/event-12-0/event-12-0-partner_event/es/
…oint

For speeding up the process. Specially the removal of the savepoints
makes that Postgres don't go slow as hell. Check
https://www.cybertec-postgresql.com/en/subtransactions-and-performance-in-postgresql/
for some rationale. The problem happens even releasing the previous
savepoints.

As this module is very old, the reason for doing it this way and skip
registrations with error is not fully known, but the view mentions about
registration duplication, so let's avoid it and handle later other
possible exceptions.

TT26694
When we confirm a sale order, the registrations are precreated without
the email info, so we were missing the chance to get the info for the
partner attendant.

Now we compute it on the write as well.

TT45149
[UPD] Update partner_event.pot

[BOT] post-merge updates

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: event-16.0/event-16.0-partner_event
Translate-URL: https://translation.odoo-community.org/projects/event-16-0/event-16-0-partner_event/
Currently translated at 100.0% (23 of 23 strings)

Translation: event-16.0/event-16.0-partner_event
Translate-URL: https://translation.odoo-community.org/projects/event-16-0/event-16-0-partner_event/es/
Currently translated at 100.0% (23 of 23 strings)

Translation: event-16.0/event-16.0-partner_event
Translate-URL: https://translation.odoo-community.org/projects/event-16-0/event-16-0-partner_event/it/
Steps to reproduce:

- Have several partners with the same email.
- Generate an event registration for each of the partners.
- Launch the contact merge wizard.
- Select the destination contact the one with the name that is
  alphabetically later.
- Launch the merge.

Current behavior:

Model: Event Registration (event.registration), Constraint: event_registration_attendee_partner_id_fkey

ERROR: update or delete on table "res_partner" violates foreign key constraint "event_registration_attendee_partner_id_fkey" on table "event_registration"
DETAIL:  Key (id)=(NNN) is still referenced from table "event_registration"

Expected behavior:

Succesful merge.

The problem arises when ORM launches a flush before unlinking partners.
Such recomputation launches a write on existing event registration
records, which calls the update of the attendee_partner_id.

To prevent it, we just skip such process if performing the merge.

TT46798

[UPD] Update partner_event.pot

[BOT] post-merge updates

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: event-16.0/event-16.0-partner_event
Translate-URL: https://translation.odoo-community.org/projects/event-16-0/event-16-0-partner_event/
Currently translated at 100.0% (24 of 24 strings)

Translation: event-16.0/event-16.0-partner_event
Translate-URL: https://translation.odoo-community.org/projects/event-16-0/event-16-0-partner_event/es/
remi-filament and others added 5 commits October 6, 2025 14:00
A user accessing contacts without event access permission will get an
event.registration access error. To avoid this, the event user group
is added to the event.registration button of the res.partner form.

[BOT] post-merge updates

[UPD] Update partner_event.pot

[BOT] post-merge updates

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: event-17.0/event-17.0-partner_event
Translate-URL: https://translation.odoo-community.org/projects/event-17-0/event-17-0-partner_event/
Currently translated at 100.0% (24 of 24 strings)

Translation: event-17.0/event-17.0-partner_event
Translate-URL: https://translation.odoo-community.org/projects/event-17-0/event-17-0-partner_event/it/
TT57319

Co-authored-by: Bhavesh Heliconia <oca@heliconia.in>
@CRogos
Copy link
Copy Markdown
Contributor Author

CRogos commented May 21, 2026

@pedrobaeza shall we merge? Same as #482 but with squashed history. The other PR has already 3 reviews but was inactive.

@pedrobaeza
Copy link
Copy Markdown
Member

/ocabot migration partner_event

I'm missing here #499

@OCA-git-bot OCA-git-bot added this to the 19.0 milestone May 21, 2026
@OCA-git-bot
Copy link
Copy Markdown
Contributor

The migration issue (#481) has not been updated to reference the current pull request because a previous pull request (#482) is not closed.
Perhaps you should check that there is no duplicate work.
CC @nihelgabsi-acsone

@pedrobaeza
Copy link
Copy Markdown
Member

/ocabot migration partner_event

@OCA-git-bot OCA-git-bot mentioned this pull request May 21, 2026
16 tasks
Copy link
Copy Markdown

@MohamedOsman7 MohamedOsman7 left a comment

Choose a reason for hiding this comment

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

Tested! Code & functional review LGTM

@MohamedOsman7
Copy link
Copy Markdown

@pedrobaeza can you merge?

@CRogos CRogos force-pushed the 19.0-mig-partner_event branch from 95b306e to 99de351 Compare May 21, 2026 16:27
@CRogos
Copy link
Copy Markdown
Contributor Author

CRogos commented May 21, 2026

I've added #499 before the migration via cherry-pick. Tested and working.

Copy link
Copy Markdown
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.

/ocabot merge nobump

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 19.0-ocabot-merge-pr-503-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 9940c78 into OCA:19.0 May 22, 2026
7 checks passed
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 8e0425b. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.