[FIX] event: allow de installation of all track submodules at once

Website event track module is an advanced event module that is required notably
in some sub modules: live, quizzes, exhibitors.

When unchecking Schedule & Tracks in event settings, submodules checkboxes
are hidden. It means that currently you may uncheck module_website_event_track
while still keeping sub modules (_track_live, _track_quiz, _track_exhibitor)
checked. When saving, modules are uninstalled, then installed again if one
of sub module is still checked.

In this commit we add an onchange so that unchecking track also unchecks all
its sub modules to effectively remove them all.

Task ID-2389569

closes odoo/odoo#62027

X-original-commit: 29f12da08dbbe6037e530dcae9cf570b71894136
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Thibault Delavallée
2020-11-23 08:02:44 +00:00
parent 42d0f6449b
commit bf242ba1dc
+12 -1
View File
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from odoo import fields, models
from odoo import api, fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
@@ -14,3 +14,14 @@ class ResConfigSettings(models.TransientModel):
module_website_event_questions = fields.Boolean("Registration Survey")
module_event_barcode = fields.Boolean("Barcode")
module_website_event_sale = fields.Boolean("Online Ticketing")
@api.onchange('module_website_event_track')
def _onchange_module_website_event_track(self):
""" Reset sub-modules, otherwise you may have track to False but still
have track_live or track_quiz to True, meaning track will come back due
to dependencies of modules. """
for config in self:
if not config.module_website_event_track:
config.module_website_event_track_live = False
config.module_website_event_track_quiz = False
config.module_website_event_track_exhibitor = False