RATIONALE Merge two phone-related field on registration as they overlap. Having only one is sufficient for contact-oriented model like registration. SPECIFICATIONS Registration model currently holds two phone field, phone and mobile. This leads to having records with sometimes phone, sometimes mobile being filled. This makes phone flows not easy: we have to define fallbacks (use phone or mobile), data is not always synchronized, ... in the end what event users need is one phone field to be able to communicate with attendees. Having only one field is sufficient and simplifies the model. Keep only one phone field, instead of two. Merge phone and mobile into a single one, keeping phone as first value when having both available e.g. when synchronizing with the partner. Task-3366899 Part-of: odoo/odoo#128232 Co-authored-by: "Jeremy Hennecart" <jeh@odoo.com>
23 lines
1.0 KiB
Python
23 lines
1.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import fields, models
|
|
|
|
|
|
class EventRegistration(models.Model):
|
|
_name = 'event.registration'
|
|
_inherit = ['event.registration']
|
|
|
|
visitor_id = fields.Many2one('website.visitor', string='Visitor', ondelete='set null')
|
|
registration_answer_ids = fields.One2many('event.registration.answer', 'registration_id', string='Attendee Answers')
|
|
registration_answer_choice_ids = fields.One2many('event.registration.answer', 'registration_id', string='Attendee Selection Answers',
|
|
domain=[('question_type', '=', 'simple_choice')])
|
|
|
|
def _get_website_registration_allowed_fields(self):
|
|
return {'name', 'phone', 'email', 'company_name', 'event_id', 'partner_id', 'event_ticket_id'}
|
|
|
|
def _get_registration_summary(self):
|
|
res = super()._get_registration_summary()
|
|
res['registration_answers'] = self.registration_answer_ids.filtered('value_answer_id').mapped('display_name')
|
|
return res
|