Commit 4935a933 by Arturo Jasso Origel

cambio en los permisos, se cambiaron los metodos, para poder cambiar la manera…

cambio en los permisos, se cambiaron los metodos, para poder cambiar la manera en la que e muestran los registros en la tabla y en el conteo, se agregaron campos de empresa,y erp user y 911 user, se eliminaron los logger y se agregaron campos a las vistas
parent 9728e484
...@@ -50,6 +50,7 @@ class HelpdeskTicket(models.Model): ...@@ -50,6 +50,7 @@ class HelpdeskTicket(models.Model):
module_impact = fields.Char("¿Tu solicitud, impacta de algún modo a algún otro Módulo?") module_impact = fields.Char("¿Tu solicitud, impacta de algún modo a algún otro Módulo?")
system_id = fields.Many2one('erp.system','Sistema') system_id = fields.Many2one('erp.system','Sistema')
team_admin_id = fields.Many2one('res.users',string="Administrador del equipo",related='team_id.team_admin_id') team_admin_id = fields.Many2one('res.users',string="Administrador del equipo",related='team_id.team_admin_id')
comp_morsa = fields.Selection(related="partner_id.user_ids.comp_morsa",string='Empresa')
def _get_color(self): def _get_color(self):
...@@ -331,7 +332,7 @@ class HelpdeskTicket(models.Model): ...@@ -331,7 +332,7 @@ class HelpdeskTicket(models.Model):
if 'description' in vals and vals["description"] != "" and self.description != False and vals['description'] != '<p><br></p>': 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')) min_description = int(self.env['ir.config_parameter'].sudo().get_param('helpdesk_morsa.description_min_lenght'))
description = self.get_description_len(vals["description"]) description = self.get_description_len(vals["description"])
_logger.info(description)
if description-11 < min_description: if description-11 < min_description:
raise ValidationError (_("Favor de agregar al menos "+str(min_description)+" caracteres a la descripción")) raise ValidationError (_("Favor de agregar al menos "+str(min_description)+" caracteres a la descripción"))
return super(HelpdeskTicket, self).write(vals) return super(HelpdeskTicket, self).write(vals)
......
...@@ -5,9 +5,20 @@ class ResUsers(models.Model): ...@@ -5,9 +5,20 @@ class ResUsers(models.Model):
_inherit = 'res.users' _inherit = 'res.users'
warehouse_id = fields.Many2one('warehouse.helpdesk','Sucursal') warehouse_id = fields.Many2one('warehouse.helpdesk','Sucursal')
warehouse_ids = fields.Many2many( #warehouse_ids = fields.Many2many(
string='Sucursales Permitidas', # string='Sucursales Permitidas',
comodel_name='warehouse.helpdesk', # comodel_name='warehouse.helpdesk',
relation='warehouse_helpdesk_res_users_rel' # relation='warehouse_helpdesk_res_users_rel'
) # )
name = fields.Char('Name',store=True) name = fields.Char('Name',store=True)
comp_morsa = fields.Selection([
('gmm','Grupo Morsa de México'),
('energy','Energy Parts'),
('tracto','Tracto Unión'),
('refago','RefaGO'),
],'Empresa')
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, )
...@@ -26,7 +26,7 @@ class TicketDashboardInherit(models.Model): ...@@ -26,7 +26,7 @@ class TicketDashboardInherit(models.Model):
] ]
teams = self.env['helpdesk.team'].sudo().search([]) teams = self.env['helpdesk.team'].sudo().search([])
team_heads = list(teams.mapped('team_head').ids+teams.mapped('team_admin_id').ids) team_heads = list(teams.mapped('team_head').ids+teams.mapped('team_admin_id').ids)
_logger.info(team_heads)
domain.append(('id','in',team_heads)) domain.append(('id','in',team_heads))
users = self.env['res.users'].sudo().search_read(domain) users = self.env['res.users'].sudo().search_read(domain)
return users return users
...@@ -47,6 +47,9 @@ class TicketDashboardInherit(models.Model): ...@@ -47,6 +47,9 @@ class TicketDashboardInherit(models.Model):
for stage in company_id.dashboard_filter: for stage in company_id.dashboard_filter:
doman = [] doman = []
id_list = [] id_list = []
doman.append(('stage_id', '=', stage.id))
doman.append(('company_id','in',cids))
if filter_date == 'today': if filter_date == 'today':
dt_flt1 = [] dt_flt1 = []
...@@ -81,6 +84,7 @@ class TicketDashboardInherit(models.Model): ...@@ -81,6 +84,7 @@ class TicketDashboardInherit(models.Model):
dt_flt2.append(prev_day) dt_flt2.append(prev_day)
doman.append(tuple(dt_flt2)) doman.append(tuple(dt_flt2))
elif filter_date == 'weekly': # current week elif filter_date == 'weekly': # current week
dt_flt1 = [] dt_flt1 = []
...@@ -176,6 +180,7 @@ class TicketDashboardInherit(models.Model): ...@@ -176,6 +180,7 @@ class TicketDashboardInherit(models.Model):
dt_flt2.append( dt_flt2.append(
datetime.now().date().strftime("%Y/01/01 00:00:00")) datetime.now().date().strftime("%Y/01/01 00:00:00"))
doman.append(tuple(dt_flt2)) doman.append(tuple(dt_flt2))
elif filter_date == 'custom': elif filter_date == 'custom':
if start_date and end_date: if start_date and end_date:
dt_flt1 = [] dt_flt1 = []
...@@ -191,53 +196,50 @@ class TicketDashboardInherit(models.Model): ...@@ -191,53 +196,50 @@ class TicketDashboardInherit(models.Model):
dt_flt2.append(datetime.strptime( dt_flt2.append(datetime.strptime(
str(end_date), DEFAULT_SERVER_DATE_FORMAT).strftime("%Y/%m/%d")) str(end_date), DEFAULT_SERVER_DATE_FORMAT).strftime("%Y/%m/%d"))
doman.append(tuple(dt_flt2)) doman.append(tuple(dt_flt2))
if team and team not in [None,False,""] and int(team) != 0: if team and team not in [None,False,""] and int(team) != 0:
doman.append(('team_id', '=', int(team))) doman.append(('team_id', '=', int(team)))
elif team and team not in [None,False,""] and int(team) == 0:
if self.env.user.has_group('sh_all_in_one_helpdesk.helpdesk_group_team_leader') and self.env.user.has_group('sh_all_in_one_helpdesk.helpdesk_group_user') and not self.env.user.has_group('sh_all_in_one_helpdesk.helpdesk_group_manager'):
team_ids = self.env['helpdesk.team'].sudo().search(
['|',('team_head', '=', self.env.user.id), ('team_members', 'in', [self.env.user.id])])
doman.append(('team_id', 'in', team_ids.ids))
elif not self.env.user.has_group('sh_all_in_one_helpdesk.helpdesk_group_team_leader') and self.env.user.has_group('sh_all_in_one_helpdesk.helpdesk_group_user') and not self.env.user.has_group('sh_all_in_one_helpdesk.helpdesk_group_manager'):
team_ids = self.env['helpdesk.team'].sudo().search(
[('team_members', 'in', [self.env.user.id])])
doman.append(('team_id', 'in', team_ids.ids))
"""
if self.env.user.has_group('helpdesk_morsa.ticket_team_admin'):
doman.append(('|'))
doman.append(('team_admin_id','=',self.env.user.id))
doman.append(('team_admin_id','=',False))
"""
if team_leader and team_leader not in [None,False,""] and int(team_leader) != 0: if team_leader and team_leader not in [None,False,""] and int(team_leader) != 0:
doman.append(('team_head', '=', int(team_leader))) doman.append(('team_head', '=', int(team_leader)))
elif team_leader and team_leader not in [None,False,""] and int(team_leader) == 0:
if self.env.user.has_group('sh_all_in_one_helpdesk.helpdesk_group_team_leader') and self.env.user.has_group('sh_all_in_one_helpdesk.helpdesk_group_user') and not self.env.user.has_group('sh_all_in_one_helpdesk.helpdesk_group_manager'):
doman.append(('|'))
doman.append(('|'))
doman.append(('team_head', '=', self.env.user.id))
doman.append(('user_id', '=', self.env.user.id))
doman.append(('sh_user_ids', 'in', [self.env.user.id]))
if assign_user and assign_user not in [None,False,""] and int(assign_user) != 0: if assign_user and assign_user not in [None,False,""] and int(assign_user) != 0:
doman.append(('|')) doman.append(('|'))
doman.append(('|'))
doman.append(('user_id', '=', int(assign_user))) doman.append(('user_id', '=', int(assign_user)))
doman.append(('sh_user_ids', 'in', [int(assign_user)])) doman.append(('sh_user_ids', 'in', [int(assign_user)]))
doman.append(('team_id.team_members','in',[self.env.user.id]))
elif assign_user and assign_user not in [None,False,""] and int(assign_user) == 0: elif assign_user and assign_user not in [None,False,""] and int(assign_user) == 0:
if self.env.user.has_group('sh_all_in_one_helpdesk.helpdesk_group_team_leader') and self.env.user.has_group('sh_all_in_one_helpdesk.helpdesk_group_user') and not self.env.user.has_group('sh_all_in_one_helpdesk.helpdesk_group_manager'): if self.env.user.has_group(
'sh_all_in_one_helpdesk.helpdesk_group_team_leader'
) and self.env.user.has_group(
'sh_all_in_one_helpdesk.helpdesk_group_user'
) and not self.env.user.has_group(
'sh_all_in_one_helpdesk.helpdesk_group_manager'
):
doman.append(('|')) doman.append(('|'))
doman.append(('|')) doman.append(('|'))
doman.append(('sh_user_ids', 'in', [self.env.user.id])) doman.append(('sh_user_ids', 'in', [self.env.user.id]))
doman.append(('user_id', '=', self.env.user.id)) doman.append(('user_id', '=', self.env.user.id))
doman.append(('team_head', '=', self.env.user.id)) doman.append(('team_id.team_members','in',[self.env.user.id]))
elif not self.env.user.has_group('sh_all_in_one_helpdesk.helpdesk_group_team_leader') and self.env.user.has_group('sh_all_in_one_helpdesk.helpdesk_group_user') and not self.env.user.has_group('sh_all_in_one_helpdesk.helpdesk_group_manager'):
elif not self.env.user.has_group(
'sh_all_in_one_helpdesk.helpdesk_group_team_leader'
) and self.env.user.has_group(
'sh_all_in_one_helpdesk.helpdesk_group_user'
) and not self.env.user.has_group(
'sh_all_in_one_helpdesk.helpdesk_group_manager'
):
doman.append(('|')) doman.append(('|'))
doman.append(('user_id', '=', self.env.user.id)) doman.append(('user_id', '=', self.env.user.id))
doman.append(('sh_user_ids', 'in', [self.env.user.id])) doman.append(('sh_user_ids', 'in', [self.env.user.id]))
ticket_list = []
doman.append(('stage_id', '=', stage.id)) ticket_list = []
doman.append(('company_id','in',cids))
#CHANCE DOMAN #CHANCE DOMAN
if self.env.user.has_group('helpdesk_morsa.ticket_team_admin'): if self.env.user.has_group('helpdesk_morsa.ticket_team_admin'):
doman = [] doman = []
...@@ -246,8 +248,9 @@ class TicketDashboardInherit(models.Model): ...@@ -246,8 +248,9 @@ class TicketDashboardInherit(models.Model):
doman.append(('|')) doman.append(('|'))
doman.append(('team_admin_id','=',self.env.user.id)) doman.append(('team_admin_id','=',self.env.user.id))
doman.append(('team_admin_id','=',False)) doman.append(('team_admin_id','=',False))
search_tickets = ticket_obj.search(doman) search_tickets = ticket_obj.search(doman)
_logger.info(search_tickets)
if search_tickets: if search_tickets:
for ticket in search_tickets: for ticket in search_tickets:
create_date = datetime.strftime(ticket.create_date,"%Y-%m-%d %H:%M:%S") create_date = datetime.strftime(ticket.create_date,"%Y-%m-%d %H:%M:%S")
...@@ -266,9 +269,6 @@ class TicketDashboardInherit(models.Model): ...@@ -266,9 +269,6 @@ class TicketDashboardInherit(models.Model):
('id', '=', stage.id) ('id', '=', stage.id)
], limit=1) ], limit=1)
ticket_wrong = 0 ticket_wrong = 0
if search_stage: if search_stage:
ticket_data_dic.update({search_stage.name: ticket_list}) ticket_data_dic.update({search_stage.name: ticket_list})
...@@ -281,9 +281,255 @@ class TicketDashboardInherit(models.Model): ...@@ -281,9 +281,255 @@ class TicketDashboardInherit(models.Model):
list_ids = [id_list,ticket_wrong] list_ids = [id_list,ticket_wrong]
data_dict.update({search_stage.name: [list_ids,ticket_wrong]}) data_dict.update({search_stage.name: [list_ids,ticket_wrong]})
ticket_data_list.append(search_stage.name) ticket_data_list.append(search_stage.name)
_logger.info(doman)
return self.env['ir.ui.view'].with_context()._render_template('sh_all_in_one_helpdesk.ticket_dashboard_count', { return self.env['ir.ui.view'].with_context()._render_template('sh_all_in_one_helpdesk.ticket_dashboard_count', {
'ticket_data_dic': ticket_data_dic, 'ticket_data_dic': ticket_data_dic,
'ticket_data_list': ticket_data_list, 'ticket_data_list': ticket_data_list,
'data_dict': data_dict, 'data_dict': data_dict,
}) })
@api.model
def get_ticket_table_data(self,team_leader,team,assign_user,filter_date,start_date,end_date):
ticket_obj = request.env['helpdesk.ticket'].sudo().search(
[], order='id desc', limit=1)
company_id = request.env.company
uid = request.session.uid
user = request.env['res.users'].sudo().browse(uid)
cids = request.httprequest.cookies.get('cids', str(user.company_id.id))
cids = [int(cid) for cid in cids.split(',')]
ticket_data_dic = {}
ticket_data_list = []
for stage in company_id.dashboard_filter:
doman = []
id_list = []
doman.append(('stage_id', '=', stage.id))
doman.append(('company_id','in',cids))
if filter_date == 'today':
dt_flt1 = []
dt_flt1.append('create_date')
dt_flt1.append('>')
dt_flt1.append(
datetime.now().date().strftime("%Y/%m/%d 00:00:00"))
doman.append(tuple(dt_flt1))
dt_flt2 = []
dt_flt2.append('create_date')
dt_flt2.append('<=')
dt_flt2.append(
datetime.now().date().strftime("%Y/%m/%d 23:59:59"))
doman.append(tuple(dt_flt2))
elif filter_date == 'yesterday':
dt_flt1 = []
dt_flt1.append('create_date')
dt_flt1.append('>')
prev_day = (datetime.now().date() -
relativedelta(days=1)).strftime('%Y/%m/%d 00:00:00')
dt_flt1.append(prev_day)
doman.append(tuple(dt_flt1))
dt_flt2 = []
dt_flt2.append('create_date')
dt_flt2.append('<=')
prev_day = (datetime.now().date() -
relativedelta(days=1)).strftime('%Y/%m/%d 23:59:59')
dt_flt2.append(prev_day)
doman.append(tuple(dt_flt2))
elif filter_date == 'weekly': # current week
dt_flt1 = []
dt_flt1.append('create_date')
dt_flt1.append('>')
dt_flt1.append((datetime.now().date(
) - relativedelta(weeks=1, weekday=0)).strftime("%Y/%m/%d 00:00:00"))
doman.append(tuple(dt_flt1))
dt_flt2 = []
dt_flt2.append('create_date')
dt_flt2.append('<=')
dt_flt2.append(
datetime.now().date().strftime("%Y/%m/%d 23:59:59"))
doman.append(tuple(dt_flt2))
elif filter_date == 'prev_week': # Previous week
dt_flt1 = []
dt_flt1.append('create_date')
dt_flt1.append('>')
dt_flt1.append((datetime.now().date(
) - relativedelta(weeks=2, weekday=0)).strftime("%Y/%m/%d 00:00:00"))
doman.append(tuple(dt_flt1))
dt_flt2 = []
dt_flt2.append('create_date')
dt_flt2.append('<=')
dt_flt2.append((datetime.now().date(
) - relativedelta(weeks=1, weekday=6)).strftime("%Y/%m/%d 23:59:59"))
doman.append(tuple(dt_flt2))
elif filter_date == 'monthly': # Current Month
dt_flt1 = []
dt_flt1.append('create_date')
dt_flt1.append('>')
dt_flt1.append(
(datetime.now().date()).strftime("%Y/%m/01 00:00:00"))
doman.append(tuple(dt_flt1))
dt_flt2 = []
dt_flt2.append('create_date')
dt_flt2.append('<=')
dt_flt2.append(
datetime.now().date().strftime("%Y/%m/%d 23:59:59"))
doman.append(tuple(dt_flt2))
elif filter_date == 'prev_month': # Previous Month
dt_flt1 = []
dt_flt1.append('create_date')
dt_flt1.append('>')
dt_flt1.append(
(datetime.now().date() - relativedelta(months=1)).strftime("%Y/%m/01 00:00:00"))
doman.append(tuple(dt_flt1))
dt_flt2 = []
dt_flt2.append('create_date')
dt_flt2.append('<')
dt_flt2.append(
datetime.now().date().strftime("%Y/%m/01 00:00:00"))
doman.append(tuple(dt_flt2))
elif filter_date == 'cur_year': # Current Year
dt_flt1 = []
dt_flt1.append('create_date')
dt_flt1.append('>')
dt_flt1.append(
(datetime.now().date()).strftime("%Y/01/01 00:00:00"))
doman.append(tuple(dt_flt1))
dt_flt2 = []
dt_flt2.append('create_date')
dt_flt2.append('<=')
dt_flt2.append(
datetime.now().date().strftime("%Y/%m/%d 23:59:59"))
doman.append(tuple(dt_flt2))
elif filter_date == 'prev_year': # Previous Year
dt_flt1 = []
dt_flt1.append('create_date')
dt_flt1.append('>')
dt_flt1.append(
(datetime.now().date() - relativedelta(years=1)).strftime("%Y/01/01 00:00:00"))
doman.append(tuple(dt_flt1))
dt_flt2 = []
dt_flt2.append('create_date')
dt_flt2.append('<')
dt_flt2.append(
datetime.now().date().strftime("%Y/01/01 00:00:00"))
doman.append(tuple(dt_flt2))
elif filter_date == 'custom':
if start_date and end_date:
dt_flt1 = []
dt_flt1.append('create_date')
dt_flt1.append('>=')
dt_flt1.append(datetime.strptime(
str(start_date), DEFAULT_SERVER_DATE_FORMAT).strftime("%Y/%m/%d"))
doman.append(tuple(dt_flt1))
dt_flt2 = []
dt_flt2.append('create_date')
dt_flt2.append('<=')
dt_flt2.append(datetime.strptime(
str(end_date), DEFAULT_SERVER_DATE_FORMAT).strftime("%Y/%m/%d"))
doman.append(tuple(dt_flt2))
if team and team not in [None,False,""] and int(team) != 0:
doman.append(('team_id', '=', int(team)))
if team_leader and team_leader not in [None,False,""] and int(team_leader) != 0:
doman.append(('team_head', '=', int(team_leader)))
if assign_user and assign_user not in [None,False,""] and int(assign_user) != 0:
doman.append(('|'))
doman.append(('|'))
doman.append(('user_id', '=', int(assign_user)))
doman.append(('sh_user_ids', 'in', [int(assign_user)]))
doman.append(('team_id.team_members','in',[self.env.user.id]))
elif assign_user and assign_user not in [None,False,""] and int(assign_user) == 0:
if self.env.user.has_group(
'sh_all_in_one_helpdesk.helpdesk_group_team_leader'
) and self.env.user.has_group(
'sh_all_in_one_helpdesk.helpdesk_group_user'
) and not self.env.user.has_group(
'sh_all_in_one_helpdesk.helpdesk_group_manager'
):
doman.append(('|'))
doman.append(('|'))
doman.append(('sh_user_ids', 'in', [self.env.user.id]))
doman.append(('user_id', '=', self.env.user.id))
doman.append(('team_id.team_members','in',[self.env.user.id]))
if not self.env.user.has_group(
'sh_all_in_one_helpdesk.helpdesk_group_team_leader'
) and self.env.user.has_group(
'sh_all_in_one_helpdesk.helpdesk_group_user'
) and not self.env.user.has_group(
'sh_all_in_one_helpdesk.helpdesk_group_manager'
):
doman.append(('|'))
doman.append(('user_id', '=', self.env.user.id))
doman.append(('sh_user_ids', 'in', [self.env.user.id]))
ticket_list = []
#CHANCE DOMAN
if self.env.user.has_group('helpdesk_morsa.ticket_team_admin'):
doman = []
doman.append(('stage_id', '=', stage.id))
doman.append(('company_id','in',cids))
doman.append(('|'))
doman.append(('team_admin_id','=',self.env.user.id))
doman.append(('team_admin_id','=',False))
search_tickets = ticket_obj.search(doman)
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")
ticket_dic = {
'ticket_id': ticket.id,
'ticket_no': ticket.name,
'partner_id': ticket.partner_id.name,
'create_date': create_date,
'write_date': write_date,
'user_id': ticket.user_id.name,
}
ticket_list.append(ticket_dic)
id_list.append(ticket.id)
search_stage = request.env['helpdesk.stages'].sudo().search(
[('id', '=', stage.id)], limit=1)
if search_stage:
ticket_data_dic.update({search_stage.name: ticket_list})
ticket_data_list.append(search_stage.name)
return request.env['ir.ui.view'].with_context()._render_template(
'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
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<field name="name">Helpdesk Administrador del equipo</field> <field name="name">Helpdesk Administrador del equipo</field>
<field name="model_id" ref="sh_all_in_one_helpdesk.model_helpdesk_team" /> <field name="model_id" ref="sh_all_in_one_helpdesk.model_helpdesk_team" />
<field name="global" eval="True" /> <field name="global" eval="True" />
<field name="domain_force">['|',('team_admin_id','=',user.id),('team_admin_id','=',False)]</field> <field name="domain_force">['|','|',('team_admin_id','=',user.id),('team_admin_id','=',False)]</field>
<field name="groups" eval="[(4, ref('helpdesk_morsa.ticket_team_admin'))]" /> <field name="groups" eval="[(4, ref('helpdesk_morsa.ticket_team_admin'))]" />
</record> </record>
...@@ -28,9 +28,19 @@ ...@@ -28,9 +28,19 @@
<field name="name">Helpdesk Ticket Team Admin</field> <field name="name">Helpdesk Ticket Team Admin</field>
<field name="model_id" ref="sh_all_in_one_helpdesk.model_helpdesk_ticket" /> <field name="model_id" ref="sh_all_in_one_helpdesk.model_helpdesk_ticket" />
<field name="global" eval="True" /> <field name="global" eval="True" />
<field name="domain_force">['|',('team_admin_id','=',user.id),('team_admin_id','=',False)]</field> <field name="domain_force">['|','|',('team_admin_id','=',user.id),('team_admin_id','=',False),('team_id.team_members','in',[user.id])]</field>
<field name="groups" eval="[(4, ref('helpdesk_morsa.ticket_team_admin'))]" /> <field name="groups" eval="[(4, ref('helpdesk_morsa.ticket_team_admin'))]" />
</record> </record>
<record model="ir.rule" id="helpdesk_ticket_team_captain">
<field name="name">Helpdesk Ticket Captain View</field>
<field name="model_id" ref="sh_all_in_one_helpdesk.model_helpdesk_ticket" />
<field name="global" eval="True" />
<field name="domain_force">[('team_id.team_members','in',[user.id])]</field>
<field name="groups" eval="[(4, ref('sh_all_in_one_helpdesk.helpdesk_group_team_leader'))]" />
</record>
</data> </data>
</odoo> </odoo>
\ No newline at end of file
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
<field name="erp_type" widget="radio" attrs="{'invisible':[('is_erp', '=', False)]}" options="{'horizontal': true}"/> <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="erp_id" attrs="{'invisible':[('is_erp', '=', False)]}"/>
<field name="warehouse_id" attrs="{'invisible':[('is_erp', '=', False)]}"/> <field name="warehouse_id" attrs="{'invisible':[('is_erp', '=', False)]}"/>
<field name="module_route" attrs="{'invisible':[('is_erp', '=', False),('erp_type','in',['mejora','reporte'])]}"/> <field name="module_route" attrs="{'invisible':['|',('is_erp', '=', False),('erp_type','in',['mejora','reporte'])]}"/>
<field name="process_text" attrs="{'invisible':[('is_erp', '=', False),('erp_type','in',['mejora','reporte'])]}"/> <field name="process_text" attrs="{'invisible':['|',('is_erp', '=', False),('erp_type','in',['mejora','reporte'])]}"/>
<field name="required_validation" attrs="{'invisible':[('is_erp', '=', False),('erp_type','in',['mejora','reporte'])]}"/> <field name="required_validation" attrs="{'invisible':['|',('is_erp', '=', False),('erp_type','in',['mejora','reporte'])]}"/>
<field name="common_scenery" attrs="{'invisible':[('is_erp', '=', False),('erp_type','in',['mejora','reporte'])]}"/> <field name="common_scenery" attrs="{'invisible':['|',('is_erp', '=', False),('erp_type','in',['mejora','reporte'])]}"/>
<field name="module_impact" attrs="{'invisible':[('is_erp', '=', False),('erp_type','in',['mejora','reporte'])]}"/> <field name="module_impact" attrs="{'invisible':['|', ('is_erp', '=', False),('erp_type','in',['mejora','reporte'])]}"/>
<field name="incidence_type" attrs="{'invisible':[('is_emergency', '=', False)]}"/> <field name="incidence_type" attrs="{'invisible':[('is_emergency', '=', False)]}"/>
</xpath> </xpath>
<xpath expr="//header" position="replace"> <xpath expr="//header" position="replace">
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<data> <data>
<record model="ir.ui.view" id="res_users_inherit_morsa"> <record model="ir.ui.view" id="res_users_inherit_morsa">
<field name="name">res.users.form.inherit</field> <field name="name">res.users.form.inherit</field>
<field name="model">res.users</field> <field name="model">res.users</field>
<field name="inherit_id" ref="sh_all_in_one_helpdesk.sh_res_users_form_view"/> <field name="inherit_id" ref="sh_all_in_one_helpdesk.sh_res_users_form_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='sh_portal_user_access']" position="after"> <xpath expr="//field[@name='sh_portal_user_access']" position="after">
<field name="warehouse_id" required="1"/> <field name="warehouse_id"/>
<field name="warehouse_ids" widget="many2many_tags" required="1"/> <field name="comp_morsa" required="1"/>
<field name="is_erp_user"/>
<field name="is_911_user"/>
</xpath> </xpath>
</field> </field>
</record> </record>
<record model="ir.ui.view" id="res_users_inherit_partner">
<field name="name">res.users.form.inherit.partner</field>
<field name="model">res.users</field>
<field name="priority" eval="20"/>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="replace">
<field name="partner_id" required="0" readonly="1"/>
</xpath>
</field>
</record>
</data> </data>
</odoo> </odoo>
\ No newline at end of file
...@@ -26,14 +26,17 @@ ...@@ -26,14 +26,17 @@
<a t-if="asistencia" t-attf-href="/my/erp?{{ keep_query() }}">Asistencia ERP</a> <a t-if="asistencia" t-attf-href="/my/erp?{{ keep_query() }}">Asistencia ERP</a>
<t t-else="">Asistencia ERP</t> <t t-else="">Asistencia ERP</t>
</li> </li>
<li t-if="asistencia" class="breadcrumb-item active"> <li t-if="asistencia" class="breadcrumb-item active">
<t t-esc="asistencia.name" t-if="asistencia.name" /> <t t-esc="asistencia.name" t-if="asistencia.name" />
<t t-else=""><em>Asistencia ERP</em></t> <t t-else=""><em>Asistencia ERP</em></t>
</li> </li>
<li t-if="page_name == 'ti' or ti" t-attf-class="breadcrumb-item #{'active ' if not ti else ''}"> <li t-if="page_name == 'ti' or ti" t-attf-class="breadcrumb-item #{'active ' if not ti else ''}">
<a t-if="ti" t-attf-href="/my/911?{{ keep_query() }}">TI 911</a> <a t-if="ti" t-attf-href="/my/911?{{ keep_query() }}">TI 911</a>
<t t-else="">TI 911</t> <t t-else="">TI 911</t>
</li> </li>
<li t-if="ti" class="breadcrumb-item active"> <li t-if="ti" class="breadcrumb-item active">
<t t-esc="ti.name" t-if="ti.name" /> <t t-esc="ti.name" t-if="ti.name" />
<t t-else=""><em>TI 911</em></t> <t t-else=""><em>TI 911</em></t>
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
<t t-set="avatar" t-value="'/helpdesk_morsa/static/src/img/support.svg'"/> <t t-set="avatar" t-value="'/helpdesk_morsa/static/src/img/support.svg'"/>
<t t-set="background" t-value="'/helpdesk_morsa/static/src/img/support_back.svg'"/> <t t-set="background" t-value="'/helpdesk_morsa/static/src/img/support_back.svg'"/>
</t> </t>
<t t-call="portal.portal_docs_entry"> <t t-if="request.env.user.is_erp_user">
<t t-call="portal.portal_docs_entry" >
<t t-set="title">Mejora o Asistencia ERP</t> <t t-set="title">Mejora o Asistencia ERP</t>
<t t-set="url" t-value="'/my/erp'" /> <t t-set="url" t-value="'/my/erp'" />
<t t-set="count" t-value="erp_count" /> <t t-set="count" t-value="erp_count" />
...@@ -23,6 +24,8 @@ ...@@ -23,6 +24,8 @@
<t t-set="avatar" t-value="'/helpdesk_morsa/static/src/img/erp.svg'"/> <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="background" t-value="'/helpdesk_morsa/static/src/img/erp_back.svg'"/>
</t> </t>
</t>
<t t-if="request.env.user.is_911_user">
<t t-call="portal.portal_docs_entry"> <t t-call="portal.portal_docs_entry">
<t t-set="title">TI 911</t> <t t-set="title">TI 911</t>
<t t-set="url" t-value="'/my/911'" /> <t t-set="url" t-value="'/my/911'" />
...@@ -31,7 +34,7 @@ ...@@ -31,7 +34,7 @@
<t t-set="avatar" t-value="'/helpdesk_morsa/static/src/img/emergency.svg'"/> <t t-set="avatar" t-value="'/helpdesk_morsa/static/src/img/emergency.svg'"/>
<t t-set="background" t-value="'/helpdesk_morsa/static/src/img/emergency_back.svg'"/> <t t-set="background" t-value="'/helpdesk_morsa/static/src/img/emergency_back.svg'"/>
</t> </t>
</t>
</div> </div>
</div> </div>
<div class="oe_structure" id="oe_structure_portal_my_ti_2"/> <div class="oe_structure" id="oe_structure_portal_my_ti_2"/>
......
...@@ -37,15 +37,13 @@ ...@@ -37,15 +37,13 @@
<field name="name">Helpdesk Ticket Team Leader</field> <field name="name">Helpdesk Ticket Team Leader</field>
<field name="model_id" ref="model_helpdesk_ticket" /> <field name="model_id" ref="model_helpdesk_ticket" />
<field name="global" eval="True" /> <field name="global" eval="True" />
<field name="domain_force">['|','|','|','&amp;',('team_head','=',user.id),('team_head','=',False),('user_id','=',user.id),('sh_user_ids','in',[user.id]),('team_id.team_head','=',user.id)]</field> <field name="domain_force">['|','|','|','&amp;',('team_head','=',user.id),('team_head','=',False),('user_id','=',user.id),('team_id.team_members','in',[user.id]),('team_id.team_head','=',user.id)]</field>
<!-- <field name="domain_force">['|','|','|','|','|',('team_head','=',user.id),('team_head','=',False),('user_id','=',user.id),('user_id','=',False),('sh_user_ids','in',[user.id]),('sh_user_ids','=',False)]</field> -->
<field name="groups" eval="[(4, ref('sh_all_in_one_helpdesk.helpdesk_group_team_leader'))]" /> <field name="groups" eval="[(4, ref('sh_all_in_one_helpdesk.helpdesk_group_team_leader'))]" />
</record> </record>
<record model="ir.rule" id="helpdesk_ticket_assigned_user_rule"> <record model="ir.rule" id="helpdesk_ticket_assigned_user_rule">
<field name="name">Helpdesk Ticket Assigned User</field> <field name="name">Helpdesk Ticket Assigned User</field>
<field name="model_id" ref="model_helpdesk_ticket" /> <field name="model_id" ref="model_helpdesk_ticket" />
<field name="global" eval="True" /> <field name="global" eval="True" />
<!-- <field name="domain_force">['|','|',('user_id','=',user.id),('user_id','=',False),('sh_user_ids','in',[user.id])]</field> -->
<field name="domain_force">['&amp;',('team_id.team_members','in',[user.id]),'|',('sh_user_ids','in',[user.id]),('user_id','=',user.id)]</field> <field name="domain_force">['&amp;',('team_id.team_members','in',[user.id]),'|',('sh_user_ids','in',[user.id]),('user_id','=',user.id)]</field>
<field name="groups" eval="[(4, ref('sh_all_in_one_helpdesk.helpdesk_group_user'))]" /> <field name="groups" eval="[(4, ref('sh_all_in_one_helpdesk.helpdesk_group_user'))]" />
</record> </record>
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<div id="js_ticket_count_div"> <div id="js_ticket_count_div">
<div> <div>
<div class="row"> <div class="row">
<t t-if="data_dict"> <t t-if="data_dict">
<t t-foreach="data_dict.keys()" t-as="value"> <t t-foreach="data_dict.keys()" t-as="value">
<t t-set="list_ids" t-value="data_dict[value][0][0]" /> <t t-set="list_ids" t-value="data_dict[value][0][0]" />
...@@ -75,6 +76,7 @@ ...@@ -75,6 +76,7 @@
<div id="js_ticket_tbl_div"> <div id="js_ticket_tbl_div">
<div> <div>
<div class="row" style="margin: 0;"> <div class="row" style="margin: 0;">
<t t-if="ticket_data_dic"> <t t-if="ticket_data_dic">
<div class="modal fade whatsapp_modal" tabindex="-1" role="dialog" aria-labelledby="whatsappModalLabel" aria-hidden="true"> <div class="modal fade whatsapp_modal" tabindex="-1" role="dialog" aria-labelledby="whatsappModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
...@@ -131,6 +133,7 @@ ...@@ -131,6 +133,7 @@
</div> </div>
</div> </div>
</div> </div>
<t t-foreach="ticket_data_dic.keys()" t-as="ticket"> <t t-foreach="ticket_data_dic.keys()" t-as="ticket">
<div class="col-md-12" style="margin-bottom: 20px; box-shadow: 0 0 2px rgba(0, 0, 0, 0.5); padding-left: 0 !important; padding-right: 0 !important;"> <div class="col-md-12" style="margin-bottom: 20px; box-shadow: 0 0 2px rgba(0, 0, 0, 0.5); padding-left: 0 !important; padding-right: 0 !important;">
<h3 style="padding: 10px; margin-top: 7px; margin-bottom: 7px;"> <h3 style="padding: 10px; margin-top: 7px; margin-bottom: 7px;">
......
...@@ -21,3 +21,4 @@ ...@@ -21,3 +21,4 @@
############################################################################# #############################################################################
from .hooks import test_pre_init_hook, test_post_init_hook from .hooks import test_pre_init_hook, test_post_init_hook
from . import wizard from . import wizard
from . import models
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
'views/theme.xml', 'views/theme.xml',
'views/assets.xml', 'views/assets.xml',
'data/theme_data.xml', 'data/theme_data.xml',
'views/res_users.xml',
], ],
'assets': { 'assets': {
'web.assets_backend': { 'web.assets_backend': {
......
from . import res_user
\ No newline at end of file
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class ResUsersVista(models.Model):
_inherit = 'res.users'
only_all_app = fields.Boolean('Ver apps')
\ No newline at end of file
...@@ -55,18 +55,24 @@ ...@@ -55,18 +55,24 @@
</div> </div>
<h6 class="sidebar_head">MENU</h6> <h6 class="sidebar_head">MENU</h6>
<ul class="sidebar_menu"> <ul class="sidebar_menu">
<t t-foreach="menuService.getApps()" t-as="app"> <t t-foreach="menuService.getApps()" t-as="app">
<li data-toggle="tooltip" data-placement="right" t-att-title="app.name"> <li data-toggle="tooltip" data-placement="right" t-att-title="app.name">
<a role="menuitem" <a role="menuitem"
t-attf-href="#menu_id={{app.id}}" t-attf-href="#menu_id={{app.id}}"
class="nav-link"> class="nav-link"
>
<img class="sidebar_img" <img class="sidebar_img"
t-attf-src="data:image/png;base64,{{app.webIconData}}"/> t-attf-src="data:image/png;base64,{{app.webIconData}}"/>
<span class="sidebar_app_name"> <span class="sidebar_app_name">
<t t-esc="app.name"/> <t t-esc="app.name"/>
</span> </span>
</a> </a>
</li> </li>
</t> </t>
</ul> </ul>
</div> </div>
......
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record model="ir.ui.view" id="res_users_inherit_only_app">
<field name="name">res.users.form.inherit.partner</field>
<field name="model">res.users</field>
<field name="priority" eval="20"/>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="after">
<field name="only_all_app"/>
</xpath>
</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