Browse Source

[IMP] put mail template id in a dedicated function

pull/7/head
houssine 6 years ago
parent
commit
289244b003
  1. 7
      easy_my_coop/models/coop.py

7
easy_my_coop/models/coop.py

@ -31,9 +31,14 @@ class SubscriptionRequest(models.Model):
def get_required_field(self): def get_required_field(self):
return _REQUIRED return _REQUIRED
def get_mail_template_notif(self):
return'easy_my_coop.email_template_confirmation'
@api.model @api.model
def create(self, vals): def create(self, vals):
partner_obj = self.env['res.partner'] partner_obj = self.env['res.partner']
mail_template = self.get_mail_template_notif()
if not vals.get('partner_id'): if not vals.get('partner_id'):
cooperator = False cooperator = False
if vals.get('no_registre'): if vals.get('no_registre'):
@ -61,7 +66,7 @@ class SubscriptionRequest(models.Model):
subscr_request = super(SubscriptionRequest, self).create(vals) subscr_request = super(SubscriptionRequest, self).create(vals)
confirmation_mail_template = self.env.ref('easy_my_coop.email_template_confirmation', False)
confirmation_mail_template = self.env.ref(mail_template, False)
confirmation_mail_template.send_mail(subscr_request.id) confirmation_mail_template.send_mail(subscr_request.id)
return subscr_request return subscr_request

Loading…
Cancel
Save