In website_event some event-specific frontend menus are not linked to ``website.event.menu`` like track or exhibitor sub-modules menus. This comes from initial implementation of ``website.event.menu`` that was available only for ``website_event_track``. Using ``website.event.menu`` eases menu management as it allows to have an object making a link between the event and the website menu. Notably when checking / unchecking in backend submenus it eases management. It also eases management when people manually edit menus from frontend as otherwise we have to manually manage ``ir.ui.view`` based on some naming manipulation. Task ID-2577079 See odoo/odoo#72411
24 lines
869 B
Python
24 lines
869 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import fields, models
|
|
|
|
|
|
class EventMenu(models.Model):
|
|
_name = "website.event.menu"
|
|
_description = "Website Event Menu"
|
|
|
|
menu_id = fields.Many2one('website.menu', string='Menu', ondelete='cascade')
|
|
event_id = fields.Many2one('event.event', string='Event', ondelete='cascade')
|
|
view_id = fields.Many2one('ir.ui.view', string='View', ondelete='cascade', help='Used when not being an url based menu')
|
|
menu_type = fields.Selection(
|
|
[('community', 'Community Menu'),
|
|
('introduction', 'Introduction'),
|
|
('location', 'Location'),
|
|
('register', 'Register'),
|
|
], string="Menu Type", required=True)
|
|
|
|
def unlink(self):
|
|
self.view_id.sudo().unlink()
|
|
return super(EventMenu, self).unlink()
|