[IMP] event: remove the dates from the urls and the default name of the events

PURPOSE

Previously, the url of the events contained the start and end date of
the event. This link can be sent by email. If an administrator changes
the start or the end date of the event, the event will still be accessible
via the provided link. However, the user can be misled because the dates
of the url will no longer match with those set on the event. To avoid
confusion, the start and the end date will be removed from the url.

SPECS

- Remove the start date and the end date of the event from: (1) the urls
  and (2) the default name of the events.

NOTE

Note that URLs are backward compatible as only the ID is really used to
find a record through routes.

LINKS

Task-2347597
COM PR odoo/odoo#69102
ENT PR odoo/enterprise#17612

X-original-commit: 60be7bb337804f2fa59003d6e5dc70ecc9750427
This commit is contained in:
Julien Banken
2021-04-12 10:39:57 +00:00
committed by Thibault Delavallée
parent 17edf6712d
commit c2b099ef76
-11
View File
@@ -480,17 +480,6 @@ class EventEvent(models.Model):
if event.date_end < event.date_begin:
raise ValidationError(_('The closing date cannot be earlier than the beginning date.'))
@api.depends('name', 'date_begin', 'date_end')
def name_get(self):
result = []
for event in self:
date_begin = fields.Datetime.from_string(event.date_begin)
date_end = fields.Datetime.from_string(event.date_end)
dates = [fields.Date.to_string(fields.Datetime.context_timestamp(event, dt)) for dt in [date_begin, date_end] if dt]
dates = sorted(set(dates))
result.append((event.id, '%s (%s)' % (event.name, ' - '.join(dates))))
return result
@api.model
def _read_group_stage_ids(self, stages, domain, order):
return self.env['event.stage'].search([])