[IMP] event: add properties fields
Purpose: -------- This commit adds properties (and related properties definitions) on the event model. Event stores the definition and it is used on its child registrations. Task-3458627 Part-of: odoo/odoo#137589
This commit is contained in:
committed by
Thibault Delavallée
parent
2d7a49dab1
commit
d245e87d5e
@@ -140,6 +140,8 @@ class EventEvent(models.Model):
|
||||
tag_ids = fields.Many2many(
|
||||
'event.tag', string="Tags", readonly=False,
|
||||
store=True, compute="_compute_tag_ids")
|
||||
# properties
|
||||
registration_properties_definition = fields.PropertiesDefinition('Registration Properties')
|
||||
# Kanban fields
|
||||
kanban_state = fields.Selection([('normal', 'In Progress'), ('done', 'Done'), ('blocked', 'Blocked')], default='normal', copy=False)
|
||||
kanban_state_label = fields.Char(
|
||||
@@ -197,7 +199,6 @@ class EventEvent(models.Model):
|
||||
start_sale_datetime = fields.Datetime(
|
||||
'Start sale date', compute='_compute_start_sale_date',
|
||||
help='If ticketing is used, contains the earliest starting sale date of tickets.')
|
||||
|
||||
# Date fields
|
||||
date_tz = fields.Selection(
|
||||
_tz_get, string='Timezone', required=True,
|
||||
|
||||
@@ -37,7 +37,6 @@ class EventRegistration(models.Model):
|
||||
'event.event.ticket', string='Event Ticket', ondelete='restrict')
|
||||
active = fields.Boolean(default=True)
|
||||
barcode = fields.Char(string='Barcode', default=lambda self: self._get_random_barcode(), readonly=True, copy=False)
|
||||
|
||||
# utm informations
|
||||
utm_campaign_id = fields.Many2one('utm.campaign', 'Campaign', index=True, ondelete='set null')
|
||||
utm_source_id = fields.Many2one('utm.source', 'Source', index=True, ondelete='set null')
|
||||
@@ -66,9 +65,14 @@ class EventRegistration(models.Model):
|
||||
('draft', 'Unconfirmed'), ('cancel', 'Cancelled'),
|
||||
('open', 'Confirmed'), ('done', 'Attended')],
|
||||
string='Status', default='draft', readonly=True, copy=False, tracking=6)
|
||||
# properties
|
||||
registration_properties = fields.Properties(
|
||||
'Properties', definition='event_id.registration_properties_definition', copy=True)
|
||||
|
||||
_sql_constraints = [
|
||||
('barcode_event_uniq', 'unique(barcode)', "Barcode should be unique")
|
||||
]
|
||||
|
||||
@api.depends('partner_id')
|
||||
def _compute_name(self):
|
||||
for registration in self:
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
<field name="utm_source_id"/>
|
||||
</group>
|
||||
</group>
|
||||
<field name="registration_properties" columns="2" hideKanbanOption="1"/>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
<field name="message_follower_ids"/>
|
||||
|
||||
Reference in New Issue
Block a user