[FIX] website_event_online: take visitor informations from registration time asc
When computing phone and email of a visitor based on its linked registrations take first registration values as more important. Indeed we think first encoded registrations have a better chance to be accurate than the last ones. Task ID-2169118 odoo/odoo#55967 odoo/enterprise#12438 X-original-commit: e983336b2e89101f6123c15848f59a8b8c111342
This commit is contained in:
@@ -43,7 +43,7 @@ class WebsiteVisitor(models.Model):
|
||||
self.flush()
|
||||
|
||||
for visitor in self.filtered(lambda visitor: not visitor.email or not visitor.mobile):
|
||||
linked_registrations = visitor.event_registration_ids.sorted('create_date', reverse=True)
|
||||
linked_registrations = visitor.event_registration_ids.sorted(lambda reg: (reg.create_date, reg.id), reverse=False)
|
||||
if not visitor.email:
|
||||
visitor.email = next((reg.email for reg in linked_registrations if reg.email), False)
|
||||
if not visitor.mobile:
|
||||
|
||||
Reference in New Issue
Block a user