-
-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[18.0][MIG] partner_event: Migration to 18.0 #435
Open
HeliconiaSolutions
wants to merge
47
commits into
OCA:18.0
Choose a base branch
from
HeliconiaIO:18.0-mig-partner_event
base: 18.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,935
−0
Conversation
This file contains 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
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
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
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/
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/it/
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/sv/
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/
The search by email is limited to 1 record and without the order clause is using the default order that is defined in https://github.com/odoo/odoo/blob/7f3863bdeb21ecfb7ac1859641bddf3de5dd8643/odoo/addons/base/models/res_partner.py#L178 and it could be customized since the default order could cause a slow query this adds an "order" clause in the search to prevent the use of the default order and use the ID instead. The partner got from the search has to match with the email searched, so any result is useful for this case.
/ocabot migration partner_event |
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.
No description provided.