def button_done(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state': 'done'}, context=context)
- def confirmation_event(self,cr,uid,ids,context=None):
+ def check_registration_limits(self, cr, uid, ids, context=None):
register_pool = self.pool.get('event.registration')
for self.event in self.browse(cr, uid, ids, context=context):
total_confirmed = self.event.register_current
if total_confirmed < self.event.register_min or total_confirmed > self.event.register_max and self.event.register_max!=0:
raise osv.except_osv(_('Error!'),_("The total of confirmed registration for the event '%s' does not meet the expected minimum/maximum. You should maybe reconsider those limits before going further") % (self.event.name))
- def confirmation_email(self,cr,uid,ids,context=None):
+ def confirm_event(self, cr, uid, ids, context=None):
register_pool = self.pool.get('event.registration')
if self.event.email_confirmation_id:
#send reminder that will confirm the event for all the people that were already confirmed
def button_confirm(self, cr, uid, ids, context=None):
""" Confirm Event and send confirmation email to all register peoples
"""
- #renforcing method : create a list of ids
if isinstance(ids, (int, long)):
ids = [ids]
- self.confirmation_event(cr,uid,ids,context=context)
- self.confirmation_email(cr,uid,ids,context=context)
- return True
+ self.check_registration_limits(cr, uid, ids, context=context)
+ return self.confirm_event(cr, uid, ids, context=context)
+
def _get_register(self, cr, uid, ids, fields, args, context=None):
"""Get Confirm or uncofirm register value.
@param ids: List of Event registration type's id
def do_draft(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state': 'draft'}, context=context)
- def confirmation_registration(self, cr, uid, ids, context=None):
- res = self.write(cr, uid, ids, {'state': 'open'}, context=context)
+ def confirm_registration(self, cr, uid, ids, context=None):
self.message_append(cr, uid, ids,_('State set to...'),body_text= _('Open'))
- return res
+ return self.write(cr, uid, ids, {'state': 'open'}, context=context)
- def email_registration(self, cr, uid, ids, context=None):
- self.mail_user(cr, uid, ids)
def registration_open(self, cr, uid, ids, context=None):
""" Open Registration
"""
- self.confirmation_registration(cr, uid, ids, context=context)
- self.email_registration(cr, uid, ids, context=context)
- return True
+ res = self.confirm_registration(cr, uid, ids, context=context)
+ self.mail_user(cr, uid, ids)
+ return res
def button_reg_close(self, cr, uid, ids, context=None):
""" Close Registration
'moodle_id': fields.integer('Moodle ID', help='The identifier of this event in Moodle'),
}
- def confirmation_event(self, cr, uid, ids, context=None):
+ def check_registration_limits(self, cr, uid, ids, context=None):
"""
create moodle courses ,users and match them when an event is confirmed
if the event_registration is not confirmed then it doesn t nothing
"""
+ res = super(event_event, self).check_registration_limits(cr, uid, ids, context=context)
moodle_pool = self.pool.get('event.moodle.config.wiz')
moodle_config_wiz_id = moodle_pool.find(cr, uid, context=context)
list_users=[]
'courseid' :response_courses[0]['id']
})
moodle_pool.moodle_enrolled(cr, uid, moodle_config_wiz_id, enrolled, context=context)
- return super(event_event, self).confirmation_event(cr, uid, ids, context)
+ return res
event_event()
'moodle_uid': fields.integer('Moodle User ID'),
}
- def confirmation_registration(self, cr, uid, ids, context=None):
+ def confirm_registration(self, cr, uid, ids, context=None):
"""
create a user and match to a course if the event is already confirmed
"""
+ res = super(event_registration, self).confirm_registration(cr, uid, ids, context=context)
moodle_pool = self.pool.get('event.moodle.config.wiz')
moodle_config_wiz_id = moodle_pool.find(cr, uid, context=context)
for register in self.browse(cr, uid, ids, context=context):
'courseid': register.event_id.moodle_id
}]
moodle_pool.moodle_enrolled(cr, uid, moodle_config_wiz_id, enrolled, context=context)
- return super(event_registration, self).confirmation_registration(cr, uid, ids, context=context)
+ return res
def onchange_moodle_name(self, cr, uid, ids, moodle_username, context=None):
"""