diff --git a/addons/event/__manifest__.py b/addons/event/__manifest__.py index 005e66e6a98..3dc6be1a116 100644 --- a/addons/event/__manifest__.py +++ b/addons/event/__manifest__.py @@ -27,6 +27,7 @@ Key Features 'views/event_stage_views.xml', 'report/event_event_templates.xml', 'report/event_event_reports.xml', + 'data/ir_cron_data.xml', 'data/mail_template_data.xml', 'data/event_data.xml', 'views/res_config_settings_views.xml', diff --git a/addons/event/data/event_data.xml b/addons/event/data/event_data.xml index e08d0744b74..bcaeb997ffe 100644 --- a/addons/event/data/event_data.xml +++ b/addons/event/data/event_data.xml @@ -1,19 +1,6 @@ - - - Event: Mail Scheduler - - code - model.run(True) - - 1 - hours - -1 - - - Ticketing diff --git a/addons/event/data/ir_cron_data.xml b/addons/event/data/ir_cron_data.xml new file mode 100644 index 00000000000..d0ffda9d0ae --- /dev/null +++ b/addons/event/data/ir_cron_data.xml @@ -0,0 +1,15 @@ + + + + + Event: Mail Scheduler + + code + model.run(True) + + 1 + hours + -1 + + + diff --git a/addons/event/models/event_registration.py b/addons/event/models/event_registration.py index 5b14153be03..94988477c2a 100644 --- a/addons/event/models/event_registration.py +++ b/addons/event/models/event_registration.py @@ -208,6 +208,36 @@ class EventRegistration(models.Model): def action_cancel(self): self.write({'state': 'cancel'}) + def action_send_badge_email(self): + """ Open a window to compose an email, with the template - 'event_badge' + message loaded by default + """ + self.ensure_one() + template = self.env.ref('event.event_registration_mail_template_badge') + compose_form = self.env.ref('mail.email_compose_message_wizard_form') + ctx = dict( + default_model='event.registration', + default_res_id=self.id, + default_use_template=bool(template), + default_template_id=template.id, + default_composition_mode='comment', + custom_layout="mail.mail_notification_light", + ) + return { + 'name': _('Compose Email'), + 'type': 'ir.actions.act_window', + 'view_mode': 'form', + 'res_model': 'mail.compose.message', + 'views': [(compose_form.id, 'form')], + 'view_id': compose_form.id, + 'target': 'new', + 'context': ctx, + } + + # ------------------------------------------------------------ + # MAILING / GATEWAY + # ------------------------------------------------------------ + def _message_get_suggested_recipients(self): recipients = super(EventRegistration, self)._message_get_suggested_recipients() public_users = self.env['res.users'].sudo() @@ -248,31 +278,9 @@ class EventRegistration(models.Model): ]).write({'partner_id': new_partner.id}) return super(EventRegistration, self)._message_post_after_hook(message, msg_vals) - def action_send_badge_email(self): - """ Open a window to compose an email, with the template - 'event_badge' - message loaded by default - """ - self.ensure_one() - template = self.env.ref('event.event_registration_mail_template_badge') - compose_form = self.env.ref('mail.email_compose_message_wizard_form') - ctx = dict( - default_model='event.registration', - default_res_id=self.id, - default_use_template=bool(template), - default_template_id=template.id, - default_composition_mode='comment', - custom_layout="mail.mail_notification_light", - ) - return { - 'name': _('Compose Email'), - 'type': 'ir.actions.act_window', - 'view_mode': 'form', - 'res_model': 'mail.compose.message', - 'views': [(compose_form.id, 'form')], - 'view_id': compose_form.id, - 'target': 'new', - 'context': ctx, - } + # ------------------------------------------------------------ + # TOOLS + # ------------------------------------------------------------ def get_date_range_str(self): self.ensure_one()