Merge pull request #4830 from expsa/ENS-3799
[IMP] odex_benefit: change login message
This commit is contained in:
commit
368cb4b190
|
|
@ -1,4 +1,4 @@
|
||||||
from odoo import http
|
from odoo import http, _
|
||||||
from odoo.http import request
|
from odoo.http import request
|
||||||
from odoo.addons.phone_validation.tools import phone_validation
|
from odoo.addons.phone_validation.tools import phone_validation
|
||||||
|
|
||||||
|
|
@ -32,9 +32,19 @@ class CreatePortalAccount(http.Controller):
|
||||||
# Check if user already exists with the same otp_mobile_phone
|
# Check if user already exists with the same otp_mobile_phone
|
||||||
existing_user = request.env['res.users'].sudo().search([('login', '=', login)], limit=1)
|
existing_user = request.env['res.users'].sudo().search([('login', '=', login)], limit=1)
|
||||||
if existing_user:
|
if existing_user:
|
||||||
|
existing_partner = existing_user.partner_id
|
||||||
|
is_family_or_beneficiary = existing_partner.is_family or existing_partner.is_benefit
|
||||||
|
is_donor_vendor_sponsor = existing_partner.is_donor or existing_partner.is_sponsor_portal or existing_partner.is_vendor
|
||||||
|
|
||||||
|
if is_family_or_beneficiary and account_type == 'donor':
|
||||||
|
message = _("This phone number is already registered as Family/Beneficiary and cannot be used for sponsor account!")
|
||||||
|
elif is_donor_vendor_sponsor and account_type == 'family':
|
||||||
|
message = _("This phone number is already registered as Donor/Sponsor and cannot be used for family account!")
|
||||||
|
else:
|
||||||
|
message = _('This phone number is already registered. Please use a different phone number.')
|
||||||
data = {
|
data = {
|
||||||
'status': False,
|
'status': False,
|
||||||
'message': 'This phone number is already registered. Please use a different phone number.'
|
'message': message
|
||||||
}
|
}
|
||||||
return json.dumps(data)
|
return json.dumps(data)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,4 @@ class ResPartner(models.Model):
|
||||||
is_donor_vendor_sponsor = rec.is_donor or rec.is_sponsor_portal or rec.is_vendor
|
is_donor_vendor_sponsor = rec.is_donor or rec.is_sponsor_portal or rec.is_vendor
|
||||||
|
|
||||||
if is_family_or_beneficiary and is_donor_vendor_sponsor:
|
if is_family_or_beneficiary and is_donor_vendor_sponsor:
|
||||||
raise ValidationError(_("A contact cannot be both Family/Beneficiary and Donor/Member/Sponsor at the same time"))
|
raise ValidationError(_("A contact cannot be both Family/Beneficiary and Donor/Member/Sponsor at the same time!"))
|
||||||
Loading…
Reference in New Issue