[MIG] event: Migrate res_config file to new API
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user