From 59caa08fd3b183cc0320954d69ff09a1043ec100 Mon Sep 17 00:00:00 2001 From: houssine Date: Tue, 30 Jan 2018 12:00:36 +0100 Subject: [PATCH] [FIX] put code block to create user and send email invitation in the if statement where it belongs --- easy_my_coop/models/coop.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/easy_my_coop/models/coop.py b/easy_my_coop/models/coop.py index 8efd379..3b3db2a 100644 --- a/easy_my_coop/models/coop.py +++ b/easy_my_coop/models/coop.py @@ -270,10 +270,11 @@ class subscription_request(models.Model): 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() + 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 @api.one def validate_subscription_request(self):