Commit 0fee9a34 by Arturo Jasso Origel

se agregó a la creación de usuarios la verificación del contacto, para evitar…

se agregó a la creación de usuarios la verificación del contacto, para evitar que salgan contactos repetidos y sin usuario
parent 9dc71f19
......@@ -38,9 +38,10 @@ class PortalHelpdeskMorsa(PortalHelpdesk):
partner = request.env['res.partner'].sudo().search(
[('id', '=', int(kw.get('partner_id')))], limit=1)
if partner:
email = partner.email if partner.email else partner.user_ids[0].login
dic.update({
'name': partner.name,
'email': partner.email,
'email': email,
'phone': partner.phone,
})
......
......@@ -348,12 +348,15 @@ class PortalHelpdeskMorsaEmergency(PortalHelpdesk):
partner_id = False
if kw.get('partner_id') and kw.get('partner_id') != '':
partner_id = request.env['res.partner'].sudo().search(
[('id', '=', int(kw.get('partner_id')))], limit=1)
[('id', '=', int(kw.get('partner_id')))]).filtered(lambda user: len(user.user_ids) > 0 )
else:
partner_id = request.env['res.partner'].sudo().search(
[('email', '=', kw.get('portal_email'))], limit=1)
[('email', '=', kw.get('portal_email'))]).filtered(lambda user: len(user.user_ids) > 0 )
if partner_id and len(partner_id) > 1:
partner_id = request.env.user.partner_id
if not partner_id:
return json.dumps({"resp":"Error","message":"No hay contacto"})
return json.dumps({"resp":"Error","message":"Colaborador no encontrado, favor de verificar que haya agregado uno"})
if partner_id:
unvalued_tickets = len(
request.env['helpdesk.ticket'].sudo().search([
......
......@@ -367,12 +367,15 @@ class PortalHelpdeskMorsaErp(PortalHelpdesk):
partner_id = False
if kw.get('partner_id') and kw.get('partner_id') != '':
partner_id = request.env['res.partner'].sudo().search(
[('id', '=', int(kw.get('partner_id')))], limit=1)
[('id', '=', int(kw.get('partner_id')))]).filtered(lambda user: len(user.user_ids) > 0 )
else:
partner_id = request.env['res.partner'].sudo().search(
[('email', '=', kw.get('portal_email'))], limit=1)
[('email', '=', kw.get('portal_email'))]).filtered(lambda user: len(user.user_ids) > 0 )
if partner_id and len(partner_id) > 1:
partner_id = request.env.user.partner_id
if not partner_id:
return json.dumps({"resp":"Error","message":"Colaborador no encontrado, favor de verificar que haya agregado uno existente"})
return json.dumps({"resp":"Error","message":"Colaborador no encontrado, favor de verificar que haya agregado uno"})
if partner_id:
unvalued_tickets = len(
request.env['helpdesk.ticket'].sudo().search([
......
......@@ -350,11 +350,13 @@ class PortalHelpdeskMorsaSoporte(PortalHelpdesk):
partner_id = False
if kw.get('partner_id') and kw.get('partner_id') != '':
partner_id = request.env['res.partner'].sudo().search(
[('id', '=', int(kw.get('partner_id')))], limit=1)
[('id', '=', int(kw.get('partner_id')))]).filtered(lambda user: len(user.user_ids) > 0 )
else:
partner_id = request.env['res.partner'].sudo().search(
[('email', '=', kw.get('portal_email'))], limit=1)
[('email', '=', kw.get('portal_email'))]).filtered(lambda user: len(user.user_ids) > 0 )
if partner_id and len(partner_id) > 1:
partner_id = request.env.user.partner_id
if not partner_id:
return json.dumps({"resp":"Error","message":"Colaborador no encontrado, favor de verificar que haya agregado uno"})
if partner_id:
......
......@@ -36,7 +36,7 @@
<a t-if="ti" t-attf-href="/my/911?{{ keep_query() }}">TI 911</a>
<t t-else="">TI 911</t>
</li>
<li t-if="ti" class="breadcrumb-item active">
<t t-esc="ti.name" t-if="ti.name" />
<t t-else=""><em>TI 911</em></t>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment