mirror of
https://github.com/bringout/oca-mrp.git
synced 2026-04-23 05:32:03 +02:00
Initial commit: OCA Mrp packages (117 packages)
This commit is contained in:
commit
277e84fd7a
4403 changed files with 395154 additions and 0 deletions
19
odoo-bringout-oca-event-partner_event/partner_event/hooks.py
Normal file
19
odoo-bringout-oca-event-partner_event/partner_event/hooks.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Copyright 2019 David Vidal
|
||||
# License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0.html
|
||||
from odoo import SUPERUSER_ID, api
|
||||
|
||||
|
||||
def post_init_hook(cr, registry):
|
||||
"""Preload proper attendee partner for existing registrations using
|
||||
the same rules the module does"""
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
attendees_emails = env["event.registration"].read_group(
|
||||
[("email", "!=", False)], ["email"], groupby="email"
|
||||
)
|
||||
for email in attendees_emails:
|
||||
attendee_partner = env["res.partner"].search(
|
||||
[("email", "=ilike", email["email"])], limit=1
|
||||
)
|
||||
if attendee_partner:
|
||||
attendees = env["event.registration"].search(email["__domain"])
|
||||
attendees.write({"attendee_partner_id": attendee_partner.id})
|
||||
Loading…
Add table
Add a link
Reference in a new issue