Commit f4815f34 by Arturo Jasso Origel

se agregaron los siguientes cambios:

se retiro el botón de fecha respuesta,
el botón de cerrado se dejo aún visibile, pero cuando se resuelve el ticket, tambien cierra el ticket,
cambiar color de hecho a verde,
cambiar el botón de cancelar a rojo,
cambiar el nombre vista previa por vista usuario,
siguiente etapa cambiar al lado de asginar a mi,
eliminar el aparatdo que dice cliente respondio,
mover fecha de creación a vista principal de agente,
Asignar compras según la región si el equipo requiere configuración,
Botón para realizar la asignación de un ticket a un usuario
agregar en el apartado de erp el campo de 'sistema' para que lo agregen al levantar un ticket de erp,
parent cc16ea1f
......@@ -49,6 +49,7 @@
'views/odoo/res_users.xml',
'wizard/change_ticket_.xml',
'wizard/change_ticket_type.xml',
'wizard/change_user.xml',
],
'assets': {
'web.assets_backend': [
......
......@@ -403,7 +403,11 @@ class PortalHelpdeskMorsaErp(PortalHelpdesk):
'team_head': team_id.team_head.id,
})
if kw.get('portal_system'):
portal_system_id = request.env['erp.system'].sudo().browse(int(kw.get('portal_system')))
ticket_dic.update({
'system_id':portal_system_id.id
})
if kw.get('portal_erp_type'):
ticket_dic.update({
'erp_type':kw.get('portal_erp_type')
......
......@@ -60,6 +60,9 @@ class HelpdeskTicket(models.Model):
is_purchase = fields.Boolean('Es compra',compute='_compute_ticket_type')
requires_configuration = fields.Boolean('Require configuración')
support_description = fields.Char('Descripción de problema')
region_to_send = fields.Many2one('region.helpdesk','Región')
def _get_color(self):
in_progress_stage = self.env.ref('sh_all_in_one_helpdesk.in_progress_stage').id
......@@ -363,20 +366,37 @@ class HelpdeskTicket(models.Model):
return super(HelpdeskTicket, self).action_done()
def done_and_close(self):
self.action_done()
self.action_closed()
def change_ticket_team(self):
purchases = self.env.ref('helpdesk_morsa.purchase_actives').sudo()
support = self.env.ref('helpdesk_morsa.techinnical_support').sudo()
if self.team_id.id == purchases.id and self.requires_configuration == True:
user = False
user_to_assign = self.env['res.users'].sudo().search([
('is_support_user','=',True),('warehouse_id.region_id.id','=',self.region_to_send.id)
])
if user_to_assign:
if len(user_to_assign) > 1:
user = user_to_assign[0].id
else:
user = user_to_assign.id
self.sudo().update({
'ticket_type': support.helpdesk_ticket_type_id.id,
'team_id': support.id,
'user_id': False,
'requires_configuration':False,
'user_id': user,
})
action = self.env.ref('sh_all_in_one_helpdesk.sh_action_ticket_dashboard').sudo().read()[0]
return {'type': 'ir.actions.client', 'tag': action['tag'],'target':'main','name':'Tablero de tickets'}
else:
return self.action_done()
return self.done_and_close()
def write(self,vals):
......@@ -390,12 +410,10 @@ class HelpdeskTicket(models.Model):
if 'team_id' in vals:
if self.team_id.id != vals['team_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]:
_logger.info('Vals es soporte, erp y 911')
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]:
_logger.info('Equipo no es segundo o 3er nivel')
vals.update({'name': self.env['ir.sequence'].sudo().next_by_code('helpdesk.ticket.'+str(vals['team_id']) or _('New'))})
if self.is_support == True or self.is_erp == True or self.is_emergency == True:
if "stage_id" in vals:
if self.is_support == True:
if self.description == '<p><br></p>' or self.description==False:
raise ValidationError (_("Para cambiar de etapa, es necesario agregar una descripción"))
if vals['stage_id'] == self.env.ref('sh_all_in_one_helpdesk.done_stage').id:
......@@ -410,6 +428,13 @@ class HelpdeskTicket(models.Model):
if description-11 < min_description:
raise ValidationError (_("Favor de agregar al menos "+str(min_description)+" caracteres a la descripción"))
if vals["stage_id"] == self.env.ref('sh_all_in_one_helpdesk.done_stage').id:
self.action_done()
if vals["stage_id"] == self.env.ref('sh_all_in_one_helpdesk.close_stage').id:
self.action_closed()
return super(HelpdeskTicket, self).write(vals)
else:
return super(HelpdeskTicket, self).write(vals)
......@@ -461,4 +486,19 @@ class HelpdeskTicket(models.Model):
'target':'new',
}
def ticket_change_user(self):
wizard = self.env['change.user'].sudo().create({
'ticket_id':self.id,'user_ids': self.team_members
})
return {
'name': 'Cambio de usuario',
'type': 'ir.actions.act_window',
'view_type':'form',
'view_mode':'form',
'res_model':'change.user',
'res_id': wizard.id,
'target':'new',
}
......@@ -20,6 +20,8 @@ class ResUsers(models.Model):
is_erp_user = fields.Boolean('Es usuario de ERP')
is_911_user = fields.Boolean('Es usuario de 911')
#partner_id = fields.Many2one('res.partner',required=False, )
is_support_user = fields.Boolean('Es usuario Soporte')
@api.model
......
......@@ -22,6 +22,9 @@ user_sale_order,sale.order.user,sale.model_sale_order,sh_all_in_one_helpdesk.hel
access_user_ticket_assign,user.ticket.assign,model_user_ticket_assign,sh_all_in_one_helpdesk.helpdesk_group_user,1,1,1,1
access_change_ticket_user,change.ticket.user,model_change_ticket_user,base.group_user,1,1,1,1
access_change_ticket_type,change.ticket.type,model_change_ticket_type,base.group_user,1,1,1,1
access_change_user,change.user,model_change_user,base.group_user,1,1,1,1
auditor_helpdesk_ticket,helpdeks.ticket.auditor,sh_all_in_one_helpdesk.model_helpdesk_ticket,helpdesk_morsa.ticket_auditor,1,0,0,0
auditor_helpdesk_category,helpdesk_category.auditor,sh_all_in_one_helpdesk.model_helpdesk_category,helpdesk_morsa.ticket_auditor,1,0,0,0
......
......@@ -24,7 +24,13 @@
.o_form_statusbar{
position: fixed !important;
top: 190px;
left: 1;
left: 0;
width: 100%;
z-index: 100;
}
.btn_success{
background-color:green !important;
color:white !important;
font-family: "Odoo Unicode Support Noto", "Lucida Grande", Helvetica, Verdana, Arial, sans-serif !important;
}
\ No newline at end of file
......@@ -4,3 +4,6 @@
margin-left:15px;
margin-right:3px;
}
......@@ -9,20 +9,27 @@
<field name="arch" type="xml">
<xpath expr="//header" position="replace">
<header>
<button name="assign_me" type="object" string="Assignar a mi" class="oe_highlight"/>
<button name="ticket_change_type" type="object" string="Cambiar tipo de ticket" class="oe_highlight"/>
<button name="assign_me" type="object" string="Asignarme" 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_reply" type="object" string="Respuesta" class="oe_highlight" attrs="{'invisible':[('open_boolean','=',True)]}"/>
<button name="action_done" type="object" string="Resolver Ticket" class="oe_highlight" attrs="{'invisible':['|','|',('done_button_boolean','=',True),('open_boolean','=',True),('is_purchase','=',True)]}"/>
<button name="change_ticket_team" type="object" string="Resolver Ticket" class="oe_highlight" attrs="{'invisible':[('is_purchase','=',False)]}"/>
<!--<button name="action_reply" type="object" string="Respuesta" class="oe_highlight" attrs="{'invisible':[('open_boolean','=',True)]}"/>-->
<button name="done_and_close" type="object" string="Resolver Ticket" class="btn_success" attrs="{'invisible':['|','|',('done_button_boolean','=',True),('open_boolean','=',True),('is_purchase','=',True)]}"/>
<button name="change_ticket_team" type="object" string="Resolver Ticket" class="btn_success" attrs="{'invisible':['|','|',('is_purchase','=',False),('done_button_boolean','=',True),('open_boolean','=',True)]}"/>
<button name="action_closed" type="object" string="Cerrar Ticket" class="oe_highlight" attrs="{'invisible':['|',('done_stage_boolean','=',False),('open_boolean','=',False)]}"/>
<button name="action_cancel" type="object" string="Cancelar Ticket" class="oe_highlight" attrs="{'invisible':[('cancel_button_boolean','=',False)]}"/>
<button name="action_cancel" type="object" string="Cancelar Ticket" class="btn btn-danger" attrs="{'invisible':[('cancel_button_boolean','=',False)]}"/>
<button name="action_open" type="object" string="Re-Abrir Ticket" class="oe_highlight" attrs="{'invisible':[('open_boolean','=',False)]}"/>
<button name="preview_ticket" type="object" string="Vista previa"/>
<button name="preview_ticket" type="object" string="Vista de usuario"/>
<field name="stage_id" widget="statusbar"/>
</header>
</xpath>
<xpath expr="//div[@class='badge badge-pill badge-primary float-right']" position="replace">
</xpath>
<xpath expr="//div[@class='badge badge-pill badge-success float-right']" position="replace">
</xpath>
<xpath expr="//div[@class='oe_title']" position="replace">
<h1><field name="name" readonly="1"/></h1>
......@@ -53,12 +60,11 @@
<field name="team_members" widget="many2manytags" invisible="1"/>
<label for="description" string="Descripción del problema"/>
<h3>
<field name="description" placeholder="Descripción" attrs="{'invisible':[('is_support', '=', True)]}"/>
<field name="support_description" placeholder="Descripción" attrs="{'invisible':[('is_support', '=', False)]}"/>
<field name="description" placeholder="Descripción"/>
</h3>
<label for="descripcion_solution"/>
<h3>
<field name="descripcion_solution" attrs="{'required':[('is_support', '=', True),('in_proggres_stage', '=', True)]}"/>
<field name="descripcion_solution" />
</h3>
</xpath>
<xpath expr="//group[1]" position="replace"></xpath>
......@@ -70,7 +76,11 @@
<field name="team_id" invisible="1"/>
<field name="team_head" invisible="1"/>
<field name="team_admin_id" invisible="1"/>
<field name="user_id"/>
<label for="user_id"/>
<div class="o_row oe_inline">
<field name="user_id" widget="many2one"/>
<button name="ticket_change_user" type="object" icon="fa-user" class="btn-primary"/>
</div>
<field name="category_id"/>
<field name="priority"/>
<field name="ticket_reason"/>
......@@ -80,6 +90,7 @@
<field name="warehouse_id" attrs="{'invisible':[('is_erp', '=', False)]}"/>
</group>
<group>
<field name="create_date"/>
<field name="tag_ids" invisible="1"/>
<field name="subject_id" invisible="1"/>
<field name="sub_category_id" invisible="1"/>
......@@ -91,6 +102,7 @@
<field name="email" invisible="1"/>
<field name="system_id" attrs="{'invisible':[('is_support', '=', False),('is_erp', '=', False),('is_emergency', '=', False)]}"/>
<field name="requires_configuration" attrs="{'invisible':[('is_purchase', '=', False)]}"/>
<field name="region_to_send" attrs="{'invisible':[('requires_configuration', '=', False)], 'required':[('requires_configuration','=',True)]}" />
<field name="module_route" attrs="{'invisible':['|',('is_erp', '=', False),('erp_type','not in',['mejora','reporte'])]}"/>
<field name="process_text" attrs="{'invisible':['|',('is_erp', '=', False),('erp_type','not in',['mejora','reporte'])]}"/>
<field name="required_validation" attrs="{'invisible':['|',('is_erp', '=', False),('erp_type','not in',['mejora','reporte'])]}"/>
......
......@@ -11,6 +11,7 @@
<xpath expr="//field[@name='sh_portal_user_access']" position="after">
<field name="warehouse_id"/>
<field name="comp_morsa" required="1"/>
<field name="is_support_user"/>
<field name="is_erp_user"/>
<field name="is_911_user"/>
</xpath>
......
......@@ -52,6 +52,17 @@
<input type="text" class="form-control form-field s_website_form_required" id="portal_phone" name="portal_phone" required="True" />
</div>
<div t-attf-class="form-group o_website_form_required_custom #{error and 'portal_system' in error and 'has-error' or ''}">
<label class="control-label" for="portal_system">Sistema:</label>
<select class="form-control form-field o_website_form_required_custom" id="portal_system" name="portal_system" required="True">
<option></option>
<t t-foreach="request.env['erp.system'].sudo().search([])" t-as="system">
<option t-att-value="system.id"><t t-esc="system.name" /></option>
</t>
</select>
</div>
<input t-attf-class="form-group s_website_form_required" type="hidden" name="portal_erp_type" id="portal_erp_type" required="True"/>
<div class="form-group">
......
from . import change_ticket_user
from . import change_ticket_type
from . import change_user
\ No newline at end of file
......@@ -8,7 +8,7 @@
<form string="">
<group>
<field name="ticket_id" invisible="1"/>
<field name="ticket_type_id" required="1"/>
<field name="ticket_type_id" required="1" options="{'no_open': True, 'no_create': True,'no_create_edit':True}"/>
</group>
<footer>
<button name="ticket_change_team" string="Aceptar" type="object" class="btn-primary" />
......
# -*- coding: utf-8 -*-
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class ChangeUser(models.TransientModel):
_name = 'change.user'
ticket_id = fields.Many2one('helpdesk.ticket','Ticket')
user_ids = fields.Many2many(
comodel_name='res.users',
relation='res_user_wizard_change_user',
related='ticket_id.team_members',
)
user_id = fields.Many2one('res.users',string="Usuario Asignado", domain="[('id','in',user_ids)]")
def ticket_change_user(self):
update_values = {
'user_id': self.user_id.id,
}
self.ticket_id.sudo().update(update_values)
action = self.env.ref('sh_all_in_one_helpdesk.sh_action_ticket_dashboard').sudo().read()[0]
return {'type': 'ir.actions.client', 'tag': action['tag'],'target':'main','name':'Tablero de Tickets'}
def action_cancel(self):
return {'type': 'ir.actions.act_window_close'}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="ticket_change_user" model="ir.ui.view">
<field name="name">change.user.form</field>
<field name="model">change.user</field>
<field name="arch" type="xml">
<form string="">
<group>
<field name="ticket_id" invisible="1"/>
<field name="user_ids" invisible="1" widget="many2many_tags" />
<field name="user_id" required="1" options="{'no_open': True, 'no_create': True,'no_create_edit':True}"/>
</group>
<footer>
<button name="ticket_change_user" string="Aceptar" type="object" class="btn-primary" />
<button name="action_cancel" string="Cancel" class="btn-secondary" type="object" />
</footer>
</form>
</field>
</record>
</data>
</odoo>
\ No newline at end of file
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