Browse Source

[FIX] in the case of a company we should search the user based on the

company email instead of the representative email
pull/1/head
houssine 7 years ago
parent
commit
860d12551a
  1. 18
      easy_my_coop/controllers/main.py

18
easy_my_coop/controllers/main.py

@ -175,14 +175,16 @@ class WebsiteSubscription(http.Controller):
values['partner_id'] = partner.id values['partner_id'] = partner.id
values['already_cooperator'] = partner.member values['already_cooperator'] = partner.member
is_company = False
if kwargs.get("is_company") == 'on':
is_company = True
values["is_company"] = is_company
redirect = "easy_my_coop.becomecooperator" redirect = "easy_my_coop.becomecooperator"
email = kwargs.get('email')
is_company = kwargs.get("is_company") == 'on'
if is_company: if is_company:
redirect = "easy_my_coop.becomecompanycooperator"
is_company = True
redirect = "easy_my_coop.becomecompanycooperator"
email = kwargs.get('company_email')
values["is_company"] = is_company
if not kwargs.has_key('g-recaptcha-response') or not request.website.is_captcha_valid(kwargs['g-recaptcha-response']): if not kwargs.has_key('g-recaptcha-response') or not request.website.is_captcha_valid(kwargs['g-recaptcha-response']):
values = self.fill_values(values,is_company) values = self.fill_values(values,is_company)
@ -190,8 +192,8 @@ class WebsiteSubscription(http.Controller):
return request.website.render(kwargs.get("view_from", redirect), values) return request.website.render(kwargs.get("view_from", redirect), values)
if not logged and kwargs.has_key('email'):
user = user_obj.sudo().search([('login','=',kwargs.get("email"))])
if not logged and email:
user = user_obj.sudo().search([('login','=',email)])
if user: if user:
values = self.fill_values(values,is_company) values = self.fill_values(values,is_company)
values.update(kwargs) values.update(kwargs)

Loading…
Cancel
Save