From c02fcc5a56e87c8b9060e5bf84555a56590fa927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20-=20Le=20Filament?= <remi@le-filament.com> Date: Fri, 6 Sep 2024 10:08:16 +0200 Subject: [PATCH] [FIX] keep default fields from registrations --- controllers/website_event.py | 4 +-- templates/event_registration_template.xml | 38 ++++++++++++++--------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/controllers/website_event.py b/controllers/website_event.py index 4ce203e..b9acfed 100644 --- a/controllers/website_event.py +++ b/controllers/website_event.py @@ -11,9 +11,7 @@ from odoo.addons.website_event_questions.controllers.main import WebsiteEvent class WebsiteEventPartnerQuestion(WebsiteEvent): def _process_attendees_form(self, event, form_details): - """Process data posted from the attendee details form. - Extracts question answers: - - For questions of type 'multiple_choice', extracting the suggested answer id""" + """Process data posted from the attendee details form.""" registrations = super()._process_attendees_form(event, form_details) fields_to_update = {} diff --git a/templates/event_registration_template.xml b/templates/event_registration_template.xml index 63e6b1e..c2663b5 100644 --- a/templates/event_registration_template.xml +++ b/templates/event_registration_template.xml @@ -178,33 +178,41 @@ priority="101" > <!-- - in case question_ids are defined, user is connected and we are registering for the first ticket - we hide the 3 default fields and replace by partner related questions + Phone is only displayed if user not connected or if we are not registering the + first contact --> <xpath - expr="//t[@name='attendee_loop']//*[hasclass('modal-body')]/div[hasclass('row')]" + expr="//t[@name='attendee_loop']//*[hasclass('modal-body')]/div[hasclass('row')]/div[input[@type='tel']]" position="attributes" > <attribute name="t-if" - >not event.partner_question_ids or request.env.user._is_public() or counter > 1</attribute> + >request.env.user._is_public() or counter > 1</attribute> </xpath> + <!-- + in case question_ids are defined, user is connected and we are registering for + the first ticket, question_ids are displayed + --> <xpath expr="//t[@name='attendee_loop']//*[hasclass('modal-body')]/div[hasclass('row')]" position="after" > - <div t-else="" class="my-4"> - <div - t-foreach="event.partner_question_ids" - t-as="question" - class="row" - t-att-name="question.title" - > - <t - t-call="solagro_website_event_partner.registration_event_partner_question" - /> + <t + t-if="event.partner_question_ids and not request.env.user._is_public() and counter == 1" + > + <div class="my-4"> + <div + t-foreach="event.partner_question_ids" + t-as="question" + class="row" + t-att-name="question.title" + > + <t + t-call="solagro_website_event_partner.registration_event_partner_question" + /> + </div> </div> - </div> + </t> </xpath> </template> -- GitLab