diff --git a/addons/event/models/event_config_settings.py b/addons/event/models/event_config_settings.py index ca9210caad4b0a205860c79c44a7e2f2a9714703..786b7ee461cd22efa7d9bd0da3d30c2b5fa93b0e 100644 --- a/addons/event/models/event_config_settings.py +++ b/addons/event/models/event_config_settings.py @@ -1,41 +1,40 @@ # -*- coding: utf-8 -*- -from openerp.osv import fields, osv +from odoo import api, fields, models -class event_config_settings(osv.TransientModel): - _name='event.config.settings' - _inherit='res.config.settings' - _columns = { - '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'), - 'group_email_scheduling': fields.selection([ - (0, "No automated emails"), - (1, 'Schedule emails to attendees and subscribers') - ], "Email Scheduling", - help='You will be able to configure emails, and to schedule them to be automatically sent to the attendees on registration and/or attendance', - implied_group='event.group_email_scheduling'), - 'module_event_barcode': fields.boolean("Scan badges to confirm attendances", - help="Install the event_barcode module"), - } +class event_config_settings(models.TransientModel): + _name = 'event.config.settings' + _inherit = 'res.config.settings' - def set_default_auto_confirmation(self, cr, uid, ids, context=None): - config_value = self.browse(cr, uid, ids, context=context).auto_confirmation - self.pool.get('ir.values').set_default(cr, uid, 'event.config.settings', 'auto_confirmation', config_value) + 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') + group_email_scheduling = fields.Selection([ + (0, "No automated emails"), + (1, 'Schedule emails to attendees and subscribers') + ], "Email Scheduling", + help='You will be able to configure emails, and to schedule them to be automatically sent to the attendees on registration and/or attendance', + implied_group='event.group_email_scheduling') + module_event_barcode = fields.Boolean("Scan badges to confirm attendances", + help="Install the event_barcode module") + + @api.multi + def set_default_auto_confirmation(self): + self.env['ir.values'].set_default('event.config.settings', 'auto_confirmation', self.auto_confirmation) diff --git a/addons/event/models/event_mail.py b/addons/event/models/event_mail.py index ca3414a84f8c8de9823f2031899995b28ec4cff3..a17635efd7dbc5bc074adaaae44d3dfbadd63dac 100644 --- a/addons/event/models/event_mail.py +++ b/addons/event/models/event_mail.py @@ -3,7 +3,7 @@ from datetime import datetime from dateutil.relativedelta import relativedelta -from openerp import api, fields, models, tools +from odoo import api, fields, models, tools _INTERVALS = { diff --git a/addons/event/report/report_event_registration.py b/addons/event/report/report_event_registration.py index ec58f656991932de10fbaa6858805b69fb18353f..a85898094e2f149fe09246ae3c798c4ea6f0c245 100644 --- a/addons/event/report/report_event_registration.py +++ b/addons/event/report/report_event_registration.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from openerp import models, fields +from openerp import api, models, fields from openerp import tools @@ -27,12 +27,13 @@ class report_event_registration(models.Model): name_registration = fields.Char('Participant / Contact Name', readonly=True) company_id = fields.Many2one('res.company', 'Company', readonly=True) - def init(self, cr): + @api.model_cr + def init(self): """Initialize the sql view for the event registration """ - tools.drop_view_if_exists(cr, 'report_event_registration') + tools.drop_view_if_exists(self.env.cr, 'report_event_registration') # TOFIX this request won't select events that have no registration - cr.execute(""" CREATE VIEW report_event_registration AS ( + self.env.cr.execute(""" CREATE VIEW report_event_registration AS ( SELECT e.id::varchar || '/' || coalesce(r.id::varchar,'') AS id, e.id AS event_id,