Commit ac0cc866 by Arturo Jasso Origel

se corrigio el error de ticket sin evaluar, en el que te muestra atraves de una…

se corrigio el error de ticket sin evaluar, en el que te muestra atraves de una alerta los ticket que se encuentran sin evaluar, y posterior al evaluarlos se evaluan todos los que están sin evaluar, se corrgio un error de que creaba un adjunto sin información al momento de crear un ticket, se corrigio el z-index delos header ya que chocaba con los menu de arriba, y se agrego una restricción para que no llegue el correo de ticket creado a los usuarios de soporte, pero si quedo habilitado para el resto de los equipos y se cambio la verificación de tamaño por un row y un col-12 para que se mantenga un diseño responsivo
parent be9a87e7
......@@ -18,9 +18,22 @@ _logger = logging.getLogger(__name__)
class WebsiteTickets(DownloadReport):
@http.route('/ticket/feedback/<ticket_id>',type="http",auth="public",website=True)
def helpdesk_ticket_feedback(self, ticket_id,unvalued=False, **kw):
if unvalued:
unvalued = 'all'
return http.request.render(
'sh_all_in_one_helpdesk.helpdesk_ticket_feedback_page',
{'ticket': ticket_id, 'unvalued':unvalued}
)
@http.route('/helpdesk/ticket/feedback/<ticket_id>', type="http", auth="public", website=True, csrf=False)
def helpdesk_ticket_feedback_thanks(self, ticket_id, **kw):
dic = {}
if kw.get('problem_solved') == 'True':
dic.update({
'problem_solved_on_time':True
......@@ -57,7 +70,31 @@ class WebsiteTickets(DownloadReport):
})
ticket = request.env['helpdesk.ticket'].sudo().search(
[('id', '=', int(ticket_id))], limit=1)
if ticket:
_logger.info('ticket')
unvalued = False
if kw.get('portal_unvalued'):
unvalued = kw.get('portal_unvalued')
_logger.info(unvalued)
if ticket and unvalued == 'all':
_logger.info('Entra tickets')
tickets = request.env['helpdesk.ticket'].sudo().search([
('partner_id','=',ticket.partner_id.id),
('stage_id','=',ticket.stage_id.id),
('team_id','=',ticket.team_id.id)
])
_logger.info(tickets)
if tickets:
_logger.info('Entra tickets')
for t in tickets:
t.sudo().write(dic)
else:
_logger.info('Entra ticket')
ticket.sudo().write(dic)
elif ticket and not unvalued:
_logger.info('Entra ticket')
ticket.sudo().write(dic)
return http.request.render(
'sh_all_in_one_helpdesk.ticket_feedback_thank_you', {})
\ No newline at end of file
elif ticket:
ticket.sudo().write(dic)
return http.request.render('sh_all_in_one_helpdesk.ticket_feedback_thank_you', {})
\ No newline at end of file
......@@ -396,21 +396,22 @@ class PortalHelpdeskMorsaEmergency(PortalHelpdesk):
ticket_dic)
if 'portal_file' in request.params:
attached_files = request.httprequest.files.getlist(
'portal_file')
attachment_ids = []
for attachment in attached_files:
result = base64.b64encode(attachment.read())
attachment_id = request.env['ir.attachment'].sudo(
).create({
'name': attachment.filename,
'res_model': 'helpdesk.ticket',
'res_id': ticket_id.id,
'display_name': attachment.filename,
'datas': result,
})
attachment_ids.append(attachment_id.id)
ticket_id.attachment_ids = [(6, 0, attachment_ids)]
if kw.get('portal_file'):
attached_files = request.httprequest.files.getlist('portal_file')
attachment_ids = []
for attachment in attached_files:
result = base64.b64encode(attachment.read())
if result:
attachment_id = request.env['ir.attachment'].sudo(
).create({
'name': attachment.filename,
'res_model': 'helpdesk.ticket',
'res_id': ticket_id.id,
'display_name': attachment.filename,
'datas': result,
})
attachment_ids.append(attachment_id.id)
ticket_id.attachment_ids = [(6, 0, attachment_ids)]
return request.redirect("/my/911?ctr=False")
except Exception as e:
_logger.exception('Something went wrong %s',str(e))
......
......@@ -455,37 +455,42 @@ class PortalHelpdeskMorsaErp(PortalHelpdesk):
ticket_id = request.env['helpdesk.ticket'].sudo().create(
ticket_dic)
if 'portal_file' in request.params :
attached_files = request.httprequest.files.getlist('portal_file')
attachment_ids = []
for attachment in attached_files:
result = base64.b64encode(attachment.read())
attachment_id = request.env['ir.attachment'].sudo(
).create({
'name': attachment.filename,
'res_model': 'helpdesk.ticket',
'res_id': ticket_id.id,
'display_name': attachment.filename,
'datas': result,
})
attachment_ids.append(attachment_id.id)
ticket_id.attachment_ids = [(6, 0, attachment_ids)]
if 'portal_file' in request.params:
if kw.get('portal_file'):
attached_files = request.httprequest.files.getlist('portal_file')
attachment_ids = []
for attachment in attached_files:
result = base64.b64encode(attachment.read())
if result:
attachment_id = request.env['ir.attachment'].sudo(
).create({
'name': attachment.filename,
'res_model': 'helpdesk.ticket',
'res_id': ticket_id.id,
'display_name': attachment.filename,
'datas': result,
})
attachment_ids.append(attachment_id.id)
ticket_id.attachment_ids = [(6, 0, attachment_ids)]
if 'portal_file_mejora' in request.params :
attached_files = request.httprequest.files.getlist('portal_file_mejora')
attachment_ids = []
for attachment in attached_files:
result = base64.b64encode(attachment.read())
attachment_id = request.env['ir.attachment'].sudo(
).create({
'name': attachment.filename,
'res_model': 'helpdesk.ticket',
'res_id': ticket_id.id,
'display_name': attachment.filename,
'datas': result,
})
attachment_ids.append(attachment_id.id)
ticket_id.attachment_ids = [(6, 0, attachment_ids)]
if kw.get('portal_file_mejora'):
attached_files = request.httprequest.files.getlist('portal_file_mejora')
attachment_ids = []
for attachment in attached_files:
result = base64.b64encode(attachment.read())
if result:
attachment_id = request.env['ir.attachment'].sudo(
).create({
'name': attachment.filename,
'res_model': 'helpdesk.ticket',
'res_id': ticket_id.id,
'display_name': attachment.filename,
'datas': result,
})
attachment_ids.append(attachment_id.id)
ticket_id.attachment_ids = [(6, 0, attachment_ids)]
return request.redirect("/my/erp?ctr=False")
except Exception as e:
_logger.exception('Something went wrong %s',str(e))
......
......@@ -396,25 +396,23 @@ class PortalHelpdeskMorsaSoporte(PortalHelpdesk):
ticket_dic)
if 'portal_file' in request.params:
attached_files = request.httprequest.files.getlist('portal_file')
_logger.info(attached_files)
attachment_ids = []
for attachment in attached_files:
_logger.info(attachment)
result = base64.b64encode(attachment.read())
attachment_id = request.env['ir.attachment'].sudo(
).create({
'name': attachment.filename,
'res_model': 'helpdesk.ticket',
'res_id': ticket_id.id,
'display_name': attachment.filename,
'datas': result,
})
_logger.info(attachment_id)
attachment_ids.append(attachment_id.id)
_logger.info(attachment_ids)
ticket_id.attachment_ids = [(6, 0, attachment_ids)]
if kw.get('portal_file'):
attached_files = request.httprequest.files.getlist('portal_file')
attachment_ids = []
for attachment in attached_files:
result = base64.b64encode(attachment.read())
if result:
attachment_id = request.env['ir.attachment'].sudo(
).create({
'name': attachment.filename,
'res_model': 'helpdesk.ticket',
'res_id': ticket_id.id,
'display_name': attachment.filename,
'datas': result,
})
attachment_ids.append(attachment_id.id)
ticket_id.attachment_ids = [(6, 0, attachment_ids)]
return request.redirect("/my/soporte?ctr=False")
......
......@@ -185,47 +185,56 @@ class HelpdeskTicket(models.Model):
if res.sh_sla_status_ids:
for line in res.sh_sla_status_ids:
line.sh_status = res.sh_status
if res.ticket_from_website and res.company_id.new_stage_id.mail_template_ids and res.partner_id:
for template in res.company_id.new_stage_id.mail_template_ids:
template.sudo().send_mail(res.id, force_send=True)
else:
if not res.ticket_from_website and res.company_id.new_stage_id.mail_template_ids and res.partner_id:
for template in res.company_id.new_stage_id.mail_template_ids:
template.sudo().send_mail(res.id, force_send=True)
if res.team_id and res.team_head and not res.user_id:
if res.team_id and res.team_head and not res.user_id and vals['team_id'] != self.env.ref('helpdesk_morsa.techinnical_support').id:
allocation_template = res.company_id.allocation_mail_template_id
email_formatted = []
if res.team_head.partner_id.email_formatted not in email_formatted:
email_formatted.append(
res.team_head.partner_id.email_formatted)
email_formatted_str = ','.join(email_formatted)
email_values = {
'email_from': str(res.team_head.partner_id.email_formatted),
'email_to': email_formatted_str
}
if allocation_template:
allocation_template.sudo().send_mail(res.id,
force_send=True,
email_values=email_values)
allocation_template.sudo().send_mail(res.id,force_send=True,email_values=email_values)
res.ticket_allocated = True
elif res.team_id and res.team_head and res.user_id:
allocation_template = res.company_id.allocation_mail_template_id
email_formatted = []
if res.team_head.partner_id.email_formatted not in email_formatted:
email_formatted.append(
res.team_head.partner_id.email_formatted)
if res.user_id.partner_id.email_formatted not in email_formatted:
email_formatted.append(res.user_id.partner_id.email_formatted)
email_formatted_str = ','.join(email_formatted)
email_values = {
'email_from': str(res.team_head.partner_id.email_formatted),
'email_to': email_formatted_str
}
if allocation_template:
allocation_template.sudo().send_mail(res.id,
force_send=True,
email_values=email_values)
allocation_template.sudo().send_mail(res.id,force_send=True,email_values=email_values)
res.ticket_allocated = True
elif res.team_id and res.team_head and not res.user_id and res.sh_user_ids:
allocation_template = res.company_id.allocation_mail_template_id
email_formatted = []
......@@ -238,18 +247,24 @@ class HelpdeskTicket(models.Model):
'email_to': email_formatted_str
}
if allocation_template:
allocation_template.sudo().send_mail(res.id,
force_send=True,
email_values=email_values)
allocation_template.sudo().send_mail(res.id,force_send=True,email_values=email_values)
res.ticket_allocated = True
elif not res.team_id and not res.team_head and res.user_id and res.sh_user_ids:
_logger.info('Entra15')
allocation_template = res.company_id.allocation_mail_template_id
email_formatted = []
if res.user_id.partner_id.email_formatted not in email_formatted:
_logger.info('Entra17')
email_formatted.append(res.user_id.partner_id.email_formatted)
for user in res.sh_user_ids:
if user.id != res.user_id.id:
_logger.info('Entra18')
if user.partner_id.email_formatted not in email_formatted:
_logger.info('Entra19')
email_formatted.append(user.partner_id.email_formatted)
email_formatted_str = ','.join(email_formatted)
email_values = {
......@@ -276,9 +291,7 @@ class HelpdeskTicket(models.Model):
'email_to': str(res.user_id.partner_id.email_formatted)
}
if allocation_template:
allocation_template.sudo().send_mail(res.id,
force_send=True,
email_values=email_values)
allocation_template.sudo().send_mail(res.id,force_send=True,email_values=email_values)
res.ticket_allocated = True
elif not res.team_id and not res.team_head and not res.user_id and res.sh_user_ids:
allocation_template = res.company_id.allocation_mail_template_id
......@@ -292,9 +305,7 @@ class HelpdeskTicket(models.Model):
'email_to': email_formatted_str
}
if allocation_template:
allocation_template.sudo().send_mail(res.id,
force_send=True,
email_values=email_values)
allocation_template.sudo().send_mail(res.id,force_send=True,email_values=email_values)
res.ticket_allocated = True
if self.env.company.sh_auto_add_customer_as_follower:
res.message_subscribe(partner_ids=res.partner_id.ids)
......
......@@ -238,7 +238,7 @@ class TicketDashboardInherit(models.Model):
if search_tickets:
id_list = search_tickets.ids
all_dict = {'TODOS': id_list}
all_dict = {'Todos': id_list}
return all_dict
......@@ -257,8 +257,8 @@ class TicketDashboardInherit(models.Model):
id_list = []
for stage in company_id.dashboard_filter:
doman = []
id_list = []
doman.append(('stage_id', '=', stage.id))
......@@ -273,6 +273,8 @@ class TicketDashboardInherit(models.Model):
datetime.now().date().strftime("%Y/%m/%d 00:00:00"))
doman.append(tuple(dt_flt1))
dt_flt2 = []
dt_flt2.append('create_date')
dt_flt2.append('<=')
......@@ -280,6 +282,7 @@ class TicketDashboardInherit(models.Model):
datetime.now().date().strftime("%Y/%m/%d 23:59:59"))
doman.append(tuple(dt_flt2))
elif filter_date == 'yesterday':
dt_flt1 = []
......@@ -297,6 +300,8 @@ class TicketDashboardInherit(models.Model):
relativedelta(days=1)).strftime('%Y/%m/%d 23:59:59')
dt_flt2.append(prev_day)
doman.append(tuple(dt_flt2))
elif filter_date == 'weekly': # current week
......@@ -314,6 +319,8 @@ class TicketDashboardInherit(models.Model):
dt_flt2.append(
datetime.now().date().strftime("%Y/%m/%d 23:59:59"))
doman.append(tuple(dt_flt2))
elif filter_date == 'prev_week': # Previous week
......@@ -330,6 +337,8 @@ class TicketDashboardInherit(models.Model):
dt_flt2.append((datetime.now().date(
) - relativedelta(weeks=1, weekday=6)).strftime("%Y/%m/%d 23:59:59"))
doman.append(tuple(dt_flt2))
elif filter_date == 'monthly': # Current Month
......@@ -346,6 +355,8 @@ class TicketDashboardInherit(models.Model):
dt_flt2.append(
datetime.now().date().strftime("%Y/%m/%d 23:59:59"))
doman.append(tuple(dt_flt2))
elif filter_date == 'prev_month': # Previous Month
......@@ -362,6 +373,8 @@ class TicketDashboardInherit(models.Model):
dt_flt2.append(
datetime.now().date().strftime("%Y/%m/01 00:00:00"))
doman.append(tuple(dt_flt2))
elif filter_date == 'cur_year': # Current Year
......@@ -378,6 +391,8 @@ class TicketDashboardInherit(models.Model):
dt_flt2.append(
datetime.now().date().strftime("%Y/%m/%d 23:59:59"))
doman.append(tuple(dt_flt2))
elif filter_date == 'prev_year': # Previous Year
......@@ -394,6 +409,8 @@ class TicketDashboardInherit(models.Model):
dt_flt2.append(
datetime.now().date().strftime("%Y/01/01 00:00:00"))
doman.append(tuple(dt_flt2))
elif filter_date == 'custom':
if start_date and end_date:
......@@ -410,16 +427,20 @@ class TicketDashboardInherit(models.Model):
dt_flt2.append(datetime.strptime(
str(end_date), DEFAULT_SERVER_DATE_FORMAT).strftime("%Y/%m/%d"))
doman.append(tuple(dt_flt2))
if team and team not in [None,False,""] and int(team) != 0:
doman.append(('team_id', '=', int(team)))
if team_leader and team_leader not in [None,False,""] and int(team_leader) != 0:
doman.append(('team_head', '=', int(team_leader)))
if assign_user and assign_user not in [None,False,""] and int(assign_user) != 0:
doman.append(('|'))
......@@ -427,6 +448,9 @@ class TicketDashboardInherit(models.Model):
doman.append(('user_id', '=', int(assign_user)))
doman.append(('sh_user_ids', 'in', [int(assign_user)]))
doman.append(('team_id.team_members','in',[self.env.user.id]))
elif assign_user and assign_user not in [None,False,""] and int(assign_user) == 0:
......@@ -480,6 +504,7 @@ class TicketDashboardInherit(models.Model):
}
ticket_list.append(ticket_dic)
id_list.append(ticket.id)
search_stage = self.env['helpdesk.stages'].sudo().search([
('id', '=', stage.id)
], limit=1)
......
......@@ -41,7 +41,7 @@ $(document).ready(function(e) {
var ticket_type = $("#tck_type").val();
if(ticket_type == 'soporte'){
var rqued = required_support();
//ajax_unvalued_tickets(rqued);
ajax_unvalued_tickets(rqued);
if (rqued['portal_contact_name'] == ""){
e.preventDefault();
swal({
......@@ -67,28 +67,34 @@ $(document).ready(function(e) {
buttons: "Ok",
});
}else if (unvaluated['resp'] == "Error"){
var row = $('<div>',{class:'row'})
e.preventDefault();
const links = document.createElement("div")
if (unvaluated['unvalued'].length > 0 ){
var unvaled = unvaluated['unvalued']
for(var i = 0;i <= unvaled.length;i++){
var data = unvaled[i]
if (Boolean(data) == true){
row.append('<a href="'+data.t_id+'">'+data.t_name+'</a>')
const link = document.createElement('a')
link.href = "/ticket/feedback/"+data['t_id']+'?unvalued=True'
link.text = data['t_name']
links.appendChild(link)
const salto = document.createElement('br')
links.appendChild(salto)
}
};
}
e.preventDefault();
}
swal({
title:"Error",
text: unvaluated['message'],
icon: "error",
buttons: "Ok",
content: ("<div>hola</div>"),
content: links,
});
}
}else if(ticket_type == 'erp'){
var erp_type = $('#portal_erp_type').val()
if (erp_type == ""){
......@@ -313,7 +319,6 @@ $(document).ready(function(e) {
}
}
});
......
......@@ -26,5 +26,5 @@
top: 190px;
left: 1;
width: 100%;
z-index: 1000;
z-index: 100;
}
\ No newline at end of file
......@@ -61,6 +61,7 @@
<field name="team_id" invisible="1"/>
<field name="team_head" invisible="1"/>
<field name="team_admin_id" invisible="1"/>
<field name="user_id"/>
<field name="category_id"/>
<field name="priority"/>
<field name="ticket_reason"/>
......@@ -130,15 +131,37 @@
<xpath expr="//notebook" position="inside">
<page string="Movimiento de usuarios">
<field name="user_changes_ids" force_save="1" readonly="1">
<tree>
<field name="create_date"/>
<field name="user_id"/>
<field name="user_second_id"/>
</tree>
</field>
<div class="row">
<div class="col-12">
<field name="user_changes_ids" force_save="1" readonly="1">
<tree>
<field name="create_date" string="Fecha de creación"/>
<field name="user_id"/>
<field name="user_second_id"/>
</tree>
</field>
</div>
</div>
</page>
</xpath>
<xpath expr="//page[2]//group" position="replace">
<div class="row">
<div class="col-12">
<field name="attachment_ids" context="{'default_res_model': 'helpdesk.ticket','default_res_id':active_id}">
<tree>
<field name="name"/>
<field name="type"/>
<field name="original_id"/>
<field name="datas"/>
</tree>
</field>
</div>
</div>
</xpath>
</field>
</record>
......
......@@ -3,6 +3,7 @@
<template id="template_id" name="feedback inherit" inherit_id="sh_all_in_one_helpdesk.helpdesk_ticket_feedback_page">
<xpath expr="//form[@id='smileys']" position="replace">
<form method="POST" t-attf-action="/helpdesk/ticket/feedback/#{ticket}" id="smileys">
<input type="hidden" name="portal_unvalued" id="portal_unvalued" t-att-value="unvalued"/>
<div class="row">
<div class="col-12">
<h5>¿Solucionamos completamente tu problema?</h5>
......
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