From dc13e2442784e4be87994f048d38cce91b2fe8e8 Mon Sep 17 00:00:00 2001 From: Eugene Molotov Date: Thu, 12 Dec 2024 15:37:58 +0500 Subject: [PATCH 1/4] =?UTF-8?q?[FIX]=20website=5Fevent=5Fattendee=5Fsignup?= =?UTF-8?q?:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=D0=B8=20?= =?UTF-8?q?=D1=88=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD,=20=D0=BA=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D1=8B=D0=B9=20=D0=B7=D0=B0=D0=B1=D1=8B=D0=BB=D0=B8?= =?UTF-8?q?=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BF=D0=B8=D1=81=D0=B0=D1=82=D1=8C?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B8=20=D0=BC=D0=B8=D0=B3=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/mail_template_data.xml | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/website_event_attendee_signup/data/mail_template_data.xml b/website_event_attendee_signup/data/mail_template_data.xml index 585fc71..355c5ce 100644 --- a/website_event_attendee_signup/data/mail_template_data.xml +++ b/website_event_attendee_signup/data/mail_template_data.xml @@ -2,34 +2,37 @@ Event: Signup - Welcome to our Portal! - ${object.attendee_partner_id.id} + {{object.attendee_partner_id.email}} - ${object.attendee_partner_id.lang} {{object.attendee_partner_id.lang or object.event_id.lang or object.partner_id.lang}} +

- Hello ${object.attendee_partner_id.name},
+ Hello ,
- You was registered as attendee of ${object.event_id.name}. + You was registered as attendee of . - % if object.attendee_partner_id.signup_token: + Use the link below to sing-up on portal to access your event dashboard: -

+ - % endif +

Best regards,

- ]]> + From 02ecd2bb2f04d72e0b1ad5564ecb832c4fbfdf9f Mon Sep 17 00:00:00 2001 From: Eugene Molotov Date: Thu, 12 Dec 2024 15:40:46 +0500 Subject: [PATCH 2/4] =?UTF-8?q?[FIX]=20website=5Fevent=5Fattendee=5Fsignup?= =?UTF-8?q?:=20=D0=B3=D0=BE=D1=82=D0=BE=D0=B2=D0=B8=D0=BC=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=BA=20=D1=80=D0=B5=D0=B3=D0=B8=D1=81=D1=82=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=B4=D0=BE=20=D0=BE=D1=82=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BA=D0=B8=20=D0=BF=D0=BE=D1=87=D1=82=D1=8B=20=D1=81=20?= =?UTF-8?q?=D1=88=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/event_registration.py | 52 ++++++++++++------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/website_event_attendee_signup/models/event_registration.py b/website_event_attendee_signup/models/event_registration.py index 8a47950..8fcbd37 100644 --- a/website_event_attendee_signup/models/event_registration.py +++ b/website_event_attendee_signup/models/event_registration.py @@ -1,24 +1,38 @@ -from odoo import api, models +from odoo import models class EventRegistration(models.Model): _inherit = "event.registration" - @api.model - def create(self, vals): - res = super().create(vals) - - if res.event_id.attendee_signup and res.attendee_partner_id: - login = res.attendee_partner_id.email - user = self.env["res.users"].search([("login", "=ilike", login)]) - if not user: - user = ( - self.env["res.users"] - .sudo() - ._signup_create_user( - {"login": login, "partner_id": res.attendee_partner_id.id} - ) - ) - user.partner_id.signup_prepare() - - return res + def _update_attendee_partner_id(self, vals): + vals = super()._update_attendee_partner_id(vals) + if not vals.get("attendee_partner_id"): + return vals + + if not vals.get("event_id"): + return vals + + Partner = self.env["res.partner"].sudo() + Users = self.env["res.users"].sudo() + Events = self.env["event.event"].sudo() + + event = Events.browse(vals["event_id"]) + if not event.attendee_signup: + return vals + + attendee_partner = Partner.browse(vals["attendee_partner_id"]) + if attendee_partner.user_ids: + # already has user + return vals + + login = attendee_partner.email + user = Users.search([("login", "=ilike", login)]) + if user: + # already has user with given address + return vals + + user = Users._signup_create_user( + {"login": login, "partner_id": attendee_partner.id} + ) + user.partner_id.signup_prepare() + return vals From ba701e65e1f0c490c87bf0dc1c900dc597b0117e Mon Sep 17 00:00:00 2001 From: Eugene Molotov Date: Fri, 13 Dec 2024 15:25:19 +0500 Subject: [PATCH 3/4] =?UTF-8?q?fixup!=20[FIX]=20website=5Fevent=5Fattendee?= =?UTF-8?q?=5Fsignup:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=D0=B8=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD,=20=D0=BA=D0=BE?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D1=8B=D0=B9=20=D0=B7=D0=B0=D0=B1=D1=8B=D0=BB?= =?UTF-8?q?=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BF=D0=B8=D1=81=D0=B0=D1=82?= =?UTF-8?q?=D1=8C=20=D0=BF=D1=80=D0=B8=20=D0=BC=D0=B8=D0=B3=D1=80=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- website_event_attendee_signup/data/mail_template_data.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/website_event_attendee_signup/data/mail_template_data.xml b/website_event_attendee_signup/data/mail_template_data.xml index 355c5ce..5f46611 100644 --- a/website_event_attendee_signup/data/mail_template_data.xml +++ b/website_event_attendee_signup/data/mail_template_data.xml @@ -2,8 +2,13 @@ Event: Signup + {{ (object.event_id.organizer_id.email_formatted or object.event_id.user_id.email_formatted or '') }} Welcome to our Portal! - {{object.attendee_partner_id.email}} + {{object.attendee_partner_id.email or object.partner_id.email}} Date: Mon, 16 Dec 2024 17:25:59 +0500 Subject: [PATCH 4/4] =?UTF-8?q?fixup!=20fixup!=20[FIX]=20website=5Fevent?= =?UTF-8?q?=5Fattendee=5Fsignup:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=D0=B8=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD,=20?= =?UTF-8?q?=D0=BA=D0=BE=D1=82=D0=BE=D1=80=D1=8B=D0=B9=20=D0=B7=D0=B0=D0=B1?= =?UTF-8?q?=D1=8B=D0=BB=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=B0=D1=82=D1=8C=20=D0=BF=D1=80=D0=B8=20=D0=BC=D0=B8=D0=B3?= =?UTF-8?q?=D1=80=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- website_event_attendee_signup/models/event_registration.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/website_event_attendee_signup/models/event_registration.py b/website_event_attendee_signup/models/event_registration.py index 8fcbd37..318cabf 100644 --- a/website_event_attendee_signup/models/event_registration.py +++ b/website_event_attendee_signup/models/event_registration.py @@ -26,6 +26,9 @@ def _update_attendee_partner_id(self, vals): return vals login = attendee_partner.email + if not login: + return vals + user = Users.search([("login", "=ilike", login)]) if user: # already has user with given address