diff --git a/helpdesk_morsa/__init__.py b/helpdesk_morsa/__init__.py index 38718f0..263ceab 100644 --- a/helpdesk_morsa/__init__.py +++ b/helpdesk_morsa/__init__.py @@ -1,2 +1,3 @@ from . import models -from . import controllers \ No newline at end of file +from . import controllers +from . import wizard \ No newline at end of file diff --git a/helpdesk_morsa/__manifest__.py b/helpdesk_morsa/__manifest__.py index f29d594..96d1ae4 100644 --- a/helpdesk_morsa/__manifest__.py +++ b/helpdesk_morsa/__manifest__.py @@ -11,6 +11,7 @@ "version":"15.0.34", "depends": [ "base", + "web", "portal_design_helpdesk", "sh_all_in_one_helpdesk", "vista_backend_theme", @@ -26,6 +27,7 @@ 'data/region.xml', 'data/helpdesk_team.xml', 'data/helpdesk_stage.xml', + 'data/helpdesk_team_level.xml', 'data/sla_policies.xml', 'data/modules.xml', 'data/warehouses.xml', @@ -44,11 +46,13 @@ 'views/odoo/erp_system.xml', 'views/odoo/helpdesk_module.xml', 'views/odoo/helpdesk_reason.xml', - 'views/odoo/res_users.xml', + 'views/odoo/res_users.xml', + 'wizard/change_ticket_.xml', + ], 'assets': { 'web.assets_backend': [ - '/helpdesk_morsa/static/src/scss/backend.scss' + '/helpdesk_morsa/static/src/scss/backend.scss', ], 'web.assets_frontend': [ '/helpdesk_morsa/static/src/scss/portal.scss', diff --git a/helpdesk_morsa/controllers/main.py b/helpdesk_morsa/controllers/main.py index 2215d7e..6e24255 100644 --- a/helpdesk_morsa/controllers/main.py +++ b/helpdesk_morsa/controllers/main.py @@ -70,28 +70,21 @@ class WebsiteTickets(DownloadReport): }) ticket = request.env['helpdesk.ticket'].sudo().search( [('id', '=', int(ticket_id))], limit=1) - _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) elif ticket: ticket.sudo().write(dic) diff --git a/helpdesk_morsa/controllers/portal.py b/helpdesk_morsa/controllers/portal.py index 38d0367..9b38c6a 100644 --- a/helpdesk_morsa/controllers/portal.py +++ b/helpdesk_morsa/controllers/portal.py @@ -64,7 +64,6 @@ class PortalHelpdeskMorsa(PortalHelpdesk): ('stage_id','=',request.env.ref('sh_all_in_one_helpdesk.close_stage').id), ('priority_new','=',False)]) - _logger.info(unvalued_tickets) if len(unvalued_tickets) >= 3: unvalued = [] diff --git a/helpdesk_morsa/controllers/portal_soporte.py b/helpdesk_morsa/controllers/portal_soporte.py index e1f7b5a..d711f54 100644 --- a/helpdesk_morsa/controllers/portal_soporte.py +++ b/helpdesk_morsa/controllers/portal_soporte.py @@ -79,7 +79,13 @@ class PortalHelpdeskMorsaSoporte(PortalHelpdesk): return values def prepare_technial_support(self): - domain = [('team_id.id','=',request.env.ref('helpdesk_morsa.techinnical_support').id)] + support = request.env.ref('helpdesk_morsa.techinnical_support').id + support_second = request.env.ref('helpdesk_morsa.support_second_level').id + support_third = request.env.ref('helpdesk_morsa.support_third_level').id + purchases = request.env.ref('helpdesk_morsa.purchase_actives').id + + + domain = [('team_id.id','in',[support,support_second,support_third,purchases])] return domain diff --git a/helpdesk_morsa/data/helpdesk_stage.xml b/helpdesk_morsa/data/helpdesk_stage.xml index 5115c2a..bfe2535 100644 --- a/helpdesk_morsa/data/helpdesk_stage.xml +++ b/helpdesk_morsa/data/helpdesk_stage.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <odoo> <data noupdate="1"> - <record id="response_10_minutes" model="helpdesk.stages"> - <field name="name">Respuesta 10 minutos</field> - <field name="sequence">1</field> - <field name="sh_next_stage" ref="sh_all_in_one_helpdesk.in_progress_stage" /> - </record> + <record id="response_10_minutes" model="helpdesk.stages"> + <field name="name">Respuesta 10 minutos</field> + <field name="sequence">1</field> + <field name="sh_next_stage" ref="sh_all_in_one_helpdesk.in_progress_stage" /> + </record> </data> </odoo> diff --git a/helpdesk_morsa/data/helpdesk_team_level.xml b/helpdesk_morsa/data/helpdesk_team_level.xml new file mode 100644 index 0000000..e225040 --- /dev/null +++ b/helpdesk_morsa/data/helpdesk_team_level.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <data noupdate="1"> + <record id="support_second_level" model="helpdesk.team"> + <field name="name">SOPORTE TÉCNICO 2do NIVEL</field> + <field name="short_name">SOP2</field> + <field name="team_head" ref="base.user_admin"/> + <field name="is_support_team" eval="True"/> + <field name="sh_resource_calendar_id" ref="resource.resource_calendar_std"/> + </record> + + <record id="support_third_level" model="helpdesk.team"> + <field name="name">SOPORTE TÉCNICO 3er NIVEL</field> + <field name="short_name">SOP3</field> + <field name="team_head" ref="base.user_admin"/> + <field name="is_support_team" eval="True"/> + <field name="sh_resource_calendar_id" ref="resource.resource_calendar_std"/> + </record> + + <record id="purchase_actives" model="helpdesk.team"> + <field name="name">COMPRAS ACTIVO</field> + <field name="short_name">COMP</field> + <field name="team_head" ref="base.user_admin"/> + <field name="sh_resource_calendar_id" ref="resource.resource_calendar_std"/> + </record> + </data> +</odoo> \ No newline at end of file diff --git a/helpdesk_morsa/models/helpdesk_ticket.py b/helpdesk_morsa/models/helpdesk_ticket.py index e45d2fe..ddb3e5a 100644 --- a/helpdesk_morsa/models/helpdesk_ticket.py +++ b/helpdesk_morsa/models/helpdesk_ticket.py @@ -1,12 +1,15 @@ -from odoo import models, fields, api, _, SUPERUSER_ID +import uuid +import pytz +import logging import random + +from odoo import models, fields, api, _, SUPERUSER_ID from datetime import datetime, timedelta from odoo.tools import email_re, email_escape_char, email_split from odoo.exceptions import UserError,ValidationError from odoo.tools import email_re -import uuid -import pytz -import logging +from odoo.http import request + _logger = logging.getLogger(__name__) @@ -53,6 +56,10 @@ class HelpdeskTicket(models.Model): comp_morsa = fields.Selection(related="partner_id.user_ids.comp_morsa",string='Empresa') user_changes_ids = fields.One2many('user.ticket.assign', 'ticket_id',string="Cambio de usuario") descripcion_solution = fields.Text('Descripción de solución') + in_proggres_stage = fields.Boolean('Etapa en progreso',compute='_compute_progess_stage') + 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') def _get_color(self): in_progress_stage = self.env.ref('sh_all_in_one_helpdesk.in_progress_stage').id @@ -75,12 +82,25 @@ class HelpdeskTicket(models.Model): rec.color = self.env['ir.config_parameter'].sudo().get_param('helpdesk_morsa.color_extreme_alert') else: rec.color = 10 + + + @api.onchange('support_description') + def onchange_description_information(self): + self.description = self.support_description + @api.depends('stage_id') + def _compute_progess_stage(self): + for rec in self: + if rec.stage_id.id == self.env.ref('sh_all_in_one_helpdesk.in_progress_stage').id: + rec.in_proggres_stage = True + else: + rec.in_proggres_stage = False + @api.depends('team_id') def _compute_ticket_type(self): for ticket in self: - if ticket.team_id.id == self.env.ref('helpdesk_morsa.techinnical_support').id: + if ticket.team_id.id in [self.env.ref('helpdesk_morsa.techinnical_support').id, self.env.ref('helpdesk_morsa.support_second_level').id, self.env.ref('helpdesk_morsa.support_third_level').id]: ticket.is_support = True else: ticket.is_support = False @@ -94,25 +114,24 @@ class HelpdeskTicket(models.Model): ticket.is_emergency = True else: ticket.is_emergency = False + + if ticket.team_id.id == self.env.ref('helpdesk_morsa.purchase_actives').id: + ticket.is_purchase = True + else: + ticket.is_purchase = False + def assign_me(self): self.user_id = self.env.user.id - - @api.onchange('team_id') - def onchange_ticket_type(self): - if self.team_id and not self.ticket_type: - self.ticket_type = self.team_id.helpdesk_ticket_type_id.id - elif self.team_id and self.ticket_type: - self.ticket_type = self.team_id.helpdesk_ticket_type_id.id - @api.onchange('ticket_type') def onchange_ticket_team(self): - if self.ticket_type and not self.team_id: - self.team_id = self.env['helpdesk.team'].search([('helpdesk_ticket_type_id','=',self.ticket_type.id)]).id - elif self.team_id and self.ticket_type: - self.team_id = self.env['helpdesk.team'].search([('helpdesk_ticket_type_id','=',self.ticket_type.id)]).id - + if self.ticket_type: + team = self.env['helpdesk.team'].sudo().search([('helpdesk_ticket_type_id','=',self.ticket_type.id)]).id + self.team_id = team + if team == self.env.ref('helpdesk_morsa.purchase_actives').id: + if self.user_id: + self.user_id = False @api.onchange('partner_id') def onchange_partner_simple_info(self): @@ -126,7 +145,12 @@ class HelpdeskTicket(models.Model): def _compute_access_url(self): super(HelpdeskTicket, self)._compute_access_url() for ticket in self: - if ticket.team_id.id == self.env.ref('helpdesk_morsa.techinnical_support').id: + if ticket.team_id.id in [ + self.env.ref('helpdesk_morsa.techinnical_support').id, + 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 + ]: ticket.access_url = '/my/soporte/%s' % (ticket.id) elif ticket.team_id.id == self.env.ref('helpdesk_morsa.erp_asistense').id: ticket.access_url = '/my/erp/%s' % (ticket.id) @@ -252,19 +276,15 @@ class HelpdeskTicket(models.Model): 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 = { @@ -336,6 +356,29 @@ class HelpdeskTicket(models.Model): 'sh_sla_policy_ids':[(6,0,sla)] }) + + def action_done(self): + if not self.descripcion_solution and self.is_support: + raise ValidationError(_("Para marcar como hecho es necesario llenar el campo Descripción de solución")) + return super(HelpdeskTicket, self).action_done() + + + + 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: + self.sudo().update({ + 'ticket_type': support.helpdesk_ticket_type_id.id, + 'team_id': support.id, + 'user_id': False, + }) + action = self.env.ref('sh_all_in_one_helpdesk.sh_action_ticket_dashboard').sudo().read()[0] + return {'type': 'ir.actions.client', 'tag': action['tag']} + else: + return self.action_done() + + def write(self,vals): if 'user_id' in vals: user = self.user_id.id if self.user_id else False @@ -344,12 +387,21 @@ class HelpdeskTicket(models.Model): 'user_second_id':vals['user_id'] })]) vals.update({'user_changes_ids':user_change}) - + 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]: + 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.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: + if self.descripcion_solution or 'descripcion_solution' in vals : + pass + else: + raise ValidationError(_("Para marcar como hecho es necesario llenar el campo Descripción de solución")) if 'description' in vals and vals["description"] != "" and self.description != False and vals['description'] != '<p><br></p>': min_description = int(self.env['ir.config_parameter'].sudo().get_param('helpdesk_morsa.description_min_lenght')) description = self.get_description_len(vals["description"]) @@ -361,22 +413,36 @@ class HelpdeskTicket(models.Model): else: 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")) else: return super(HelpdeskTicket, self).action_approve() + + def get_description_len(self,description): try: return len(description) except Exception as e: return 0 - + + def open_form_change_user(self): + if self.user_id: + wizard = self.env['change.ticket.user'].sudo().create({'ticket_id':self.id}) + return { + 'name': 'Cambiar usuario', + 'type': 'ir.actions.act_window', + 'view_type':'form', + 'view_mode':'form', + 'res_model':'change.ticket.user', + 'res_id': wizard.id, + 'target':'new', + } + else: + self.assign_me() + diff --git a/helpdesk_morsa/models/ticket_dashboard.py b/helpdesk_morsa/models/ticket_dashboard.py index ee973db..c805e18 100644 --- a/helpdesk_morsa/models/ticket_dashboard.py +++ b/helpdesk_morsa/models/ticket_dashboard.py @@ -5,8 +5,9 @@ from datetime import datetime from dateutil.relativedelta import relativedelta from odoo.tools import DEFAULT_SERVER_DATE_FORMAT import json - import logging +import pytz + _logger = logging.getLogger(__name__) @@ -40,9 +41,7 @@ class TicketDashboardInherit(models.Model): #doman.append(('company_id','in',[cids])) ticket_obj = self.env['helpdesk.ticket'].sudo().search( [], order='id desc', limit=1) - _logger.info(filter_date) if filter_date == 'today': - _logger.info('Entra today') dt_flt1 = [] dt_flt1.append('create_date') dt_flt1.append('>') @@ -231,8 +230,6 @@ class TicketDashboardInherit(models.Model): doman.append(('user_id', '=', self.env.user.id)) doman.append(('sh_user_ids', 'in', [self.env.user.id])) - _logger.info(doman) - search_tickets = self.env['helpdesk.ticket'].sudo().search(doman) if search_tickets: @@ -752,8 +749,8 @@ class TicketDashboardInherit(models.Model): if search_tickets: for ticket in search_tickets: - create_date = datetime.strftime(ticket.create_date,"%Y-%m-%d %H:%M:%S") - write_date = datetime.strftime(ticket.write_date,"%Y-%m-%d %H:%M:%S") + create_date = datetime.strftime(self.convert_dt_utc(ticket.create_date),"%Y-%m-%d %H:%M:%S") + write_date = datetime.strftime(self.convert_dt_utc(ticket.write_date),"%Y-%m-%d %H:%M:%S") ticket_dic = { 'ticket_id': ticket.id, 'ticket_no': ticket.name, @@ -773,4 +770,16 @@ class TicketDashboardInherit(models.Model): 'sh_all_in_one_helpdesk.ticket_dashboard_tbl', { 'ticket_data_dic': ticket_data_dic, 'ticket_data_list': ticket_data_list, - }) \ No newline at end of file + }) + + + + + def convert_dt_utc(self,date): + local = pytz.timezone(self.env.user.tz or pytz.utc) + date_convert = date.astimezone(local) + return date_convert + + + + \ No newline at end of file diff --git a/helpdesk_morsa/security/ir.model.access.csv b/helpdesk_morsa/security/ir.model.access.csv index cef4192..51e1426 100644 --- a/helpdesk_morsa/security/ir.model.access.csv +++ b/helpdesk_morsa/security/ir.model.access.csv @@ -5,13 +5,13 @@ admin_erp_modules,erp.modules.admin,model_erp_modules,sh_all_in_one_helpdesk.hel user_warehouse_helpdesk,warehouse.helpdesk_user,model_warehouse_helpdesk,base.group_user,1,0,0,0 hlp_warehouse_helpdesk,warehouse.helpdesk.admin,model_warehouse_helpdesk,sh_all_in_one_helpdesk.helpdesk_group_manager,1,1,1,1 -user_ticket_reason,ticket.reason.user,model_ticket_reason,base.group_user,,1,0,0,0 +user_ticket_reason,ticket.reason.user,model_ticket_reason,base.group_user,1,1,0,0 admin_ticket_reason,ticket.reason.admin,model_ticket_reason,sh_all_in_one_helpdesk.helpdesk_group_manager,1,1,1,1 -user_region_helpdesk,region.helpdesk.user,model_region_helpdesk,base.group_user,,1,0,0,0 +user_region_helpdesk,region.helpdesk.user,model_region_helpdesk,base.group_user,1,1,0,0 admin_region_helpdesk,region.helpdesk.admin,model_region_helpdesk,sh_all_in_one_helpdesk.helpdesk_group_manager,1,1,1,1 -user_erp_system,erp.system.user,model_erp_system,base.group_user,,1,0,0,0 +user_erp_system,erp.system.user,model_erp_system,base.group_user,1,0,0,0 admin_erp_system,erp.system.admin,model_erp_system,sh_all_in_one_helpdesk.helpdesk_group_manager,1,1,1,1 user_account_move,account.move.user,account.model_account_move,sh_all_in_one_helpdesk.helpdesk_group_user,1,0,0,0 @@ -21,6 +21,8 @@ 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 + 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 auditor_helpdesk_team,helpdeks.team.auditor,sh_all_in_one_helpdesk.model_helpdesk_team,helpdesk_morsa.ticket_auditor,1,0,0,0 diff --git a/helpdesk_morsa/views/odoo/helpdesk_ticket.xml b/helpdesk_morsa/views/odoo/helpdesk_ticket.xml index 1bf7cf5..4a5491c 100644 --- a/helpdesk_morsa/views/odoo/helpdesk_ticket.xml +++ b/helpdesk_morsa/views/odoo/helpdesk_ticket.xml @@ -12,7 +12,8 @@ <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_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)]}"/> + <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_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_open" type="object" string="Re-Abrir Ticket" class="oe_highlight" attrs="{'invisible':[('open_boolean','=',False)]}"/> @@ -46,18 +47,25 @@ <field name="is_support" invisible="1"/> <field name="is_erp" invisible="1"/> <field name="is_emergency" invisible="1"/> + <field name="is_purchase" invisible="1"/> + <field name="in_proggres_stage" invisible="1"/> <field name="team_members" widget="many2manytags" invisible="1"/> <label for="description" string="Descripción del problema"/> - <h3><field name="description" placeholder="Descripción"/></h3> + <h3> + <field name="description" placeholder="Descripción" attrs="{'invisible':[('is_support', '=', True)]}"/> + <field name="support_description" placeholder="Descripción" attrs="{'invisible':[('is_support', '=', False)]}"/> + </h3> <label for="descripcion_solution"/> - <h3><field name="descripcion_solution" placeholder="Descripción"/></h3> + <h3> + <field name="descripcion_solution" attrs="{'required':[('is_support', '=', True),('in_proggres_stage', '=', True)]}"/> + </h3> </xpath> <xpath expr="//group[1]" position="replace"></xpath> <xpath expr="//page[1]" position="replace"> <page string="Información General"> <group> <group> - <field name="ticket_type"/> + <field name="ticket_type" required="1"/> <field name="team_id" invisible="1"/> <field name="team_head" invisible="1"/> <field name="team_admin_id" invisible="1"/> @@ -81,6 +89,7 @@ <field name="person_name" invisible="1"/> <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="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'])]}"/> @@ -148,18 +157,9 @@ <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> + <field name="attachment_ids" widget="many2many_binary"/> </div> + </xpath> </field> @@ -237,6 +237,19 @@ <attribute name="style"></attribute> </t> </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="//field[@name='state']" position="replace"> + <div class="badge badge-pill float-right"> + <field name="user_id"/> + </div> + </xpath> + + + </field> </record> @@ -247,7 +260,7 @@ <field name="inherit_id" ref="sh_all_in_one_helpdesk.sh_helpdesk_ticket_time_inherit_kanban_view" /> <field name="arch" type="xml"> <xpath expr="//button[@name='action_ticket_start']" position="replace"> - <button name="assign_me" type="object" string="Asignarme" class="btn-primary">Asignarme</button> + <button name="open_form_change_user" type="object" string="Asignarme" class="btn-primary">Asignarme</button> </xpath> <xpath expr="//button[@name='action_ticket_end']" position="replace"> @@ -268,6 +281,7 @@ <field name="is_support" invisible="1"/> <field name="is_erp" invisible="1"/> <field name="is_emergency" invisible="1"/> + <field name="is_purchase" invisible="1"/> <field name="erp_type" widget="radio" attrs="{'invisible':[('is_erp', '=', False)]}" options="{'horizontal': true}"/> <field name="erp_id" attrs="{'invisible':[('is_erp', '=', False)]}"/> <field name="warehouse_id" attrs="{'invisible':[('is_erp', '=', False)]}"/> diff --git a/helpdesk_morsa/views/portal/portal_page.xml b/helpdesk_morsa/views/portal/portal_page.xml index 2334ffc..dfa37ae 100644 --- a/helpdesk_morsa/views/portal/portal_page.xml +++ b/helpdesk_morsa/views/portal/portal_page.xml @@ -3,7 +3,7 @@ <template id="portal_ticket_page_support" name="Ticket Portal Template" inherit_id="portal.portal_sidebar" primary="True"> <xpath expr="//div[hasclass('o_portal_sidebar')]" position="inside"> <div class="row mt16 o_portal_ticket_sidebar"> - <!-- Sidebar --> + <!-- Sidebar <t t-call="portal.portal_record_sidebar"> <t t-set="classes" t-value="'col-12 col-lg flex-lg-grow-0 d-print-none'" /> <t t-set="title"> @@ -37,7 +37,7 @@ </li> </ul> </t> - </t> + </t>--> <!-- Page Content --> <div id="ticket_content" class="col-12 col-lg justify-content-end"> @@ -79,7 +79,7 @@ </div> </div> </div> - <div class="mb-3 col-sm-12 col-md-6 col-lg-6"> + <div t-if="soporte.create_date" class="mb-3 col-sm-12 col-md-6 col-lg-6"> <div class="row"> <div class="col-6"> <strong>Fecha de creación:</strong> @@ -126,28 +126,7 @@ </div> </div> - <div class="row"> - <div class="mb-3 col-sm-12 col-md-6 col-lg-6"> - <div class="row"> - <div class="col-6"> - <strong>Fecha de replica:</strong> - </div> - <div class="col-6"> - <span t-field="soporte.replied_date" /> - </div> - </div> - </div> - <div class="mb-3 col-sm-12 col-md-6 col-lg-6"> - <div class="row"> - <div class="col-6"> - <strong>Fecha de cierre</strong> - </div> - <div class="col-6"> - <span t-field="soporte.close_date" /> - </div> - </div> - </div> - </div> + <div class="row"> <div class="mb-3 col-sm-12 col-md-6 col-lg-6"> <div class="row"> @@ -159,7 +138,7 @@ </div> </div> </div> - <div class="mb-3 col-sm-12 col-md-6 col-lg-6"> + <div t-if="soporte.close_by" class="mb-3 col-sm-12 col-md-6 col-lg-6"> <div class="row"> <div class="col-6"> <strong>Cerrado por: </strong> @@ -171,7 +150,7 @@ </div> </div> <div class="row"> - <div class="col-sm-12 col-md-6 col-lg-6"> + <div t-if="soporte.cancel_date" class="col-sm-12 col-md-6 col-lg-6"> <div class="row mb-3 "> <div class="col-6"> <strong>Fecha de cancelación:</strong> @@ -181,7 +160,7 @@ </div> </div> </div> - <div class="col-sm-12 col-md-6 col-lg-6"> + <div t-if="soporte.cancel_by" class="col-sm-12 col-md-6 col-lg-6"> <div class="row mb-3 "> <div class="col-6"> <strong>Cancelado por:</strong> @@ -203,7 +182,7 @@ </div> </div> </div> - <div class="mb-3 col-sm-12 col-md-6 col-lg-6"> + <div t-if="soporte.cancel_reason" class="mb-3 col-sm-12 col-md-6 col-lg-6"> <div class="row mb-3 "> <div class="col-6"> <strong>Razón de cancelación:</strong> @@ -214,6 +193,18 @@ </div> </div> </div> + <div class="row"> + <div t-if="soporte.close_date" class="mb-3 col-sm-12 col-md-6 col-lg-6"> + <div class="row"> + <div class="col-6"> + <strong>Fecha de cierre</strong> + </div> + <div class="col-6"> + <span t-field="soporte.close_date" /> + </div> + </div> + </div> + </div> <t t-if="soporte.comment"> <div class="row"> <div class="mb-3 col-12"> @@ -226,6 +217,7 @@ </div> </div> </t> + <t t-if="soporte.description"> <div class="row"> <div class="mb-3 col-12"> @@ -285,7 +277,7 @@ <template id="portal_ticket_page_erp" name="Ticket Portal Template" inherit_id="portal.portal_sidebar" primary="True"> <xpath expr="//div[hasclass('o_portal_sidebar')]" position="inside"> <div class="row mt16 o_portal_ticket_sidebar"> - <!-- Sidebar --> + <!-- Sidebar <t t-call="portal.portal_record_sidebar"> <t t-set="classes" t-value="'col-12 col-lg flex-lg-grow-0 d-print-none'" /> <t t-set="title"> @@ -319,7 +311,7 @@ </li> </ul> </t> - </t> + </t>--> <!-- Page Content --> <div id="ticket_content" class="col-12 col-lg justify-content-end"> @@ -419,7 +411,7 @@ </div> </div> </div> - <div class="mb-3 col-sm-12 col-md-6 col-lg-6"> + <div t-if="asistencia.close_date" class="mb-3 col-sm-12 col-md-6 col-lg-6"> <div class="row"> <div class="col-6"> <strong>Fecha de cierre:</strong> @@ -441,7 +433,7 @@ </div> </div> </div> - <div class="mb-3 col-sm-12 col-md-6 col-lg-6"> + <div t-if="asistencia.close_by" class="mb-3 col-sm-12 col-md-6 col-lg-6"> <div class="row"> <div class="col-6"> <strong>Cerrado por:</strong> @@ -453,7 +445,7 @@ </div> </div> <div class="row"> - <div class="mb-3 col-sm-12 col-md-6 col-lg-6"> + <div t-if="asistencia.cancel_date" class="mb-3 col-sm-12 col-md-6 col-lg-6"> <div class="row"> <div class="col-6"> <strong>Fecha de cancelación:</strong> @@ -463,7 +455,7 @@ </div> </div> </div> - <div class="mb-3 col-sm-12 col-md-6 col-lg-6"> + <div t-if="asistencia.cancel_by" class="mb-3 col-sm-12 col-md-6 col-lg-6"> <div class="row"> <div class="col-6"> <strong>Cancelado por:</strong> @@ -485,7 +477,7 @@ </div> </div> </div> - <div class="mb-3 col-sm-12 col-md-6 col-lg-6"> + <div t-if="asistencia.cancel_reason" class="mb-3 col-sm-12 col-md-6 col-lg-6"> <div class="row"> <div class="col-6"> <strong>Razón de cancelación:</strong> @@ -655,7 +647,7 @@ <template id="portal_ticket_page_911" name="Ticket Portal Template" inherit_id="portal.portal_sidebar" primary="True"> <xpath expr="//div[hasclass('o_portal_sidebar')]" position="inside"> <div class="row mt16 o_portal_ticket_sidebar"> - <!-- Sidebar --> + <!-- Sidebar <t t-call="portal.portal_record_sidebar"> <t t-set="classes" t-value="'col-12 col-lg flex-lg-grow-0 d-print-none'" /> <t t-set="title"> @@ -697,18 +689,17 @@ </div> <div class="col pl-0" style="min-width: 150px;"> <span>Heber Carvajal, </span> - <!--<a href="#discussion" class="small"><i class="fa fa-comment"></i> Mandar Mensaje:</a>--> + </div> <div class="col pl-0" style="min-width: 150px;"> <span>33 1600 8962</span> - <!--<a href="#discussion" class="small"><i class="fa fa-comment"></i> Mandar Mensaje:</a>--> </div> </t> </div> </li> </ul> </t> - </t> + </t> --> <!-- Page Content --> <div id="ticket_content" class="col-12 col-lg justify-content-end"> @@ -817,7 +808,7 @@ </div> </div> </div> - <div class="mb-3 col-sm-12 col-md-6 col-lg-6"> + <div t-if="ti.close_date" class="mb-3 col-sm-12 col-md-6 col-lg-6"> <div class="row"> <div class="col-6"> <strong>Fecha de cierre:</strong> @@ -839,7 +830,7 @@ </div> </div> </div> - <div class="mb-3 col-sm-12 col-md-6 col-lg-6"> + <div t-if="ti.close_by" class="mb-3 col-sm-12 col-md-6 col-lg-6"> <div class="row"> <div class="col-6"> <strong>Cerrado por:</strong> @@ -851,7 +842,7 @@ </div> </div> <div class="row"> - <div class="mb-3 col-sm-12 col-md-6 col-lg-6"> + <div t-if="ti.cancel_date" class="mb-3 col-sm-12 col-md-6 col-lg-6"> <div class="row"> <div class="col-6"> <strong>Fecha de cancelación:</strong> @@ -861,7 +852,7 @@ </div> </div> </div> - <div class="mb-3 col-sm-12 col-md-6 col-lg-6"> + <div t-if="ti.cancel_by" class="mb-3 col-sm-12 col-md-6 col-lg-6"> <div class="row"> <div class="col-6"> <strong>Cancelado por:</strong> @@ -883,7 +874,7 @@ </div> </div> </div> - <div class="mb-3 col-sm-12 col-md-6 col-lg-6"> + <div t-if="ti.cancel_reason" class="mb-3 col-sm-12 col-md-6 col-lg-6"> <div class="row"> <div class="col-6"> <strong>Motivo de cancelación:</strong> diff --git a/helpdesk_morsa/wizard/__init__.py b/helpdesk_morsa/wizard/__init__.py new file mode 100644 index 0000000..5ce9e8a --- /dev/null +++ b/helpdesk_morsa/wizard/__init__.py @@ -0,0 +1 @@ +from . import change_ticket_user \ No newline at end of file diff --git a/helpdesk_morsa/wizard/change_ticket_.xml b/helpdesk_morsa/wizard/change_ticket_.xml new file mode 100644 index 0000000..74d2bef --- /dev/null +++ b/helpdesk_morsa/wizard/change_ticket_.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <data> + <record id="change_ticket_user_view_form" model="ir.ui.view"> + <field name="name">change.ticket.user.form</field> + <field name="model">change.ticket.user</field> + <field name="arch" type="xml"> + <form string=""> + <group> + <p>El ticket ya tiene un usuario asignado,¿Desea cambiar de usuario?</p> + </group> + <field name="ticket_id" invisible="1"/> + <footer> + <button name="accept_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 diff --git a/helpdesk_morsa/wizard/change_ticket_user.py b/helpdesk_morsa/wizard/change_ticket_user.py new file mode 100644 index 0000000..c728d06 --- /dev/null +++ b/helpdesk_morsa/wizard/change_ticket_user.py @@ -0,0 +1,18 @@ +from odoo import models, fields, api, _ +from odoo.exceptions import UserError + +class ChangeTicketUser(models.TransientModel): + _name = 'change.ticket.user' + _description = 'Módulo encargado de traer la información del usuario' + + + ticket_id = fields.Many2one('helpdesk.ticket','Ticket') + + + + def accept_change_user(self): + self.ticket_id.update({'user_id':self.env.user.id}) + + def action_cancel(self): + return {'type': 'ir.actions.act_window_close'} +