Commit acb8bf59 by Arturo Jasso Origel

se han corregido cambios y se ha agregado apartado de permisos

parent 17db1b50
......@@ -22,6 +22,8 @@
'data/maintenance_type.xml',
'views/portal_my.xml',
'views/portal_maintenance.xml',
'views/portal_emergency.xml',
'views/helpdesk_ticket.xml',
],
'assets': {
'web.assets_frontend': [
......
......@@ -6,7 +6,7 @@
</record>
<record id="brickwork" model="maintenance.type">
<field name="name">Aire acondicionado</field>
<field name="name">Albañileria</field>
</record>
<record id="electricity" model="maintenance.type">
......
......@@ -19,14 +19,24 @@ class HelpdeskTicket(models.Model):
('1','Leve'),
('2','Medio'),
('3','Grave'),
])
],string='Tipo de gravedad')
fail_type = fields.Selection([
('fail','Falla'),('warranty','Garantía')
],string="Tipo de falla")
is_maintenance = fields.Boolean('Es mantenimiento',compute='_verify_ticket_type')
def _compute_access_url(self):
super(HelpdeskTicket, self)._compute_access_url()
for ticket in self:
if ticket.team_id.id == self.env.ref('helpdesk_maintenance.maintenance').id:
ticket.access_url = '/my/manteniminetos/%s' % (ticket.id)
if ticket.team_id.id == self.env.ref('helpdesk_maintenance.maintenance').id and ticket.maintenance_type_id.id == self.env.ref('helpdesk_maintenance.emergency').id:
ticket.access_url = '/my/manteniminetos/emergencias/%s' % (ticket.id)
@api.depends('team_id')
def _verify_ticket_type(self):
for ticket in self:
if ticket.team_id.id == self.env.ref('helpdesk_maintenance.maintenance').id:
ticket.is_maintenance = True
else:
ticket.is_maintenance = False
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"> <g> <g> <polygon points="216 48 208 16 304 16 296 48 216 48" fill="#fc0808" id="id_123"></polygon> <path d="M304,288H208l13.55-70.83A19.991,19.991,0,0,1,241.35,200h28.46a20,20,0,0,1,19.77,17Z" fill="#f70000" id="id_124"></path> <rect x="168" y="416" width="176" height="32" fill="#000000" id="id_125"></rect> <polygon points="304 16 296 48 216 48 208 16 304 16" fill="#ff0000" id="id_126"></polygon> <rect x="168" y="416" width="176" height="32" fill="#ff0000" id="id_127"></rect> <path d="M304,288H208l13.55-70.83A19.991,19.991,0,0,1,241.35,200h28.46a20,20,0,0,1,19.77,17Z" fill="#ff0000" id="id_128"></path> <line x1="200" y1="192" x2="192" y2="184" fill="none" id="id_129"></line> <line x1="312" y1="192" x2="320" y2="184" fill="none" id="id_130"></line> </g> <g> <path d="M372,8H140a28.031,28.031,0,0,0-28,28V476a28.031,28.031,0,0,0,28,28H372a28.031,28.031,0,0,0,28-28V36A28.031,28.031,0,0,0,372,8ZM293.75,24l-4,16h-67.5l-4-16ZM384,476a12.01,12.01,0,0,1-12,12H140a12.01,12.01,0,0,1-12-12V36a12.01,12.01,0,0,1,12-12h61.75l6.49,25.94A8,8,0,0,0,216,56h80a8,8,0,0,0,7.76-6.06L310.25,24H372a12.01,12.01,0,0,1,12,12Z" fill="#000000" id="id_131"></path> <path d="M93.027,227.713a8,8,0,0,0-11.314,0,40.013,40.013,0,0,0,0,56.574,8,8,0,1,0,11.314-11.314,24.012,24.012,0,0,1,0-33.946A8,8,0,0,0,93.027,227.713Z" fill="#ff0000" id="id_132"></path> <path d="M51,256a63.58,63.58,0,0,1,18.747-45.253,8,8,0,1,0-11.314-11.314,79.993,79.993,0,0,0,0,113.134,8,8,0,0,0,11.314-11.314A63.58,63.58,0,0,1,51,256Z" fill="#ff0d0d" id="id_133"></path> <path d="M418.343,227.713a8,8,0,0,0,0,11.314,24.012,24.012,0,0,1,0,33.946,8,8,0,0,0,11.314,11.314,40.013,40.013,0,0,0,0-56.574A8,8,0,0,0,418.343,227.713Z" fill="#ff0f0f" id="id_134"></path> <path d="M455.937,199.433a8,8,0,1,0-11.314,11.314,63.991,63.991,0,0,1,0,90.506,8,8,0,0,0,11.314,11.314,79.993,79.993,0,0,0,0-113.134Z" fill="#ff0000" id="id_135"></path> <path d="M344,408H168a8,8,0,0,0-8,8v32a8,8,0,0,0,8,8H344a8,8,0,0,0,8-8V416A8,8,0,0,0,344,408Zm-8,32H176V424H336Z" fill="#000000" id="id_136"></path> <path d="M320,280h-9.46l-13.08-64.42A27.836,27.836,0,0,0,269.81,192H241.35a28.13,28.13,0,0,0-27.69,23.84L201.39,280H192a8,8,0,0,0-8,8v32a8,8,0,0,0,8,8H320a8,8,0,0,0,8-8V288A8,8,0,0,0,320,280Zm-90.6-61.33c.03-.12.05-.24.07-.37A12.056,12.056,0,0,1,241.35,208h28.46a11.935,11.935,0,0,1,11.86,10.2c.02.13.04.26.07.39L294.21,280H217.68ZM312,312H200V296H312Z" fill="#000000" id="id_137"></path> <path d="M256,184a8,8,0,0,0,8-8V152a8,8,0,0,0-16,0v24A8,8,0,0,0,256,184Z" fill="#ff2121" id="id_138"></path> <path d="M176,248h16a8,8,0,0,0,0-16H176a8,8,0,0,0,0,16Z" fill="#ff1717" id="id_139"></path> <path d="M312,240a8,8,0,0,0,8,8h16a8,8,0,0,0,0-16H320A8,8,0,0,0,312,240Z" fill="#ff0f0f" id="id_140"></path> <path d="M194.343,197.657a8,8,0,0,0,11.314-11.314l-8-8a8,8,0,0,0-11.314,11.314Z" fill="#ff0000" id="id_141"></path> <path d="M312,200a7.976,7.976,0,0,0,5.657-2.343l8-8a8,8,0,0,0-11.314-11.314l-8,8A8,8,0,0,0,312,200Z" fill="#ff0a0a" id="id_142"></path> <path d="M280,368a8,8,0,0,0,0-16H232a8,8,0,0,0,0,16Z" fill="#000000" id="id_143"></path> <path d="M184,384a8,8,0,0,0,8,8H320a8,8,0,0,0,0-16H192A8,8,0,0,0,184,384Z" fill="#0a0000" id="id_144"></path> </g> </g> </svg>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -20,9 +20,6 @@ $(document).ready(function(e) {
show_error("Es necesario llenar el campo de Tipo de mantenimiento");
}
if(req['portal_date_fail'] == ""){
e.preventDefault();
show_error("Es necesario llenar el campo de Fecha de Falla");
}
......@@ -44,6 +41,40 @@ $(document).ready(function(e) {
}
}
if (ticket_type == "emergencia_mantenimiento"){
var req = required_maintenance()
if(req['portal_contact_name'] == ""){
e.preventDefault();
show_error("Es necesario llenar el campo de Nombre");
}
if(req['portal_email'] == ""){
e.preventDefault();
show_error("Es necesario llenar el campo de Correo");
}
if(req['portal_phone'] == ""){
e.preventDefault();
show_error("Es necesario llenar el campo de Teléfono");
}
if(req['portal_date_fail'] == ""){
e.preventDefault();
show_error("Es necesario llenar el campo de Fecha de Falla");
}
if(req['portal_description'] == ""){
e.preventDefault();
show_error("Es necesario llenar el campo de Descripción");
}
if(req['portal_fail_type'] == ""){
e.preventDefault();
show_error("Es necesario llenar el campo de Tipo de Falla");
}
if(req['portal_file'] == 0){
e.preventDefault();
show_error("Es necesario agregar los archivos de evidencia|");
}
}
});
......@@ -54,7 +85,7 @@ $(document).ready(function(e) {
'portal_email': $("#portal_email").val(),
'portal_phone': $("#portal_phone").val(),
'portal_main_type': $("#portal_main_type").val(),
'portal_date_fail': validate_Date($("#portal_date_fail").val()),
'portal_date_fail':$("#portal_date_fail").val(),
'portal_severity': $("#portal_severity").val(),
'portal_description': $("#portal_description").val(),
'portal_fail_type': $("#portal_fail_type").val(),
......@@ -62,6 +93,19 @@ $(document).ready(function(e) {
}
}
function required_maintenance_emergency(){
return {
'partner_id': $("#partner_id").val(),
'portal_contact_name': $("#portal_contact_name").val(),
'portal_email': $("#portal_email").val(),
'portal_phone': $("#portal_phone").val(),
'portal_date_fail': $("#portal_date_fail").val(),
'portal_description': $("#portal_description").val(),
'portal_fail_type': $("#portal_fail_type").val(),
'portal_file': document.getElementById('portal_file').files.length
}
}
function show_error(message){
return swal({
title:"Error",
......@@ -71,16 +115,30 @@ $(document).ready(function(e) {
})
}
function validate_Date(date){
$(document).on("change", "#portal_date_fail", function (e) {
let dateformat = /^(0?[1-9]|[1-2][0-9]|3[01])[\/](0?[1-9]|1[0-2])/;
var date = $("#portal_date_fail").val();
if (date.match(dateformat)){
var response = validate_Date(date)
console.log(response)
if (response == ""){
$("#portal_date_fail").val("");
show_error("Favor de ingresar el formato de fecha valido");
}
}else{
console.log('formato aún no valido')
}
});
function validate_Date(date){
let ListofDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
dt = date.split("/");
day = parseInt(dt[0])
month = parseInt(dt[1])
year = parseInt(dt[2])
if (month > 0 && month <= ListofDays.length){
day = parseInt(dt[0]);
month = parseInt(dt[1]);
year = parseInt(dt[2]);
if (month > 0 && month <= ListofDays.length && Number.isInteger(year)){
if( day > 0 && day <= ListofDays[month-1]){
return date
}else{
......@@ -89,14 +147,5 @@ $(document).ready(function(e) {
}else{
return "";
}
}else{
return "";
}
}
});
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="helpdesk_ticket_form_maintenance" model="ir.ui.view">
<field name="name">helpdesk.ticket.form.inherit.maintenance</field>
<field name="model">helpdesk.ticket</field>
<field name="inherit_id" ref="sh_all_in_one_helpdesk.helpdesk_ticket_form_view"/>
<field name="priority" eval="18"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='priority']" position="after">
<field name="is_maintenance" invisible="1"/>
<field name="maintenance_type_id" attrs="{'invisible':[('is_maintenance', '=', False)]}"/>
<field name="date_fail" attrs="{'invisible':[('is_maintenance', '=', False)]}"/>
<field name="fail_type" attrs="{'invisible':[('is_maintenance', '=', False)]}"/>
</xpath>
</field>
</record>
</data>
</odoo>
\ No newline at end of file
......@@ -13,13 +13,21 @@
<template id="portal_my_home_menu_ticket" name="Portal layout : ticket menu entries" inherit_id="portal.portal_breadcrumbs" priority="60">
<xpath expr="//ol[hasclass('o_portal_submenu')]" position="inside">
<li t-if="page_name == 'maintenance' or maintenance" t-attf-class="breadcrumb-item #{'active ' if not soporte else ''}">
<a t-if="maintenance" t-attf-href="/my/soporte?{{ keep_query() }}">Soporte Mantenimiento</a>
<a t-if="maintenance" t-attf-href="/my/mantenimientos?{{ keep_query() }}">Mantenimiento</a>
<t t-else="">Mantenimiento</t>
</li>
<li t-if="maintenance" class="breadcrumb-item active">
<t t-esc="maintenance.name" t-if="maintenance.name" />
<t t-else=""><em>Mantenimiento</em></t>
</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>
<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-else=""><em>Mantenimiento</em></t>
</li>
</xpath>
</template>
......@@ -40,11 +48,11 @@
</t>
<t t-call="portal.portal_docs_entry">
<t t-set="title">Emergencias</t>
<t t-set="url" t-value="'/my/erp'" />
<t t-set="count" t-value="erp_count" />
<t t-set="desc" t-value="'Soporte y Mejoras Odoo'"/>
<t t-set="avatar" t-value="'/helpdesk_morsa/static/src/img/erp.svg'"/>
<t t-set="background" t-value="'/helpdesk_morsa/static/src/img/erp_back.svg'"/>
<t t-set="url" t-value="'/my/mantenimientos/emergencias'" />
<t t-set="count" t-value="maintenance_count" />
<t t-set="desc" t-value="'Seguridad física o Patrimonial Comprometida'"/>
<t t-set="avatar" t-value="'/helpdesk_maintenance/static/src/img/emergency_icon.svg'"/>
<t t-set="background" t-value="'/helpdesk_maintenance/static/src/img/emergency_back.svg'"/>
</t>
......
......@@ -18,6 +18,7 @@
],
"data": [
'security/ir.model.access.csv',
'security/groups.xml',
'data/region.xml',
'data/helpdesk_team.xml',
'data/helpdesk_stage.xml',
......@@ -33,7 +34,7 @@
'views/portal/portal_page.xml',
'views/portal/portal_feedback.xml',
'views/odoo/helpdesk_settings.xml',
'views/odoo/helpdesk_ticket.xml',
#'views/odoo/helpdesk_ticket.xml',
'views/odoo/helpdesk_team.xml',
'views/odoo/helpdesk_warehouse.xml',
'views/odoo/helpdesk_module.xml',
......@@ -49,13 +50,8 @@
'https://unpkg.com/sweetalert/dist/sweetalert.min.js',
('replace', 'sh_all_in_one_helpdesk/static/src/js/portal.js', 'helpdesk_morsa/static/src/js/portal.js'),
],
},
'images': [
'static/img/morsa.png'
],
"application":False,
"auto_install":False,
"installable":True,
'images': [],
}
......@@ -72,3 +72,4 @@ class PortalHelpdeskMorsa(PortalHelpdesk):
else:
return json.dumps({"resp":"Error","message":"Favor de agregar un contacto valido"})
\ No newline at end of file
......@@ -14,6 +14,7 @@ _logger = logging.getLogger(__name__)
class HelpdeskTicket(models.Model):
_inherit = 'helpdesk.ticket'
erp_id = fields.Many2one('erp.modules','ERP')
incidence_type = fields.Selection([
('odoo', 'Falla Odoo Nacional'),
......@@ -35,16 +36,8 @@ class HelpdeskTicket(models.Model):
is_support = fields.Boolean('Es soporte',compute='_compute_ticket_type')
is_erp = fields.Boolean('Es ERP',compute='_compute_ticket_type')
is_emergency = fields.Boolean('Es 911',compute='_compute_ticket_type')
user_branch_id = fields.Many2one('warehouse.helpdesk',related="partner_id.user_ids.warehouse_id",store=True)
@api.onchange('partner_id')
def get_user_warehouse(self):
if self.partner_id:
user = self.env['res.users'].sudo().search([('partner_id','=',self.partner_id.id)],limit=1)
if user:
self.user_branch_id = user.warehouse_id.id
user_branch_id = fields.Many2one('warehouse.helpdesk',string='Usuario Sucursal',store=True)
#user_region_id = fields.Many2one('region.helpdesk',string="Región")
def _get_color(self):
......@@ -103,13 +96,6 @@ class HelpdeskTicket(models.Model):
self.team_id = self.env['helpdesk.team'].search([('helpdesk_ticket_type_id','=',self.ticket_type.id)]).id
@api.onchange('not_super')
def onchange_ticket_id_value(self):
if self.ticket_id:
self.ticket_id = False
@api.onchange('partner_id')
def onchange_partner_simple_info(self):
if self.partner_id:
......@@ -175,8 +161,7 @@ class HelpdeskTicket(models.Model):
vals['stage_id'] = company_id.new_stage_id.id
vals['color'] = 10
#if res.team_id.sequence_id:
# res.name =
res = super(HelpdeskTicket, self).create(vals)
if res.sh_sla_status_ids:
......@@ -316,7 +301,6 @@ class HelpdeskTicket(models.Model):
self.env['sh.helpdesk.ticket.stage.info'].sudo().create(stage_history)
def append_sla_policies(self):
sla = self.env['sh.helpdesk.sla'].search([
('sh_team_id','=',self.team_id.id),
......@@ -329,9 +313,6 @@ class HelpdeskTicket(models.Model):
'sh_sla_policy_ids':[(6,0,sla)]
})
def write(self,vals):
if "stage_id" in vals:
if self.description == '<p><br></p>' or self.description==False:
......@@ -343,9 +324,6 @@ class HelpdeskTicket(models.Model):
return super(HelpdeskTicket, self).write(vals)
def action_approve(self):
if self.description == '<p><br></p>' or self.description==False:
raise ValidationError (_("Para cambiar de etapa, es necesario agregar una descripción"))
......@@ -355,4 +333,3 @@ class HelpdeskTicket(models.Model):
......@@ -6,6 +6,7 @@ class RegionHelpdesk(models.Model):
_rec_name = 'name'
name = fields.Char('Nombre')
warehouse_ids = fields.One2many('warehouse.helpdesk','region_id',string="Sucursales")
\ No newline at end of file
......@@ -6,5 +6,5 @@ class WarehouseHelpdesk(models.Model):
_rec_name = "name"
name = fields.Char('Nombre')
region_id = fields.Many2one('region.helpdesk','Región')
region_id = fields.Many2one('region.helpdesk',string='Región')
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="user_ti" model="res.groups">
<field name="category_id" ref="sh_all_in_one_helpdesk.module_helpdesk_category"/>
<field name="name">Usuario de TI</field>
<field name="implied_ids" eval="[(6,0,[ref('sh_all_in_one_helpdesk.helpdesk_group_user')])]"/>
</record>
<record id="only_see_ti" model="ir.rule">
<field name="name">Ver tickets de TI</field>
<field name="model_id" ref="sh_all_in_one_helpdesk.model_helpdesk_ticket"/>
<field name="groups" eval="[(6,0,[ref('user_ti')])]"/>
<field name="perm_read" eval="1"/>
<field name="perm_write" eval="1"/>
<field name="perm_create" eval="1"/>
<field name="perm_unlink" eval="0"/>
<field name="domain_force">
[('team_id','in',[ref('helpdesk_morsa.techinnical_support'),ref('helpdesk_morsa.erp_asistense'),ref('helpdesk_morsa.ti_emergency')])]
</field>
</record>
</data>
</odoo>
\ No newline at end of file
......@@ -19,7 +19,7 @@
<xpath expr="//header" position="replace">
<header>
<button name="assign_me" type="object" string="Assignar a mi" class="oe_highlight" />
<button name="action_approve" type="object" string="Siguiente etapa" class="oe_highlight" attrs="{'invisible':['|','|',('cancel_stage_boolean','=',True),('done_stage_boolean','=',True),('closed_stage_boolean','=',True)]}"/>
<button name="action_approve" type="object" string="Siguiente etapa" class="oe_highlight" attrs="{'invisible':['|',('cancel_stage_boolean','=',True),'|',('done_stage_boolean','=',True),('closed_stage_boolean','=',True)]}"/>
<button name="action_reply" type="object" string="Respuesta" class="oe_highlight"/>
<button name="action_done" type="object" string="Resolver Ticket" class="oe_highlight" attrs="{'invisible':[('done_button_boolean','=',False)]}"/>
<button name="action_closed" type="object" string="Cerrar Ticket" class="oe_highlight" attrs="{'invisible':[('done_stage_boolean','=',False)]}"/>
......@@ -53,10 +53,10 @@
<field name="begin_before_ten_min"/>
</xpath>
<xpath expr="//field[@name='sub_category_id']" position="after">
<field name="ticket_reason"/>
<field name="ticket_reason" attrs="{'invisible':['|'('is_support', '=', False),'|',('is_erp', '=', False),('is_emergency', '=', False)]}"/>
</xpath>
<xpath expr="//field[@name='partner_id']" position="after">
<field name="user_branch_id" force_save="1" readonly="1"/>
<field name="user_branch_id"/>
</xpath>
</field>
</record>
......
......@@ -171,8 +171,8 @@
</div>
</div>
<div class="row">
<div class="mb-3 col-6">
<div class="row">
<div class="col-6">
<div class="row mb-3 ">
<div class="col-6">
<strong>Fecha de cancelación:</strong>
</div>
......@@ -181,8 +181,8 @@
</div>
</div>
</div>
<div class="mb-3 col-6">
<div class="row">
<div class=" col-6">
<div class="row mb-3 ">
<div class="col-6">
<strong>Cancelado por:</strong>
</div>
......@@ -194,7 +194,7 @@
</div>
<div class="row">
<div class="mb-3 col-6">
<div class="row">
<div class="row mb-3 ">
<div class="col-6">
<strong>Estado:</strong>
</div>
......@@ -204,7 +204,7 @@
</div>
</div>
<div class="mb-3 col-6">
<div class="row">
<div class="row mb-3 ">
<div class="col-6">
<strong>Razón de cancelación:</strong>
</div>
......
......@@ -15,6 +15,9 @@
<xpath expr="//div[@t-attf-class='col-12 col-md col-lg-6']" position="attributes">
<attribute name="t-attf-class">col-lg-10 col-md-12 col-sm-12</attribute>
</xpath>
<xpath expr="//div[@class='row align-items-center bg-white no-gutters border rounded']" position="attributes">
<attribute name="class">row align-items-center bg-white no-gutters border navbar-rounded</attribute>
</xpath>
</template>
......
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