|
@ -21,6 +21,22 @@ class account_invoice(models.Model): |
|
|
|
|
|
|
|
|
return values |
|
|
return values |
|
|
|
|
|
|
|
|
|
|
|
def create_user(self, partner): |
|
|
|
|
|
user_obj = self.env['res.users'] |
|
|
|
|
|
# TODO replace self by partner |
|
|
|
|
|
email = self.email |
|
|
|
|
|
if self.is_company: |
|
|
|
|
|
email = self.company_email |
|
|
|
|
|
|
|
|
|
|
|
user = user_obj.search([('login', '=', email)]) |
|
|
|
|
|
if not user: |
|
|
|
|
|
user_values = {'partner_id': partner.id, 'login': email} |
|
|
|
|
|
user_id = user_obj.sudo()._signup_create_user(user_values) |
|
|
|
|
|
user = user_obj.browse(user_id) |
|
|
|
|
|
user.sudo().with_context({'create_user': True}).action_reset_password() |
|
|
|
|
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
|
def set_cooperator_effective(self, effective_date): |
|
|
def set_cooperator_effective(self, effective_date): |
|
|
# flag the partner as a effective member |
|
|
# flag the partner as a effective member |
|
|
mail_template_id = 'easy_my_coop.email_template_certificat' |
|
|
mail_template_id = 'easy_my_coop.email_template_certificat' |
|
@ -62,6 +78,9 @@ class account_invoice(models.Model): |
|
|
# we send the email with the certificat in attachment |
|
|
# we send the email with the certificat in attachment |
|
|
certificat_email_template.send_mail(self.partner_id.id, False) |
|
|
certificat_email_template.send_mail(self.partner_id.id, False) |
|
|
|
|
|
|
|
|
|
|
|
if self.company_id.create_user: |
|
|
|
|
|
self.create_user(self.partner_id) |
|
|
|
|
|
|
|
|
return True |
|
|
return True |
|
|
|
|
|
|
|
|
def post_process_confirm_paid(self, effective_date): |
|
|
def post_process_confirm_paid(self, effective_date): |
|
|