From bf82638bb0a4f780310a9747ffbf5b8ae3b3611e Mon Sep 17 00:00:00 2001 From: Kishan Gajjar Date: Tue, 10 Jan 2017 15:38:47 +0100 Subject: [PATCH] [IMP] event: Improve the settings form view --- addons/event/data/event_data.xml | 2 +- addons/event/models/event_config_settings.py | 39 ++----- addons/event/tests/test_event_flow.py | 4 +- .../views/event_config_settings_views.xml | 101 ++++++++++++++---- addons/website_event/__manifest__.py | 1 + .../views/event_config_settings_views.xml | 25 +++++ 6 files changed, 120 insertions(+), 52 deletions(-) create mode 100644 addons/website_event/views/event_config_settings_views.xml diff --git a/addons/event/data/event_data.xml b/addons/event/data/event_data.xml index b4c1070bf0d..54acbe204a3 100644 --- a/addons/event/data/event_data.xml +++ b/addons/event/data/event_data.xml @@ -9,7 +9,7 @@ - + diff --git a/addons/event/models/event_config_settings.py b/addons/event/models/event_config_settings.py index 5637e72b531..66207c594e6 100644 --- a/addons/event/models/event_config_settings.py +++ b/addons/event/models/event_config_settings.py @@ -1,38 +1,15 @@ # -*- coding: utf-8 -*- -from odoo import api, fields, models +from odoo import fields, models class event_config_settings(models.TransientModel): _name = 'event.config.settings' _inherit = 'res.config.settings' - module_event_sale = fields.Selection([ - (0, "All events are free"), - (1, 'Allow selling tickets') - ], "Tickets", - help='Install the event_sale module') - module_website_event_track = fields.Selection([ - (0, "No mini website per event"), - (1, 'Allow tracks, agenda and dedicated menus/website per event') - ], "Tracks and Agenda", - help='Install the module website_event_track') - module_website_event_questions = fields.Selection([ - (0, "No extra questions on registrations"), - (1, 'Allow adding extra questions on registrations') - ], "Registration Survey", - help='Install the website_event_questions module') - auto_confirmation = fields.Selection([ - (1, 'No validation step on registration'), - (0, "Manually confirm every registration") - ], "Auto Confirmation", - help='Unselect this option to manually manage draft event and draft registration') - module_event_barcode = fields.Boolean("Scan badges to confirm attendances", - help="Install the event_barcode module") - - @api.multi - def set_default_auto_confirmation(self): - if self.env.user._is_admin() or self.env['res.users'].has_group('event.group_event_manager'): - IrValues = self.env['ir.values'].sudo() - else: - IrValues = self.env['ir.values'] - IrValues.set_default('event.config.settings', 'auto_confirmation', self.auto_confirmation) + module_event_sale = fields.Boolean("Tickets") + module_website_event_track = fields.Boolean("Tracks and Agenda") + module_website_event_questions = fields.Boolean("Registration Survey") + default_auto_confirmation = fields.Boolean("Auto Confirmation", default_model='event.config.settings') + module_event_barcode = fields.Boolean("Barcode") + module_website_event = fields.Boolean("Online Events") + module_website_event_sale = fields.Boolean("Online Ticketing") diff --git a/addons/event/tests/test_event_flow.py b/addons/event/tests/test_event_flow.py index 32a722efd85..24d5204c0f8 100644 --- a/addons/event/tests/test_event_flow.py +++ b/addons/event/tests/test_event_flow.py @@ -16,7 +16,7 @@ class TestEventFlow(TestEventCommon): def test_00_basic_event_auto_confirm(self): """ Basic event management with auto confirmation """ event_config = self.env['event.config.settings'].sudo(self.user_eventmanager).create({ - 'auto_confirmation': 1 + 'default_auto_confirmation': 1 }) event_config.execute() @@ -114,7 +114,7 @@ class TestEventFlow(TestEventCommon): ]}) with self.assertRaises(AccessError): event_config = self.env['event.config.settings'].sudo(self.user_eventmanager).create({ - 'auto_confirmation': 1 + 'default_auto_confirmation': 1 }) event_config.execute() diff --git a/addons/event/views/event_config_settings_views.xml b/addons/event/views/event_config_settings_views.xml index ddee7374813..6b18bb9d71d 100644 --- a/addons/event/views/event_config_settings_views.xml +++ b/addons/event/views/event_config_settings_views.xml @@ -1,27 +1,92 @@ - - Configure Event + + event.config.settings.form event.config.settings - -
-
-
- - - - - -