[REM] calendar: Remove useless state field

This commit removes the `state` field of calendar events.
The field was not displayed on any view and never used by any business code.

Task 2126717
PR #42031
PR Enterprise odoo/enterprise#8006
This commit is contained in:
Lucas Lefèvre
2020-04-09 10:56:37 +02:00
parent b0f1086e1b
commit 658c062e6d
4 changed files with 12 additions and 23 deletions
-7
View File
@@ -45,7 +45,6 @@
<field name="stop" eval="time.strftime('%Y-%m-03 16:30:00')"/>
<field name="duration" eval="6.3"/>
<field name="allday" eval="False"/>
<field name="state">open</field>
</record>
<record id="calendar_event_2" model="calendar.event">
@@ -59,7 +58,6 @@
<field name="stop" eval="time.strftime('%Y-%m-05 19:00:00')"/>
<field name="allday" eval="False"/>
<field name="duration" eval="7.0"/>
<field name="state">draft</field>
</record>
<record id="calendar_event_3" model="calendar.event">
@@ -73,7 +71,6 @@
<field name="stop" eval="time.strftime('%Y-%m-12 18:55:05')"/>
<field name="duration" eval="3.0"/>
<field name="allday" eval="False"/>
<field name="state">open</field>
</record>
<record id="calendar_event_4" model="calendar.event">
@@ -86,7 +83,6 @@
<field name="stop" eval="time.strftime('%Y-%m-20 10:30:00')"/>
<field name="duration" eval="2.5"/>
<field name="allday" eval="False"/>
<field name="state">open</field>
</record>
<record id="calendar_event_5" model="calendar.event">
@@ -98,7 +94,6 @@
<field name="start" eval="time.strftime('%Y-%m-22')"/>
<field name="stop" eval="time.strftime('%Y-%m-22')"/>
<field name="allday" eval="True"/>
<field name="state">open</field>
</record>
<record id="calendar_event_6" model="calendar.event">
@@ -111,7 +106,6 @@
<field name="stop" eval="time.strftime('%Y-%m-18 10:30:00')"/>
<field name="duration" eval="8.5"/>
<field name="allday" eval="False"/>
<field name="state">draft</field>
</record>
<record id="calendar_event_7" model="calendar.event">
@@ -124,7 +118,6 @@
<field name="stop" eval="time.strftime('%Y-%m-16')"/>
<field name="duration" eval="8.5"/>
<field name="allday" eval="True"/>
<field name="state">draft</field>
</record>
+12 -13
View File
@@ -121,7 +121,7 @@ class Meeting(models.Model):
def _get_public_fields(self):
return self._get_recurrent_fields() | {
'id', 'active', 'allday', 'start', 'stop', 'display_start',
'display_stop', 'duration', 'user_id', 'state', 'interval',
'display_stop', 'duration', 'user_id', 'interval',
'count', 'rrule', 'recurrence_id', 'show_as'}
@api.model
@@ -189,8 +189,7 @@ class Meeting(models.Model):
for event in self:
event.is_highlighted = False
name = fields.Char('Meeting Subject', required=True, states={'done': [('readonly', True)]})
state = fields.Selection([('draft', 'Unconfirmed'), ('open', 'Confirmed')], string='Status', readonly=True, tracking=True, default='draft')
name = fields.Char('Meeting Subject', required=True)
is_attendee = fields.Boolean('Attendee', compute='_compute_attendee')
attendee_status = fields.Selection(Attendee.STATE_SELECTION, string='Attendee Status', compute='_compute_attendee')
@@ -199,17 +198,17 @@ class Meeting(models.Model):
start = fields.Datetime('Start', required=True, help="Start date of an event, without time for full days events")
stop = fields.Datetime('Stop', required=True, help="Stop date of an event, without time for full days events")
allday = fields.Boolean('All Day', states={'done': [('readonly', True)]}, default=False)
start_date = fields.Date('Start Date', compute='_compute_dates', inverse='_inverse_dates', store=True, states={'done': [('readonly', True)]}, tracking=True)
start_datetime = fields.Datetime('Start DateTime', compute='_compute_dates', inverse='_inverse_dates', store=True, states={'done': [('readonly', True)]}, tracking=True)
stop_date = fields.Date('End Date', compute='_compute_dates', inverse='_inverse_dates', store=True, states={'done': [('readonly', True)]}, tracking=True)
stop_datetime = fields.Datetime('End Datetime', compute='_compute_dates', inverse='_inverse_dates', store=True, states={'done': [('readonly', True)]}, tracking=True) # old date_deadline
allday = fields.Boolean('All Day', default=False)
start_date = fields.Date('Start Date', compute='_compute_dates', inverse='_inverse_dates', store=True, tracking=True)
start_datetime = fields.Datetime('Start DateTime', compute='_compute_dates', inverse='_inverse_dates', store=True, tracking=True)
stop_date = fields.Date('End Date', compute='_compute_dates', inverse='_inverse_dates', store=True, tracking=True)
stop_datetime = fields.Datetime('End Datetime', compute='_compute_dates', inverse='_inverse_dates', store=True, tracking=True) # old date_deadline
event_tz = fields.Selection('_event_tz_get', string='Timezone', default=lambda self: self.env.context.get('tz') or self.user_id.tz)
duration = fields.Float('Duration', compute='_compute_dates', inverse='_inverse_duration', compute_sudo=True, states={'done': [('readonly', True)]})
description = fields.Text('Description', states={'done': [('readonly', True)]})
privacy = fields.Selection([('public', 'Everyone'), ('private', 'Only me'), ('confidential', 'Only internal users')], 'Privacy', default='public', states={'done': [('readonly', True)]}, required=True)
location = fields.Char('Location', states={'done': [('readonly', True)]}, tracking=True, help="Location of Event")
show_as = fields.Selection([('free', 'Free'), ('busy', 'Busy')], 'Show Time as', states={'done': [('readonly', True)]}, default='busy', required=True)
duration = fields.Float('Duration', compute='_compute_dates', inverse='_inverse_duration', compute_sudo=True)
description = fields.Text('Description')
privacy = fields.Selection([('public', 'Everyone'), ('private', 'Only me'), ('confidential', 'Only internal users')], 'Privacy', default='public', required=True)
location = fields.Char('Location', tracking=True, help="Location of Event")
show_as = fields.Selection([('free', 'Free'), ('busy', 'Busy')], 'Show Time as', default='busy', required=True)
# linked document
res_id = fields.Integer('Document ID')
-2
View File
@@ -72,7 +72,6 @@
<field name="stop" string="End Date"/>
<field name="partner_ids" readonly="1"/>
<field name="location"/>
<field name="state" invisible="True"/>
<field name="duration" widget="float_time" readonly="1"/>
<field name="message_needaction" invisible="1"/>
</tree>
@@ -96,7 +95,6 @@
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
<field name="res_model" invisible="1" />
<field name="res_id" invisible="1" />
<field name="state" invisible="1"/>
<field name="is_attendee" invisible="1"/>
<field name="attendee_status" invisible="1"/>
<field name="active" invisible="1"/>
-1
View File
@@ -847,7 +847,6 @@ class HolidaysRequest(models.Model):
'start': self.date_from,
'stop': self.date_to,
'allday': False,
'state': 'open', # to block that meeting date in the calendar
'privacy': 'confidential',
'event_tz': self.user_id.tz,
'activity_ids': [(5, 0, 0)],