Commit 2f99d324 by Arturo Jasso Origel

se coloco como campo de solo lectura el valor de tipo de ticket y se agrego un…

se coloco como campo de solo lectura el valor de tipo de ticket y se agrego un botón que permite cambiar el tipo de ticket, ya que al cambiarlo daba problemas por los permisos del usuario
parent 595c5dd5
......@@ -48,7 +48,7 @@
'views/odoo/helpdesk_reason.xml',
'views/odoo/res_users.xml',
'wizard/change_ticket_.xml',
'wizard/change_ticket_type.xml',
],
'assets': {
'web.assets_backend': [
......
......@@ -374,7 +374,7 @@ class HelpdeskTicket(models.Model):
'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']}
return {'type': 'ir.actions.client', 'tag': action['tag'],'target':'main','name':'Tablero de tickets'}
else:
return self.action_done()
......@@ -389,9 +389,10 @@ class HelpdeskTicket(models.Model):
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]:
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:
......@@ -445,4 +446,19 @@ class HelpdeskTicket(models.Model):
self.assign_me()
def ticket_change_type(self):
wizard = self.env['change.ticket.type'].sudo().create({
'ticket_id':self.id
})
return {
'name': 'Cambiar tipo',
'type': 'ir.actions.act_window',
'view_type':'form',
'view_mode':'form',
'res_model':'change.ticket.type',
'res_id': wizard.id,
'target':'new',
}
......@@ -20,8 +20,8 @@ user_purchase_order,purchase.order.user,purchase.model_purchase_order,sh_all_in_
user_sale_order,sale.order.user,sale.model_sale_order,sh_all_in_one_helpdesk.helpdesk_group_user,1,0,0,0
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
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
......
......@@ -10,6 +10,7 @@
<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="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)]}"/>
......@@ -65,7 +66,7 @@
<page string="Información General">
<group>
<group>
<field name="ticket_type" required="1"/>
<field name="ticket_type" force_save="1" readonly="1"/>
<field name="team_id" invisible="1"/>
<field name="team_head" invisible="1"/>
<field name="team_admin_id" invisible="1"/>
......
from . import change_ticket_user
from . import change_ticket_type
\ No newline at end of file
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class ChangeTicketType(models.TransientModel):
_name = 'change.ticket.type'
ticket_id = fields.Many2one('helpdesk.ticket','Ticket')
ticket_type_id = fields.Many2one('helpdesk.ticket.type','Tipo de ticket')
def ticket_change_team(self):
team = self.env['helpdesk.team'].sudo().search([('helpdesk_ticket_type_id','=',self.ticket_type_id.id)],limit=1)
update_values = {
'ticket_type':self.ticket_type_id.id,
'team_id': team.id,
}
if team.id == self.env.ref('helpdesk_morsa.purchase_actives').id and self.ticket_id.user_id:
update_values['user_id'] = False
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="change_ticket_type_view_form" model="ir.ui.view">
<field name="name">change.ticket.type.form</field>
<field name="model">change.ticket.type</field>
<field name="arch" type="xml">
<form string="">
<group>
<field name="ticket_id" invisible="1"/>
<field name="ticket_type_id" required="1"/>
</group>
<footer>
<button name="ticket_change_team" 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