Commit cac10621 by Arturo Jasso Origel

se corrigieron las vistas dentro del portal, ya que ocasionaba un error al…

se corrigieron las vistas dentro del portal, ya que ocasionaba un error al momento de intentar ver un ticket, se agregó verificación en los radio button para evitar que estuvieran vacios, se realizo la misma verificación del contacto vacio
parent 0fee9a34
......@@ -124,15 +124,19 @@ class PortalCustomerMaintenence(CustomerPortal):
'label': _('Status')
},
'category': {
'input': 'category',
'label': _('Category')
'maintenance_type': {
'input': 'maintenance_type',
'label': _('Tipo de mantenimiento')
},
'priority': {
'input': 'priority',
'label': _('Priority')
'severity_type': {
'input': 'severity_type',
'label': _('Gravedad')
},
'state': {
'input': 'state',
'label': _('Reply Status')
},
}
......@@ -263,87 +267,45 @@ class PortalCustomerMaintenence(CustomerPortal):
maintenance_count = len(HelpdeskTicket.search(domain).filtered(lambda h: h.team_id.id == request.env.ref('helpdesk_maintenance.maintenance').id))
# pager
pager = portal_pager(url="/my/mantenimientos",url_args={'sortby': sortby,'search_in': search_in,'search': search,'filterby': filterby},total=maintenance_count,page=page,step=self._items_per_page)
if groupby == 'create_by':
order = "create_uid, %s" % order
elif groupby == 'ticket_type':
order = "ticket_type, %s" % order
elif groupby == 'status':
if groupby == 'status':
order = "stage_id, %s" % order
elif groupby == 'customer':
order = "partner_id, %s" % order
elif groupby == 'category':
order = "category_id, %s" % order
elif groupby == 'subcategory':
order = "sub_category_id, %s" % order
elif groupby == 'subject':
order = "subject_id, %s" % order
elif groupby == 'priority':
order = "priority, %s" % order
elif groupby == 'state':
order = 'state,%s' % order
elif groupby == 'maintenance_type':
order = "maintenance_type_id, %s" % order
elif groupby == 'severity_type':
order = "severity_type, %s" % order
tickets = HelpdeskTicket.search(domain,order=order,limit=self._items_per_page,offset=pager['offset'])
request.session['my_tickets_history'] = tickets.ids[:100]
if groupby == 'create_by':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('create_uid'))
]
elif groupby == 'ticket_type':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('ticket_type'))
]
elif groupby == 'status':
if groupby == 'status':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('stage_id'))
]
elif groupby == 'customer':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('partner_id'))
]
elif groupby == 'category':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('category_id'))
]
elif groupby == 'subcategory':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('sub_category_id'))
]
elif groupby == 'subject':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('subject_id'))
]
elif groupby == 'priority':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('priority'))
]
elif groupby == 'state':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('state'))
]
elif groupby == 'maintenance_type':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('maintenance_type_id'))
]
elif groupby == 'severity_type':
grouped_tickets = [
HelpdeskTicket.concat(*g)
......@@ -377,11 +339,13 @@ class PortalCustomerMaintenence(CustomerPortal):
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:
......@@ -790,11 +754,13 @@ class PortalCustomerMaintenence(CustomerPortal):
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:
......@@ -874,34 +840,4 @@ class PortalCustomerMaintenence(CustomerPortal):
except Exception as e:
_logger.exception('Something went wrong %s',str(e))
"""@http.route(['/my/manteniminetos/emergencias/<int:ticket_id>'],type='http',auth="public",website=True)
def portal_my_ticket_detail_maintenance_emergency(self,ticket_id,access_token=None,report_type=None,message=False,download=False,**kw):
try:
ticket_sudo = self._document_check_access('helpdesk.ticket', ticket_id, access_token=access_token)
except (AccessError, MissingError):
return request.redirect('/my')
if report_type in ('html', 'pdf', 'text'):
return self._show_report(model=ticket_sudo,report_type=report_type,report_ref='sh_all_in_one_helpdesk.action_portal_report_helpdesk_ticket',download=download)
if ticket_sudo:
if request.env.company.sh_receive_email_seeing_ticket:
body = _('Ticket visto por el cliente %s',ticket_sudo.partner_id.name)
_message_post_helper(
"helpdesk.ticket",
ticket_sudo.id,
body,
token=ticket_sudo.access_token,
message_type="notification",
subtype_xmlid="mail.mt_note",
partner_ids=ticket_sudo.user_id.sudo().partner_id.ids,
)
values = {
'token': access_token,
'maintenance': ticket_sudo,
'message': message,
'bootstrap_formatting': True,
'partner_id': ticket_sudo.partner_id.id,
'report_type': 'html',
}
return request.render("helpdesk_maintenance.portal_ticket_page_maintenance_emergency",values)"""
\ No newline at end of file
......@@ -7,7 +7,8 @@ $(document).ready(function(e) {
$("#portal_date_fail").datepicker({ dateFormat: 'dd-mm-yy' });
//verify_date();
verify_date();
$("#form_id").submit(function (e){
var ticket_type = $("#tck_type").val();
if (ticket_type == "mantenimiento"){
......@@ -53,6 +54,7 @@ $(document).ready(function(e) {
}
if (ticket_type == "emergencia_mantenimiento"){
var req = required_maintenance_emergency()
console.log(req)
if(req['portal_contact_name'] == ""){
e.preventDefault();
show_error("Es necesario llenar el campo de Nombre");
......@@ -96,9 +98,9 @@ $(document).ready(function(e) {
'portal_phone': $("#portal_phone").val(),
'portal_main_type': $("#portal_main_type").val(),
'portal_date_fail':$("#portal_date_fail").val(),
'portal_severity': $("#portal_severity").is(':checked'),
'portal_severity': $('input[name="portal_severity"]:checked').is(':checked'),
'portal_description': $("#portal_description").val(),
'portal_fail_type': $("#portal_fail_type").is(':checked'),
'portal_fail_type': $('input[name="portal_fail_type"]:checked').is(':checked'),
'portal_file': document.getElementById('portal_file').files.length
}
}
......@@ -111,7 +113,7 @@ $(document).ready(function(e) {
'portal_phone': $("#portal_phone").val(),
'portal_date_fail': $("#portal_date_fail").val(),
'portal_description': $("#portal_description").val(),
'portal_fail_type': $("#portal_fail_type").is(':checked'),
'portal_fail_type': $('input[name="portal_fail_type"]:checked').is(':checked'),
'portal_file': document.getElementById('portal_file').files.length
}
}
......@@ -125,7 +127,7 @@ $(document).ready(function(e) {
})
}
/*function verify_date(){
function verify_date(){
var t_type = $("#tck_type").val();
if (t_type == "mantenimiento"){
console.log("mantenimiento");
......@@ -136,7 +138,6 @@ $(document).ready(function(e) {
hours == date.getHours();
if(hours >= 8 && hours <= 20){
$("#mdl_shw").val("show");
//$("#new_request").addClass("");
}else{
$("#mdl_shw").val("hide");
$("#new_request").addClass("d-none")
......@@ -146,7 +147,7 @@ $(document).ready(function(e) {
$("#new_request").addClass("d-none")
}
}
}*/
}
if($("#mdl_shw").val() == 'show'){
$("#createticketModalMaintenance").modal("show");
......
......@@ -61,7 +61,7 @@
<!--Tipo de mantenimiento-->
<div t-attf-class="form-group o_website_form_required_custom #{error and 'portal_main_type' in error and 'has-error' or ''}">
<label class="control-label" for="portal_main_type">Tipo de Mantenimiento:</label>
<select class="form-control form-field o_website_form_required_custom" id="portal_main_type" name="portal_main_type">
<select class="form-control form-field o_website_form_required_custom" id="portal_main_type" name="portal_main_type" required="">
<option></option>
<t t-foreach="request.env['maintenance.type'].sudo().search([])" t-as="type">
<option t-att-value="type.id"><t t-esc="type.name" /></option>
......@@ -122,7 +122,7 @@
<t t-if="not tickets">
<p>No hay tickets relacionados.</p>
</t>
<t t-if="grouped_tickets" t-call="portal.portal_table">
<t t-foreach="grouped_tickets" t-as="ticket">
<thead>
......@@ -244,8 +244,6 @@
<template id="helpdesk_ticket_portal_content_maintenance" name="Helpdesk Ticket Portal Content">
<!-- Intro -->
<div id="introduction" t-attf-class="pb-2 pt-3 #{'card-header bg-white' if report_type == 'html' else ''}">
<h2 class="my-0">
<strong><em t-esc="maintenance.name" /></strong>
......
......@@ -2,10 +2,12 @@
<odoo>
<template id="portal_home_maintenance" name="Portal My Home : IT" inherit_id="portal.portal_my_home" priority="101">
<xpath expr="//div[hasclass('o_portal_docs')]" position="inside">
<t t-call="portal.portal_docs_entry">
<t t-set="title">Mantenimiento</t>
<t t-set="url" t-value="'/my/mantenimiento'" />
<t t-set="background" t-value="'/helpdesk_maintenance/static/src/img/mantenimiento.svg'"/>
<t t-if="request.env.user.is_maintenance">
<t t-call="portal.portal_docs_entry">
<t t-set="title">Mantenimiento</t>
<t t-set="url" t-value="'/my/mantenimiento'" />
<t t-set="background" t-value="'/helpdesk_maintenance/static/src/img/mantenimiento.svg'"/>
</t>
</t>
</xpath>
</template>
......@@ -23,11 +25,11 @@
</li>
<li t-if="page_name == 'm_emergency' or m_emergency" t-attf-class="breadcrumb-item #{'active ' if not soporte else ''}">
<a t-if="m_emergency" t-attf-href="/my/mantienimiento/emergencia?{{ keep_query() }}">Emergencia</a>
<a t-if="m_emergency" t-attf-href="/my/mantenimientos?{{ keep_query() }}">Emergencia</a>
<t t-else="">Emergencia</t>
</li>
<li t-if="m_emergency" class="breadcrumb-item active">
<t t-esc="maintenance.name" t-if="maintenance.name" />
<t t-esc="m_emergency.name" t-if="m_emergency.name" />
<t t-else=""><em>Mantenimiento</em></t>
</li>
......
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