event_event.py 829 B

1234567891011121314151617181920
  1. # -*- coding: utf-8 -*-
  2. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  3. from odoo import api, fields, models
  4. class Event(models.Model):
  5. _inherit = "event.event"
  6. @api.depends("event_type_id", "website_menu", "community_menu")
  7. def _compute_community_menu(self):
  8. """ At type onchange: synchronize. At website_menu update: synchronize. """
  9. for event in self:
  10. if event.event_type_id and event.event_type_id != event._origin.event_type_id:
  11. event.community_menu = event.event_type_id.community_menu
  12. elif event.website_menu and (event.website_menu != event._origin.website_menu or not event.community_menu):
  13. event.community_menu = True
  14. elif not event.website_menu:
  15. event.community_menu = False