[IMP] event: remove seats_min and default_registration_min from event model
PURPOSE This field is deprecated. Since its usage was to trigger a warning when trying to confirm an event and confirming an event is not done anymore, it has become obsolete. SPECIFICATION remove seats_min field and usage from event.event remove default_registration_min field and usage from event.type LINKS Task ID : 2192652 PR : #44938
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
'name': 'Events Organization',
|
||||
'version': '1.0',
|
||||
'version': '1.1',
|
||||
'website': 'https://www.odoo.com/page/events',
|
||||
'category': 'Marketing/Events',
|
||||
'summary': 'Trainings, Conferences, Meetings, Exhibitions, Registrations',
|
||||
|
||||
@@ -49,9 +49,6 @@ class EventType(models.Model):
|
||||
readonly=False, store=True)
|
||||
# registration
|
||||
has_seats_limitation = fields.Boolean('Limited Seats')
|
||||
default_registration_min = fields.Integer(
|
||||
'Minimum Registrations', default=0,
|
||||
help="It will select this default minimum value when you choose this event")
|
||||
default_registration_max = fields.Integer(
|
||||
'Maximum Registrations', default=0,
|
||||
help="It will select this default maximum value when you choose this event")
|
||||
@@ -86,7 +83,6 @@ class EventType(models.Model):
|
||||
@api.onchange('has_seats_limitation')
|
||||
def _onchange_has_seats_limitation(self):
|
||||
if not self.has_seats_limitation:
|
||||
self.default_registration_min = 0
|
||||
self.default_registration_max = 0
|
||||
|
||||
|
||||
@@ -135,9 +131,6 @@ class EventEvent(models.Model):
|
||||
seats_availability = fields.Selection(
|
||||
[('unlimited', 'Unlimited'), ('limited', 'Limited')],
|
||||
'Maximum Attendees', required=True, default='unlimited')
|
||||
seats_min = fields.Integer(
|
||||
string='Minimum Attendees',
|
||||
help="For each event you can define a minimum reserved seats (number of attendees), if it does not reach the mentioned registrations the event can not be confirmed (keep 0 to ignore this rule)")
|
||||
seats_reserved = fields.Integer(
|
||||
string='Reserved Seats',
|
||||
store=True, readonly=True, compute='_compute_seats')
|
||||
@@ -292,7 +285,6 @@ class EventEvent(models.Model):
|
||||
@api.onchange('event_type_id')
|
||||
def _onchange_type(self):
|
||||
if self.event_type_id:
|
||||
self.seats_min = self.event_type_id.default_registration_min
|
||||
self.seats_max = self.event_type_id.default_registration_max
|
||||
if self.event_type_id.default_registration_max:
|
||||
self.seats_availability = 'limited'
|
||||
@@ -325,11 +317,6 @@ class EventEvent(models.Model):
|
||||
|
||||
self.event_ticket_ids = [(5, 0, 0)] + [(0, 0, item) for item in all_ticket_values]
|
||||
|
||||
@api.constrains('seats_min', 'seats_max', 'seats_availability')
|
||||
def _check_seats_min_max(self):
|
||||
if any(event.seats_availability == 'limited' and event.seats_min > event.seats_max for event in self):
|
||||
raise ValidationError(_('Maximum attendees number should be greater than minimum attendees number.'))
|
||||
|
||||
@api.constrains('seats_max', 'seats_available')
|
||||
def _check_seats_limit(self):
|
||||
if any(event.seats_availability == 'limited' and event.seats_max and event.seats_available < 0 for event in self):
|
||||
|
||||
@@ -53,7 +53,6 @@ class TestEventCommon(common.SavepointCase):
|
||||
'auto_confirm': True,
|
||||
'is_online': False,
|
||||
'has_seats_limitation': True,
|
||||
'default_registration_min': 10,
|
||||
'default_registration_max': 30,
|
||||
'use_timezone': True,
|
||||
'default_timezone': 'Europe/Paris',
|
||||
|
||||
@@ -132,7 +132,6 @@ class TestEventData(TestEventCommon):
|
||||
event._onchange_type()
|
||||
self.assertEqual(event.date_tz, 'Europe/Paris')
|
||||
self.assertEqual(event.seats_availability, 'limited')
|
||||
self.assertEqual(event.seats_min, event_type.default_registration_min)
|
||||
self.assertEqual(event.seats_max, event_type.default_registration_max)
|
||||
self.assertTrue(event.auto_confirm)
|
||||
self.assertFalse(event.is_online)
|
||||
@@ -259,13 +258,11 @@ class TestEventTypeData(TestEventCommon):
|
||||
event_type = self.env['event.type'].create({
|
||||
'name': 'Testing fields computation',
|
||||
'has_seats_limitation': True,
|
||||
'default_registration_min': 5,
|
||||
'default_registration_max': 30,
|
||||
'use_ticket': True,
|
||||
})
|
||||
event_type._onchange_has_seats_limitation()
|
||||
self.assertTrue(event_type.has_seats_limitation)
|
||||
self.assertEqual(event_type.default_registration_min, 5)
|
||||
self.assertEqual(event_type.default_registration_max, 30)
|
||||
self.assertEqual(event_type.event_type_ticket_ids.mapped('name'), ['Registration'])
|
||||
|
||||
@@ -273,7 +270,6 @@ class TestEventTypeData(TestEventCommon):
|
||||
event_type.write({'has_seats_limitation': False})
|
||||
event_type._onchange_has_seats_limitation()
|
||||
self.assertFalse(event_type.has_seats_limitation)
|
||||
self.assertEqual(event_type.default_registration_min, 0)
|
||||
self.assertEqual(event_type.default_registration_max, 0)
|
||||
|
||||
# reset tickets
|
||||
|
||||
@@ -79,9 +79,6 @@
|
||||
<label for="has_seats_limitation"/>
|
||||
<div class="row">
|
||||
<div class="col-lg-8 mt16" attrs="{'invisible': [('has_seats_limitation', '=', False)]}">
|
||||
<div>
|
||||
<label for="default_registration_min"/> <field name="default_registration_min"/>
|
||||
</div>
|
||||
<div>
|
||||
<label for="default_registration_max"/> <field name="default_registration_max"/>
|
||||
</div>
|
||||
@@ -242,7 +239,6 @@
|
||||
<field name="date_tz"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="seats_min"/>
|
||||
<label for="seats_availability"/>
|
||||
<div>
|
||||
<field name="seats_availability" widget='radio'/>
|
||||
@@ -299,14 +295,13 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Events"
|
||||
decoration-bf="message_needaction==True"
|
||||
decoration-danger="(seats_min and seats_min>seats_reserved) or (seats_max and seats_max<seats_reserved)"
|
||||
decoration-danger="(seats_max and seats_max<seats_reserved)"
|
||||
multi_edit="1">
|
||||
<field name="name"/>
|
||||
<field name="event_type_id" readonly="1"/>
|
||||
<field name="date_begin" readonly="1"/>
|
||||
<field name="date_end" readonly="1"/>
|
||||
<field name="seats_reserved" sum="Total" readonly="1"/>
|
||||
<field name="seats_min" readonly="1"/>
|
||||
<field name="seats_max" invisible="1" readonly="1"/>
|
||||
<field name="user_id" readonly="1"/>
|
||||
<field name="message_needaction" invisible="1" readonly="1"/>
|
||||
|
||||
Reference in New Issue
Block a user