diff --git a/addons/event/email_template.xml b/addons/event/email_template.xml index c1b2ff1a9a4..4485dfc785a 100644 --- a/addons/event/email_template.xml +++ b/addons/event/email_template.xml @@ -4,13 +4,13 @@ Confirmation of the Event - ${object.user_id.user_email or object.company_id.email or 'noreply@localhost'} + ${object.user_id.user_email or object.company_id.email or 'noreply@' + object.company_id.name + '.com'} ${object.email} - Ticket for ${object.event_id.name} + Your registration at ${object.event_id.name} hello ${object.name}, - The event ${object.event_id.name} that you registered from is confirmed and will be held from ${object.event_id.date_begin} to ${object.event_id.date_end}. For any further information please contact our event department. + The event ${object.event_id.name} that you registered for is confirmed and will be held from ${object.event_id.date_begin} to ${object.event_id.date_end}. For any further information please contact our event department. we thank you for your participation @@ -24,13 +24,13 @@ Confirmation of the Registration - ${object.user_id.user_email or object.company_id.email or 'noreply@localhost'} + ${object.user_id.user_email or object.company_id.email or 'noreply@' + object.company_id.name + '.com'} ${object.email} - Ticket for ${object.event_id.name} + Your registration at ${object.event_id.name} hello ${object.name}, - We confirm your registration to the event ${object.event_id.name} to be held from ${object.event_id.date_begin} to ${object.event_id.date_end} + We confirm you that your registration to the event ${object.event_id.name} has been recorded. You will automatically receive an email providing you more practical information (such as the schedule, the plan...) as soon as the event will be confirmed to be held. we thank you for your participation @@ -38,5 +38,21 @@ + + + default_email_event + default + + + event.type + + + default_email_registration + default + + + event.type + + diff --git a/addons/event/event.py b/addons/event/event.py index ee9aaf9dd48..68161ce128f 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -168,8 +168,8 @@ class event_event(osv.osv): 'register_prospect': fields.function(_get_register, string='Unconfirmed Registrations', multi='register_numbers'), 'register_attended': fields.function(_get_register, string='Attended Registrations', multi='register_numbers'), 'registration_ids': fields.one2many('event.registration', 'event_id', 'Registrations', readonly=False, states={'done': [('readonly', True)]}), - 'date_begin': fields.datetime('Starting Date', required=True, readonly=True, states={'draft': [('readonly', False)]}), - 'date_end': fields.datetime('Closing Date', required=True, readonly=True, states={'draft': [('readonly', False)]}), + 'date_begin': fields.datetime('Start Date', required=True, readonly=True, states={'draft': [('readonly', False)]}), + 'date_end': fields.datetime('End Date', required=True, readonly=True, states={'draft': [('readonly', False)]}), 'state': fields.selection([ ('draft', 'Draft'), ('confirm', 'Confirmed'), @@ -177,7 +177,7 @@ class event_event(osv.osv): ('cancel', 'Cancelled')], 'State', readonly=True, required=True, help='If event is created, the state is \'Draft\'.If event is confirmed for the particular dates the state is set to \'Confirmed\'. If the event is over, the state is set to \'Done\'.If event is cancelled the state is set to \'Cancelled\'.'), - 'email_registration_id' : fields.many2one('email.template','Registration Confirmation Email'), + 'email_registration_id' : fields.many2one('email.template','Registration Confirmation Email', help='This field contains the template of the mail that will be automatically sent each time a registration for this event is confirmed.'), 'email_confirmation_id' : fields.many2one('email.template','Event Confirmation Email', help="If you set an email template, each participant will receive this email announcing the confirmation of the event."), 'full_name' : fields.function(_name_get_fnc, type="char", string='Name'), 'reply_to': fields.char('Reply-To Email', size=64, readonly=False, states={'done': [('readonly', True)]}, help="The email address of the organizer is likely to be put here, with the effect to be in the 'Reply-To' of the mails sent automatically at event or registrations confirmation. You can also put the email address of your mail gateway if you use one."), @@ -269,7 +269,7 @@ class event_registration(osv.osv): """ Open Registration """ res = self.confirm_registration(cr, uid, ids, context=context) - self.mail_user(cr, uid, ids) + self.mail_user(cr, uid, ids, context=context) return res def button_reg_close(self, cr, uid, ids, context=None): @@ -286,19 +286,22 @@ class event_registration(osv.osv): self.message_append(cr, uid, ids,_('State set to...'),body_text= _('Cancel')) return self.write(cr, uid, ids, {'state': 'cancel'}) - def mail_user(self, cr, uid, ids, confirm=False, context=None): + def mail_user(self, cr, uid, ids, context=None): """ Send email to user with email_template when registration is done """ for registration in self.browse(cr, uid, ids, context=context): - template_id = registration.event_id.email_registration_id.id - if template_id: - mail_message = self.pool.get('email.template').send_mail(cr,uid,template_id,registration.id) + if registration.event_id.state == 'confirm' and registration.event_id.email_confirmation_id.id: + self.mail_user_confirm(cr, uid, ids, context=context) + else: + template_id = registration.event_id.email_registration_id.id + if template_id: + mail_message = self.pool.get('email.template').send_mail(cr,uid,template_id,registration.id) return True def mail_user_confirm(self, cr, uid, ids, context=None): """ - Send email to user when the event is done + Send email to user when the event is confirmed """ for registration in self.browse(cr, uid, ids, context=context): template_id = registration.event_id.email_confirmation_id.id diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml index b6c5b8fa5ab..1a77ea637fc 100644 --- a/addons/event/event_view.xml +++ b/addons/event/event_view.xml @@ -16,8 +16,8 @@
- - + +