Commit bdc5b07e by Arturo Jasso Origel

se agregan botones para que el usuario pueda cerrar y cancelar su ticket

parent 7010b720
...@@ -81,4 +81,37 @@ class PortalHelpdeskMorsa(PortalHelpdesk): ...@@ -81,4 +81,37 @@ class PortalHelpdeskMorsa(PortalHelpdesk):
return json.dumps({"resp":"Error","message":"Favor de agregar un contacto valido"}) return json.dumps({"resp":"Error","message":"Favor de agregar un contacto valido"})
except Exception as e: except Exception as e:
return json.dumps({"resp":"Error","message":str(e),"unvalued":[]}) return json.dumps({"resp":"Error","message":str(e),"unvalued":[]})
\ No newline at end of file @http.route(['/cerrar-ticket'], type='http',auth="user",website=True)
def portal_ticket_closed(self,**kw):
url = "/my"
if kw.get('option'):
url = "/my/"+kw.get('option')+"?ctr=False"
try:
ticket = request.env['helpdesk.ticket'].sudo().browse(int(kw.get('ticket_id')))
if ticket:
ticket.sudo().update({'descripcion_solution':"Cerrado por el usuario"})
ticket.sudo().done_and_close()
except Exception as e:
_logger.exception('Something went wrong %s',str(e))
finally:
return request.redirect(url)
@http.route(['/cancel-ticket'], type='http',auth="user",website=True)
def portal_ticket_cancel(self,**kw):
url = "/my"
if kw.get('option'):
url = "/my/"+kw.get('option')+"?ctr=False"
try:
ticket = request.env['helpdesk.ticket'].sudo().browse(int(kw.get('ticket_id')))
if ticket:
ticket.sudo().action_cancel()
except Exception as e:
_logger.exception('Something went wrong %s',str(e))
finally:
return request.redirect(url)
\ No newline at end of file
...@@ -445,3 +445,6 @@ class PortalHelpdeskMorsaSoporte(PortalHelpdesk): ...@@ -445,3 +445,6 @@ class PortalHelpdeskMorsaSoporte(PortalHelpdesk):
'report_type': 'html', 'report_type': 'html',
} }
return request.render("helpdesk_morsa.portal_ticket_page_support",values) return request.render("helpdesk_morsa.portal_ticket_page_support",values)
...@@ -412,7 +412,7 @@ class HelpdeskTicket(models.Model): ...@@ -412,7 +412,7 @@ class HelpdeskTicket(models.Model):
if vals['team_id'] in [self.env.ref('helpdesk_morsa.techinnical_support').id,self.env.ref('helpdesk_morsa.erp_asistense').id,self.env.ref('helpdesk_morsa.ti_emergency').id]: if vals['team_id'] in [self.env.ref('helpdesk_morsa.techinnical_support').id,self.env.ref('helpdesk_morsa.erp_asistense').id,self.env.ref('helpdesk_morsa.ti_emergency').id]:
if self.team_id.id not in [self.env.ref('helpdesk_morsa.support_second_level').id,self.env.ref('helpdesk_morsa.support_third_level').id,self.env.ref('helpdesk_morsa.purchase_actives').id]: if self.team_id.id not in [self.env.ref('helpdesk_morsa.support_second_level').id,self.env.ref('helpdesk_morsa.support_third_level').id,self.env.ref('helpdesk_morsa.purchase_actives').id]:
vals.update({'name': self.env['ir.sequence'].sudo().next_by_code('helpdesk.ticket.'+str(vals['team_id']) or _('New'))}) vals.update({'name': self.env['ir.sequence'].sudo().next_by_code('helpdesk.ticket.'+str(vals['team_id']) or _('New'))})
if "stage_id" in vals: if "stage_id" in vals and self.env.ref('sh_all_in_one_helpdesk.cancel_stage').id != vals['stage_id']:
if self.is_support == True: if self.is_support == True:
if self.description == '<p><br></p>' or self.description==False: if self.description == '<p><br></p>' or self.description==False:
raise ValidationError (_("Para cambiar de etapa, es necesario agregar una descripción")) raise ValidationError (_("Para cambiar de etapa, es necesario agregar una descripción"))
......
...@@ -62,9 +62,31 @@ ...@@ -62,9 +62,31 @@
<!-- Intro --> <!-- Intro -->
<div id="introduction" t-attf-class="pb-2 pt-3 #{'card-header bg-white' if report_type == 'html' else ''}"> <div id="introduction" t-attf-class="pb-2 pt-3 #{'card-header bg-white' if report_type == 'html' else ''}">
<h2 class="my-0"> <div class="row">
<strong><em t-esc="soporte.name" /></strong> <div class="col-sm-12 col-md-6 col-lg-6">
</h2> <h2 class="my-0">
<strong><em t-esc="soporte.name" /></strong>
</h2>
</div>
<div class="col-sm-12 col-md-6 col-lg-6 text-right">
<div class="row">
<div class="col-sm-12 col-md-6 col-lg-8">
<form action="/cerrar-ticket" t-if="soporte.stage_id.name not in ['Hecho','Cerrado','Cancelado']" class="oe_inline">
<input type="hidden" name="option" id="option" value="soporte"/>
<input type="hidden" name="ticket_id" id="ticket_id" t-att-value="soporte.id"/>
<button type="submit" id="close_ticket" class="btn btn-primary mt-2 rounded">Cerrar Ticket</button>
</form>
</div>
<div class="col-sm-12 col-md-6 col-lg-4">
<form action="/cancel-ticket" t-if="soporte.stage_id.name not in ['Hecho','Cerrado','Cancelado']" class="oe_inline">
<input type="hidden" name="option" id="option" value="soporte"/>
<input type="hidden" name="ticket_id" id="ticket_id" t-att-value="soporte.id"/>
<button type="submit" id="cancle_ticket" class="btn btn-primary mt-2 rounded">Cancelar Ticket</button>
</form>
</div>
</div>
</div>
</div>
</div> </div>
<div t-attf-class="#{'card-body' if report_type == 'html' else ''}"> <div t-attf-class="#{'card-body' if report_type == 'html' else ''}">
<div id="informations"> <div id="informations">
...@@ -336,9 +358,31 @@ ...@@ -336,9 +358,31 @@
<!-- Intro --> <!-- Intro -->
<div id="introduction" t-attf-class="pb-2 pt-3 #{'card-header bg-white' if report_type == 'html' else ''}"> <div id="introduction" t-attf-class="pb-2 pt-3 #{'card-header bg-white' if report_type == 'html' else ''}">
<h2 class="my-0"> <div class="row">
<strong><em t-esc="asistencia.name" /></strong> <div class="col-sm-12 col-md-6 col-lg-6">
</h2> <h2 class="my-0">
<strong><em t-esc="asistencia.name" /></strong>
</h2>
</div>
<div class="col-sm-12 col-md-6 col-lg-6 text-right">
<div class="row">
<div class="col-sm-12 col-md-6 col-lg-8">
<form action="/cerrar-ticket" t-if="asistencia.stage_id.name not in ['Hecho','Cerrado','Cancelado']" class="oe_inline">
<input type="hidden" name="option" id="option" value="erp"/>
<input type="hidden" name="ticket_id" id="ticket_id" t-att-value="asistencia.id"/>
<button type="submit" id="close_ticket" class="btn btn-primary mt-2 rounded">Cerrar Ticket</button>
</form>
</div>
<div class="col-sm-12 col-md-6 col-lg-4">
<form action="/cancel-ticket" t-if="asistencia.stage_id.name not in ['Hecho','Cerrado','Cancelado']" class="oe_inline">
<input type="hidden" name="option" id="option" value="erp"/>
<input type="hidden" name="ticket_id" id="ticket_id" t-att-value="asistencia.id"/>
<button type="submit" id="cancle_ticket" class="btn btn-primary mt-2 rounded">Cancelar Ticket</button>
</form>
</div>
</div>
</div>
</div>
</div> </div>
<div t-attf-class="#{'card-body' if report_type == 'html' else ''}"> <div t-attf-class="#{'card-body' if report_type == 'html' else ''}">
<div id="informations"> <div id="informations">
...@@ -724,9 +768,31 @@ ...@@ -724,9 +768,31 @@
<!-- Intro --> <!-- Intro -->
<div id="introduction" t-attf-class="pb-2 pt-3 #{'card-header bg-white' if report_type == 'html' else ''}"> <div id="introduction" t-attf-class="pb-2 pt-3 #{'card-header bg-white' if report_type == 'html' else ''}">
<h2 class="my-0"> <div class="row">
<strong><em t-esc="ti.name" /></strong> <div class="col-sm-12 col-md-6 col-lg-6">
</h2> <h2 class="my-0">
<strong><em t-esc="ti.name" /></strong>
</h2>
</div>
<div class="col-sm-12 col-md-6 col-lg-6 text-right">
<div class="row">
<div class="col-sm-12 col-md-6 col-lg-8">
<form action="/cerrar-ticket" t-if="ti.stage_id.name not in ['Hecho','Cerrado','Cancelado']" class="oe_inline">
<input type="hidden" name="option" id="option" value="911"/>
<input type="hidden" name="ticket_id" id="ticket_id" t-att-value="ti.id"/>
<button type="submit" id="close_ticket" class="btn btn-primary mt-2 rounded">Cerrar Ticket</button>
</form>
</div>
<div class="col-sm-12 col-md-6 col-lg-4">
<form action="/cancel-ticket" t-if="ti.stage_id.name not in ['Hecho','Cerrado','Cancelado']" class="oe_inline">
<input type="hidden" name="option" id="option" value="911"/>
<input type="hidden" name="ticket_id" id="ticket_id" t-att-value="ti.id"/>
<button type="submit" id="cancle_ticket" class="btn btn-primary mt-2 rounded">Cancelar Ticket</button>
</form>
</div>
</div>
</div>
</div>
</div> </div>
<div t-attf-class="#{'card-body' if report_type == 'html' else ''}"> <div t-attf-class="#{'card-body' if report_type == 'html' else ''}">
<div id="informations"> <div id="informations">
......
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