-
-
Notifications
You must be signed in to change notification settings - Fork 162
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
[14.0][MIG] partner_event: Migration to 14.0 #207
Conversation
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/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some little changes according to code review.
|
||
#~ msgid "Event attended registrations number" | ||
#~ msgstr "Nº de registrados que han asistido al evento" | ||
|
||
#~ msgid "Event registrations number" | ||
#~ msgstr "Nº Registros a eventos" | ||
|
||
#~ msgid "Events" | ||
#~ msgstr "Eventos" | ||
|
||
#~ msgid "Partner" | ||
#~ msgstr "Empresa" | ||
|
||
#~ msgid "or" | ||
#~ msgstr "o" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#~ msgid "Event attended registrations number" | |
#~ msgstr "Nº de registrados que han asistido al evento" | |
#~ msgid "Event registrations number" | |
#~ msgstr "Nº Registros a eventos" | |
#~ msgid "Events" | |
#~ msgstr "Eventos" | |
#~ msgid "Partner" | |
#~ msgstr "Empresa" | |
#~ msgid "or" | |
#~ msgstr "o" |
self._prepare_partner(values) | ||
) | ||
values["attendee_partner_id"] = attendee_partner.id | ||
return super(EventRegistration, self).create(vals_list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return super(EventRegistration, self).create(vals_list) | |
return super().create(vals_list) |
) | ||
|
||
def write(self, data): | ||
res = super(ResPartner, self).write(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
res = super(ResPartner, self).write(data) | |
res = super().write(data) |
attendee_partner = self.env.context.get("get_attendee_partner_address", False) | ||
if attendee_partner: | ||
return super(ResPartner, attendee_partner).address_get(adr_pref) | ||
return super(ResPartner, self).address_get(adr_pref) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return super(ResPartner, self).address_get(adr_pref) | |
return super().address_get(adr_pref) |
class TestEventRegistration(common.SavepointCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super(TestEventRegistration, cls).setUpClass() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super(TestEventRegistration, cls).setUpClass() | |
super().setUpClass() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although some small changes could be made they do not block and I think it could be merged.
/ocabot merge nobump |
What a great day to merge this nice PR. Let's do it! |
Congratulations, your PR was merged at 095d604. Thanks a lot for contributing to OCA. ❤️ |
/ocabot migration partner_event |
Migration of
partner_event
from 13.0 to 14.0