Commit 17db1b50 by Arturo Jasso Origel

cambios y adecuaciones para la implemantación condiferentes modulos como de…

cambios y adecuaciones para la implemantación condiferentes modulos como de mantenimiento y futuro rh
parent 1804d8fb
from . import controllers
from . import models
\ No newline at end of file
# -*- coding: utf-8 -*-
{
"name":"Mantenimiento Morsa",
"author":"Arturo Jasso",
"website":"",
"support":"arturo.jasso@morsa.com.mx",
"category":"Discuss",
"license":"OPL-1",
"summary":"Actualizaciones y adecuaciones para el área de mantenimineto",
"description":"""Actualización para requerimientos de morsa """,
"version":"15.0.34",
"depends": [
"base",
"portal_design_helpdesk",
"sh_all_in_one_helpdesk",
"vista_backend_theme",
"hide_odoo",
"helpdesk_morsa",
],
"data": [
'data/helpdesk_team.xml',
'data/maintenance_type.xml',
'views/portal_my.xml',
'views/portal_maintenance.xml',
],
'assets': {
'web.assets_frontend': [
'/helpdesk_maintenance/static/src/scss/portal.scss',
'/helpdesk_maintenance/static/src/js/portal.js',
],
},
"application":False,
"auto_install":False,
"installable":True,
}
from . import portal
\ No newline at end of file
# -*- coding: utf-8 -*-
from odoo import fields, http, _
from odoo.http import request
from odoo.addons.portal.controllers.portal import CustomerPortal, pager as portal_pager
from odoo.tools import date_utils, groupby as groupbyelem
from odoo.osv.expression import AND
from dateutil.relativedelta import relativedelta
from operator import itemgetter
from collections import OrderedDict
from odoo.exceptions import AccessError, MissingError, UserError
from odoo.addons.portal.controllers.mail import _message_post_helper
from datetime import datetime, date, timedelta
import json
import base64
import werkzeug
import logging
_logger = logging.getLogger(__name__)
from odoo.addons.sh_all_in_one_helpdesk.controllers.portal import PortalHelpdesk
FORMAT = '%d/%m/%Y'
class PortalCustomerMaintenence(CustomerPortal):
def _prepare_home_portal_values(self):
return {}
def prepare_maintenance(self):
domain = [('team_id.id','=',request.env.ref('helpdesk_maintenance.maintenance').id)]
return domain
def _prepare_portal_layout_values(self):
values = super(PortalHelpdesk, self)._prepare_portal_layout_values()
stage_close = request.env.ref('sh_all_in_one_helpdesk.close_stage').id
stage_done = request.env.ref('sh_all_in_one_helpdesk.done_stage').id
stage_cancel = request.env.ref('sh_all_in_one_helpdesk.cancel_stage').id
ticket_domain = [('stage_id.id','not in',[stage_close,stage_done,stage_cancel])]
if request.env.user.sh_portal_user_access and request.env.user.sh_portal_user_access == 'user':
ticket_domain.append(('|'))
ticket_domain.append(('|'))
ticket_domain.append(('user_id', '=', request.env.user.id))
ticket_domain.append(('sh_user_ids', 'in', [request.env.user.id]))
ticket_domain.append(
('partner_id', '=', request.env.user.partner_id.id))
elif request.env.user.sh_portal_user_access and request.env.user.sh_portal_user_access == 'leader':
ticket_domain.append(('|'))
ticket_domain.append(('|'))
ticket_domain.append(('|'))
ticket_domain.append(('sh_user_ids', 'in', [request.env.user.id]))
ticket_domain.append(('user_id', '=', request.env.user.id))
ticket_domain.append(
('partner_id', '=', request.env.user.partner_id.id))
ticket_domain.append(('team_head', '=', request.env.user.id))
elif request.env.user.sh_portal_user_access and request.env.user.sh_portal_user_access == 'manager':
ticket_domain.append(('|'))
ticket_domain.append(('|'))
ticket_domain.append(('|'))
ticket_domain.append(('|'))
ticket_domain.append(('|'))
ticket_domain.append(('|'))
ticket_domain.append(('user_id', '=', request.env.user.id))
ticket_domain.append(('user_id', '=', False))
ticket_domain.append(('sh_user_ids', 'in', [request.env.user.id]))
ticket_domain.append(('sh_user_ids', '=', False))
ticket_domain.append(
('partner_id', '=', request.env.user.partner_id.id))
ticket_domain.append(('team_head', '=', request.env.user.id))
ticket_domain.append(('team_head', '=', False))
else:
ticket_domain.append(('|'))
ticket_domain.append(('|'))
ticket_domain.append(('sh_user_ids', 'in', [request.env.user.id]))
ticket_domain.append(('user_id', '=', request.env.user.id))
ticket_domain.append(('partner_id', '=', request.env.user.partner_id.id))
new_domain_sup = AND([self.prepare_maintenance(), ticket_domain])
maintenance_count = len(request.env['helpdesk.ticket'].sudo().search(new_domain_sup))
tickets = request.env['helpdesk.ticket'].sudo().search(ticket_domain)
values['tickets'] = tickets
values['maintenance_count'] = maintenance_count
return values
@http.route('/my/mantenimiento',type='http',auth="user",website=True)
def prepare_portal_maintenance(self,**kw):
values = self._prepare_home_portal_values()
return request.render("helpdesk_maintenance.portal_my_maintenance",{})
@http.route(['/my/mantenimientos', '/my/mantenimientos/page/<int:page>'],type='http',auth="user",website=True)
def portal_my_maintenance(self,ctr='show',page=1,sortby=None,filterby=None,search=None,search_in='all',groupby='create_by',**kw):
values = self._prepare_portal_layout_values()
HelpdeskTicket = request.env['helpdesk.ticket'].sudo()
searchbar_sortings = {
'create_date': {
'label': _('Newest'),
'order': 'create_date desc'
},
'name': {
'label': _('Name'),
'order': 'name'
},
}
searchbar_inputs = {
'all': {
'input': 'all',
'label': _('Search in All')
},
}
searchbar_groupby = {
'create_by': {
'input': 'create_by',
'label': _('Created By')
},
'ticket_type': {
'input': 'ticket_type',
'label': _('Ticket Type')
},
'status': {
'input': 'status',
'label': _('Status')
},
'customer': {
'input': 'customer',
'label': _('Customer')
},
'category': {
'input': 'category',
'label': _('Category')
},
'subcategory': {
'input': 'subcategory',
'label': _('Sub Category')
},
'subject': {
'input': 'subject',
'label': _('Subject')
},
'priority': {
'input': 'priority',
'label': _('Priority')
},
'state': {
'input': 'state',
'label': _('Reply Status')
},
}
today = fields.Date.today()
quarter_start, quarter_end = date_utils.get_quarter(today)
last_week = today + relativedelta(weeks=-1)
last_month = today + relativedelta(months=-1)
last_year = today + relativedelta(years=-1)
searchbar_filters = {
'all': {
'label': _('All'),
'domain': []
},
'today': {
'label': _('Today'),
'domain': [("create_date", "=", today)]
},
'week': {
'label':
_('This week'),
'domain':
[('create_date', '>=', date_utils.start_of(today, "week")),
('create_date', '<=', date_utils.end_of(today, 'week'))]
},
'month': {
'label':
_('This month'),
'domain':
[('create_date', '>=', date_utils.start_of(today, 'month')),
('create_date', '<=', date_utils.end_of(today, 'month'))]
},
'year': {
'label':
_('This year'),
'domain':
[('create_date', '>=', date_utils.start_of(today, 'year')),
('create_date', '<=', date_utils.end_of(today, 'year'))]
},
'quarter': {
'label':
_('This Quarter'),
'domain': [('create_date', '>=', quarter_start),
('create_date', '<=', quarter_end)]
},
'last_week': {
'label':
_('Last week'),
'domain':
[('create_date', '>=', date_utils.start_of(last_week, "week")),
('create_date', '<=', date_utils.end_of(last_week, 'week'))]
},
'last_month': {
'label':
_('Last month'),
'domain':
[('create_date', '>=',
date_utils.start_of(last_month, 'month')),
('create_date', '<=', date_utils.end_of(last_month, 'month'))]
},
'last_year': {
'label':
_('Last year'),
'domain':
[('create_date', '>=', date_utils.start_of(last_year, 'year')),
('create_date', '<=', date_utils.end_of(last_year, 'year'))]
},
}
# default sort by value
if not sortby:
sortby = 'create_date'
order = searchbar_sortings[sortby]['order']
# default filter by value
if not filterby:
filterby = 'all'
domain = AND([searchbar_filters[filterby]['domain']])
if search and search_in:
domain = AND([domain, [('name', 'ilike', search)]])
ticket_domain = self.prepare_maintenance()
if request.env.user.sh_portal_user_access and request.env.user.sh_portal_user_access == 'user':
ticket_domain.append(('|'))
ticket_domain.append(('|'))
ticket_domain.append(('user_id', '=', request.env.user.id))
ticket_domain.append(('sh_user_ids', 'in', [request.env.user.id]))
ticket_domain.append(
('partner_id', '=', request.env.user.partner_id.id))
elif request.env.user.sh_portal_user_access and request.env.user.sh_portal_user_access == 'leader':
ticket_domain.append(('|'))
ticket_domain.append(('|'))
ticket_domain.append(('|'))
ticket_domain.append(('sh_user_ids', 'in', [request.env.user.id]))
ticket_domain.append(('user_id', '=', request.env.user.id))
ticket_domain.append(
('partner_id', '=', request.env.user.partner_id.id))
ticket_domain.append(('team_head', '=', request.env.user.id))
elif request.env.user.sh_portal_user_access and request.env.user.sh_portal_user_access == 'manager':
ticket_domain.append(('|'))
ticket_domain.append(('|'))
ticket_domain.append(('|'))
ticket_domain.append(('|'))
ticket_domain.append(('|'))
ticket_domain.append(('|'))
ticket_domain.append(('sh_user_ids', 'in', [request.env.user.id]))
ticket_domain.append(('sh_user_ids', '=', False))
ticket_domain.append(('user_id', '=', request.env.user.id))
ticket_domain.append(('user_id', '=', False))
ticket_domain.append(
('partner_id', '=', request.env.user.partner_id.id))
ticket_domain.append(('team_head', '=', request.env.user.id))
ticket_domain.append(('team_head', '=', False))
else:
ticket_domain.append(('|'))
ticket_domain.append(('|'))
ticket_domain.append(('user_id', '=', request.env.user.id))
ticket_domain.append(('sh_user_ids', 'in', [request.env.user.id]))
ticket_domain.append(
('partner_id', '=', request.env.user.partner_id.id))
stage_close = request.env.ref('sh_all_in_one_helpdesk.close_stage').id
stage_done = request.env.ref('sh_all_in_one_helpdesk.done_stage').id
stage_cancel = request.env.ref('sh_all_in_one_helpdesk.cancel_stage').id
ticket_domain.append(('stage_id.id','not in',[stage_close,stage_done,stage_cancel]))
domain = AND([domain, ticket_domain])
maintenance_count = len(HelpdeskTicket.search(domain).filtered(lambda h: h.team_id.id == request.env.ref('helpdesk_morsa.techinnical_support').id))
# pager
pager = portal_pager(url="/my/soporte",url_args={'sortby': sortby,'search_in': search_in,'search': search,'filterby': filterby},total=maintenance_count,page=page,step=self._items_per_page)
if groupby == 'create_by':
order = "create_uid, %s" % order
elif groupby == 'ticket_type':
order = "ticket_type, %s" % order
elif groupby == 'status':
order = "stage_id, %s" % order
elif groupby == 'customer':
order = "partner_id, %s" % order
elif groupby == 'category':
order = "category_id, %s" % order
elif groupby == 'subcategory':
order = "sub_category_id, %s" % order
elif groupby == 'subject':
order = "subject_id, %s" % order
elif groupby == 'priority':
order = "priority, %s" % order
elif groupby == 'state':
order = 'state,%s' % order
tickets = HelpdeskTicket.search(domain,order=order,limit=self._items_per_page,offset=pager['offset'])
request.session['my_tickets_history'] = tickets.ids[:100]
if groupby == 'create_by':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('create_uid'))
]
elif groupby == 'ticket_type':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('ticket_type'))
]
elif groupby == 'status':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('stage_id'))
]
elif groupby == 'customer':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('partner_id'))
]
elif groupby == 'category':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('category_id'))
]
elif groupby == 'subcategory':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('sub_category_id'))
]
elif groupby == 'subject':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('subject_id'))
]
elif groupby == 'priority':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('priority'))
]
elif groupby == 'state':
grouped_tickets = [
HelpdeskTicket.concat(*g)
for k, g in groupbyelem(tickets, itemgetter('state'))
]
# content according to pager and archive selected
values.update({
'created': ctr,
'tickets':tickets,
'grouped_tickets':grouped_tickets,
'page_name':'maintenance',
'default_url':'/my/mantenimientos',
'maintenance_count':maintenance_count,
'pager':pager,
'searchbar_sortings':searchbar_sortings,
'search_in':search_in,
'sortby':sortby,
'groupby':groupby,
'searchbar_inputs':searchbar_inputs,
'searchbar_groupby':searchbar_groupby,
'searchbar_filters':OrderedDict(sorted(searchbar_filters.items())),
'filterby':filterby,
})
return request.render("helpdesk_maintenance.portal_my_maitenance",values)
@http.route('/portal-create-ticket-maintenance', type='http', auth='public', csrf=False)
def portal_create_ticket_support(self, **kw):
try:
login_user = request.env.user
if login_user and login_user.login != 'public':
partner_id = False
if kw.get('partner_id') and kw.get('partner_id') != '':
partner_id = request.env['res.partner'].sudo().search(
[('id', '=', int(kw.get('partner_id')))], limit=1)
else:
partner_id = request.env['res.partner'].sudo().search(
[('email', '=', kw.get('portal_email'))], limit=1)
if not partner_id:
return json.dumps({"resp":"Error","message":"Colaborador no encontrado, favor de verificar que haya agregado uno"})
if partner_id:
unvalued_tickets = len(
request.env['helpdesk.ticket'].sudo().search([
('stage_id','=',request.env.ref('sh_all_in_one_helpdesk.done_stage').id),
('priority_new','=',False)])
)
if unvalued_tickets >= 3:
return json.dumps({"resp":"Error","message":"Tienes demasiados tickets sin evaluar, favor de evaluarlos"})
ticket_dic = {
'partner_id': partner_id.id,
'ticket_from_portal': True
}
if kw.get('portal_phone'):
partner_id.update({'phone': kw.get('portal_phone')})
ticket_dic.update({
'mobile_no':kw.get('portal_phone')
})
if kw.get('portal_contact_name'):
ticket_dic.update({
'person_name':
kw.get('portal_contact_name'),
})
if kw.get('portal_email'):
ticket_dic.update({
'email': kw.get('portal_email'),
})
team_id = request.env['helpdesk.team'].sudo().browse(request.env.ref('helpdesk_maintenance.maintenance').id)
if team_id:
ticket_dic.update({
'team_id': team_id.id,
'team_head': team_id.team_head.id,
})
if kw.get('portal_description'):
ticket_dic.update({
'description':
kw.get('portal_description'),
})
if kw.get('portal_main_type'):
ticket_dic.update({
'maintenance_type_id': kw.get('portal_main_type')
})
if kw.get('portal_severity'):
ticket_dic.update({
'severity_type': kw.get('portal_severity'),
})
if kw.get('portal_date_fail'):
ticket_dic.update({
'date_fail': datetime.strptime(kw.get('portal_date_fail'),FORMAT).date(),
})
if kw.get('portal_fail_type'):
ticket_dic.update({
'fail_type': kw.get('portal_fail_type'),
})
ticket_id = request.env['helpdesk.ticket'].sudo().create(ticket_dic)
if 'portal_file' in request.params:
attached_files = request.httprequest.files.getlist('portal_file')
attachment_ids = []
for attachment in attached_files:
result = base64.b64encode(attachment.read())
attachment_id = request.env['ir.attachment'].sudo(
).create({
'name': attachment.filename,
'res_model': 'helpdesk.ticket',
'res_id': ticket_id.id,
'display_name': attachment.filename,
'datas': result,
})
attachment_ids.append(attachment_id.id)
ticket_id.attachment_ids = [(6, 0, attachment_ids)]
return request.redirect("/my/soporte?ctr=False")
except Exception as e:
_logger.exception('Something went wrong %s',str(e))
@http.route(['/my/soporte/<int:ticket_id>'],type='http',auth="public",website=True)
def portal_my_ticket_detail_soporte(self,ticket_id,access_token=None,report_type=None,message=False,download=False,**kw):
try:
ticket_sudo = self._document_check_access('helpdesk.ticket', ticket_id, access_token=access_token)
except (AccessError, MissingError):
return request.redirect('/my')
if report_type in ('html', 'pdf', 'text'):
return self._show_report(model=ticket_sudo,report_type=report_type,report_ref='sh_all_in_one_helpdesk.action_portal_report_helpdesk_ticket',download=download)
if ticket_sudo:
if request.env.company.sh_receive_email_seeing_ticket:
body = _('Ticket visto por el cliente %s',ticket_sudo.partner_id.name)
_message_post_helper(
"helpdesk.ticket",
ticket_sudo.id,
body,
token=ticket_sudo.access_token,
message_type="notification",
subtype_xmlid="mail.mt_note",
partner_ids=ticket_sudo.user_id.sudo().partner_id.ids,
)
values = {
'token': access_token,
'soporte': ticket_sudo,
'message': message,
'bootstrap_formatting': True,
'partner_id': ticket_sudo.partner_id.id,
'report_type': 'html',
}
return request.render("helpdesk_morsa.portal_ticket_page_support",values)
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="maintenance" model="helpdesk.team">
<field name="name">Mantenimiento</field>
<field name="short_name">MAN</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
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="air_conditioning" model="maintenance.type">
<field name="name">Aire acondicionado</field>
</record>
<record id="brickwork" model="maintenance.type">
<field name="name">Aire acondicionado</field>
</record>
<record id="electricity" model="maintenance.type">
<field name="name">Electricidad (contactos, generadores, transformadores, tableros)</field>
</record>
<record id="plumbing_outside" model="maintenance.type">
<field name="name">Fontaneria (cisternas, tinacos, aljibes, fosas)</field>
</record>
<record id="smithy" model="maintenance.type">
<field name="name">Herreria</field>
</record>
<record id="lightning" model="maintenance.type">
<field name="name">Iluminación (lamparas de oficinas, almacen, racks, exteriores)</field>
</record>
<record id="plumbing_inside" model="maintenance.type">
<field name="name">Plomeria (baños y comedor)</field>
</record>
<record id="emergency" model="maintenance.type">
<field name="name">Urgencia (comprometa la seguridad física o patrimonial</field>
</record>
</data>
</odoo>
\ No newline at end of file
from . import helpdesk_ticket
from . import maintenance_type
\ No newline at end of file
from odoo import models, fields, api, _, SUPERUSER_ID
import random
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
_logger = logging.getLogger(__name__)
class HelpdeskTicket(models.Model):
_inherit = 'helpdesk.ticket'
maintenance_type_id = fields.Many2one('maintenance.type',string="Tipo mantenimiento")
date_fail = fields.Date('Fecha de falla')
severity_type = fields.Selection([
('1','Leve'),
('2','Medio'),
('3','Grave'),
])
fail_type = fields.Selection([
('fail','Falla'),('warranty','Garantía')
],string="Tipo de falla")
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)
\ No newline at end of file
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class MaintenanceType(models.Model):
_name = 'maintenance.type'
_rec_name = 'name'
name = fields.Char('Nombre')
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="520px"
height="520px" viewBox="0 0 520 520" style="enable-background:new 0 0 520 520;" xml:space="preserve">
<g id="_x36_49_x2C__Maintenance_x2C__Support_x2C__Technical_x2C__Fix">
<g>
<circle style="fill:#BCE4FF;" cx="452.5" cy="75.29" r="30"/>
<path style="fill:#BCE4FF;" d="M62.5,375.29c13.81,0,25,11.19,25,25s-11.19,25-25,25s-25-11.19-25-25S48.69,375.29,62.5,375.29z"
/>
<path style="fill:#33383F;" d="M317.23,100.75c0,19.3-9.121,36.46-23.28,47.43c-3.601,2.8-7.53,5.19-11.72,7.11v39.09v29.36v2.74
V338.1c-8.041,3.86-17.03,6.03-26.5,6.03c-8.31,0-16.24-1.67-23.5-4.66V225.1v-31.59v-38.22c-4.13-1.9-8.01-4.25-11.57-7
c-14.25-10.95-23.43-28.17-23.43-47.54c0-26.12,16.7-48.34,40-56.57v56.57h40V44.18C300.529,52.41,317.23,74.63,317.23,100.75z"/>
<path style="fill:#5CBEFF;" d="M347.5,282.39c0,50.42-41.311,91.74-91.74,91.74c-50.63,0-91.94-41.32-91.94-91.74
c0-42.5,29.12-78.43,68.41-88.879v31.59c-22.5,9.29-38.41,31.48-38.41,57.26c0,25.67,15.91,47.83,38.41,57.109
c7.26,2.99,15.19,4.66,23.5,4.66c9.47,0,18.459-2.17,26.5-6.03c22.5-9.279,38.41-31.439,38.41-57.109
c0-25.78-15.91-47.97-38.41-57.25v-29.36C319.87,205.82,347.5,240.99,347.5,282.39z"/>
<path style="fill:#3256C1;" d="M255.76,374.13c50.43,0,91.74-41.32,91.74-91.74c0-41.399-27.63-76.57-65.27-88.01v-39.09
c4.189-1.92,8.119-4.31,11.72-7.11c13.89,3.76,26.88,9.51,38.729,17.08l47.61-30.22l25.989,26l-30.139,47.6
c8.529,13.48,14.869,28.43,18.439,44.51l54.92,12.27v36.8l-54.92,12.271c-3.57,16.08-9.91,31.03-18.439,44.51l30.139,47.61
L380.29,432.6l-47.61-30.14c-13.4,8.53-28.43,14.87-44.51,18.44l-12.27,54.92h-36.8l-12.27-54.92
c-16.08-3.57-31.03-9.91-44.51-18.44l-47.61,30.14l-25.99-25.989L138.86,359c-8.53-13.4-14.87-28.43-18.44-44.51L65.5,302.22
v-36.8l54.92-12.27c3.57-16.081,9.91-31.03,18.44-44.51l-30.14-47.6l25.99-26l47.61,30.22c11.74-7.5,24.59-13.21,38.34-16.97
c3.56,2.75,7.44,5.1,11.57,7v38.22c-39.29,10.45-68.41,46.38-68.41,88.879C163.82,332.81,205.13,374.13,255.76,374.13z"/>
<path d="M457.061,365.58c3.979,1.13,6.289,5.29,5.149,9.27c-1.14,3.98-5.29,6.29-9.271,5.15c-3.979-1.14-6.289-5.29-5.149-9.27
C448.92,366.75,453.08,364.44,457.061,365.58z"/>
<path d="M442.061,165.58c3.979,1.14,6.289,5.29,5.149,9.27c-1.13,3.98-5.29,6.29-9.271,5.15c-3.979-1.13-6.289-5.29-5.149-9.27
S438.08,164.44,442.061,165.58z"/>
<path d="M372.061,55.58c3.979,1.14,6.289,5.29,5.149,9.27c-1.13,3.98-5.29,6.29-9.271,5.15c-3.979-1.13-6.289-5.29-5.149-9.27
S368.08,54.44,372.061,55.58z"/>
<path d="M337.061,440.58c3.979,1.14,6.289,5.29,5.149,9.27c-1.14,3.98-5.29,6.29-9.271,5.15c-3.979-1.13-6.289-5.29-5.149-9.27
C328.92,441.75,333.08,439.44,337.061,440.58z"/>
<path d="M162.06,445.58c3.98,1.13,6.29,5.29,5.15,9.27c-1.14,3.98-5.29,6.29-9.27,5.15s-6.29-5.29-5.15-9.27
C153.92,446.75,158.08,444.44,162.06,445.58z"/>
<path d="M152.06,40.58c3.98,1.14,6.29,5.29,5.15,9.27c-1.13,3.98-5.29,6.29-9.27,5.15c-3.98-1.13-6.29-5.29-5.15-9.27
S148.08,39.44,152.06,40.58z"/>
<circle cx="65.29" cy="213.23" r="7.498"/>
<path d="M57.06,80.58c3.98,1.14,6.29,5.29,5.15,9.27c-1.13,3.98-5.29,6.29-9.27,5.15c-3.98-1.13-6.29-5.29-5.15-9.27
S53.08,79.44,57.06,80.58z"/>
<path d="M255.76,379.13c-53.453,0-96.94-43.397-96.94-96.74c0-43.881,29.659-82.417,72.125-93.711
c2.669-0.708,5.408,0.878,6.117,3.547c0.71,2.668-0.878,5.407-3.547,6.117c-38.092,10.131-64.695,44.693-64.695,84.047
c0,47.829,39.001,86.74,86.94,86.74c47.828,0,86.74-38.911,86.74-86.74c0-37.957-25.382-72.18-61.725-83.226
c-2.642-0.803-4.133-3.596-3.329-6.238c0.803-2.642,3.597-4.132,6.237-3.33c19.44,5.908,36.945,18.176,49.289,34.543
c12.775,16.939,19.527,37.083,19.527,58.25C352.5,335.732,309.103,379.13,255.76,379.13z"/>
<path d="M232.228,344.471c-0.635,0-1.281-0.121-1.904-0.379c-25.213-10.397-41.504-34.629-41.504-61.731
c0-27.183,16.291-51.472,41.502-61.882c2.553-1.053,5.476,0.162,6.53,2.713c1.054,2.552-0.161,5.476-2.713,6.53
c-21.455,8.858-35.318,29.521-35.318,52.639c0,23.037,13.863,43.639,35.316,52.487c2.553,1.053,3.769,3.976,2.716,6.528
C236.057,343.305,234.193,344.471,232.228,344.471z"/>
<path d="M282.232,343.101c-1.965,0-3.829-1.165-4.625-3.095c-1.053-2.553,0.164-5.476,2.717-6.528
c21.453-8.848,35.316-29.45,35.316-52.487c0-23.122-13.863-43.779-35.316-52.628c-2.553-1.053-3.77-3.976-2.717-6.528
c1.053-2.553,3.976-3.769,6.529-2.716c25.213,10.398,41.504,34.685,41.504,61.872c0,27.103-16.291,51.334-41.504,61.731
C283.513,342.979,282.867,343.101,282.232,343.101z"/>
<path d="M275.9,480.82h-36.8c-2.341,0-4.369-1.625-4.88-3.91l-11.585-51.856c-14.129-3.469-27.652-9.074-40.283-16.696
l-44.968,28.467c-1.975,1.253-4.556,0.966-6.21-0.689l-25.99-25.989c-1.654-1.653-1.94-4.233-0.689-6.21l28.462-44.961
c-7.6-12.538-13.204-26.063-16.692-40.289L64.41,307.1c-2.285-0.511-3.91-2.538-3.91-4.88v-36.8c0-2.342,1.625-4.369,3.91-4.88
l51.856-11.585c3.469-14.128,9.074-27.651,16.696-40.283l-28.467-44.958c-1.251-1.976-0.965-4.556,0.688-6.209l25.99-26
c1.656-1.658,4.238-1.941,6.216-0.687l44.955,28.535c11.461-6.965,23.892-12.303,36.997-15.887
c2.665-0.73,5.414,0.841,6.142,3.504c0.729,2.664-0.84,5.414-3.504,6.142c-13.175,3.603-25.613,9.107-36.967,16.361
c-1.637,1.047-3.731,1.05-5.372,0.008l-44.227-28.073l-20.329,20.337l28,44.22c1.034,1.633,1.034,3.715,0,5.349
c-8.438,13.334-14.421,27.775-17.784,42.92c-0.42,1.894-1.898,3.373-3.791,3.796L70.5,269.426v28.788l51.01,11.396
c1.893,0.423,3.371,1.902,3.791,3.796c3.389,15.266,9.37,29.702,17.776,42.909c1.041,1.634,1.043,3.722,0.007,5.359l-28,44.229
l20.331,20.33l44.229-27.999c1.633-1.033,3.715-1.034,5.348-0.001c13.334,8.438,27.774,14.422,42.92,17.785
c1.893,0.42,3.373,1.897,3.796,3.791l11.396,51.01h28.787l11.396-51.01c0.423-1.894,1.903-3.371,3.796-3.791
c15.267-3.39,29.703-9.371,42.909-17.777c1.634-1.04,3.724-1.043,5.359-0.007l44.229,27.999l20.331-20.33l-27.999-44.229
c-1.034-1.633-1.034-3.716-0.001-5.349c8.438-13.334,14.421-27.774,17.784-42.92c0.42-1.894,1.897-3.373,3.791-3.796l51.01-11.396
v-28.788l-51.01-11.396c-1.893-0.423-3.371-1.902-3.791-3.796c-3.363-15.145-9.346-29.586-17.784-42.92
c-1.034-1.633-1.033-3.716,0.001-5.349l27.999-44.22l-20.329-20.337l-44.227,28.073c-1.64,1.042-3.734,1.039-5.371-0.008
c-11.461-7.321-24.025-12.862-37.345-16.467c-2.665-0.721-4.241-3.467-3.52-6.133c0.722-2.665,3.47-4.24,6.133-3.52
c13.257,3.588,25.822,8.965,37.398,16l44.955-28.535c1.979-1.256,4.56-0.97,6.216,0.687l25.99,26
c1.653,1.654,1.939,4.233,0.688,6.209l-28.467,44.958c7.623,12.632,13.228,26.154,16.697,40.283l51.855,11.585
c2.285,0.511,3.91,2.538,3.91,4.88v36.8c0,2.342-1.625,4.369-3.91,4.88l-51.855,11.586c-3.471,14.129-9.075,27.651-16.697,40.282
l28.467,44.968c1.252,1.977,0.965,4.557-0.688,6.21l-25.989,25.989c-1.656,1.655-4.234,1.941-6.211,0.689l-44.961-28.463
c-12.537,7.601-26.063,13.204-40.289,16.693l-11.586,51.855C280.27,479.195,278.241,480.82,275.9,480.82z"/>
<path d="M62.5,430.29c-16.542,0-30-13.458-30-30s13.458-30,30-30s30,13.458,30,30S79.042,430.29,62.5,430.29z M62.5,380.29
c-11.028,0-20,8.972-20,20s8.972,20,20,20s20-8.972,20-20S73.528,380.29,62.5,380.29z"/>
<path d="M452.5,110.29c-19.299,0-35-15.701-35-35s15.701-35,35-35s35,15.701,35,35S471.799,110.29,452.5,110.29z M452.5,50.29
c-13.785,0-25,11.215-25,25s11.215,25,25,25s25-11.215,25-25S466.285,50.29,452.5,50.29z"/>
<path d="M255.73,349.13c-8.742,0-17.289-1.694-25.404-5.037c-1.873-0.771-3.096-2.597-3.096-4.623V158.405
c-3.389-1.769-6.616-3.832-9.626-6.158c-16.122-12.389-25.374-31.161-25.374-51.497c0-27.5,17.415-52.129,43.334-61.284
c1.531-0.542,3.228-0.305,4.553,0.632c1.325,0.937,2.113,2.459,2.113,4.082v51.57h30V44.18c0-1.623,0.787-3.145,2.112-4.082
c1.324-0.938,3.021-1.173,4.553-0.632c25.919,9.155,43.335,33.784,43.335,61.284c0,20.238-9.191,38.966-25.219,51.383
c-3.057,2.377-6.338,4.482-9.781,6.276V338.1c0,1.923-1.104,3.675-2.836,4.508C275.379,346.936,265.735,349.13,255.73,349.13z
M237.23,336.02c5.965,2.065,12.173,3.11,18.5,3.11c7.455,0,14.672-1.435,21.5-4.269V155.29c0-1.955,1.139-3.731,2.916-4.545
c3.814-1.748,7.426-3.938,10.734-6.511c13.57-10.514,21.35-26.361,21.35-43.483c0-20.826-11.801-39.704-30-48.993v48.993
c0,2.761-2.239,5-5,5h-40c-2.761,0-5-2.239-5-5V51.757c-18.2,9.289-30,28.167-30,48.993c0,17.205,7.828,33.087,21.477,43.575
c3.274,2.529,6.842,4.688,10.613,6.422c1.773,0.816,2.91,2.59,2.91,4.542V336.02z"/>
</g>
</g>
<g id="Layer_1">
</g>
</svg>
$(document).ready(function(e) {
$("#form_id").submit(function (e){
var ticket_type = $("#tck_type").val();
if (ticket_type == "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_main_type'] == ""){
e.preventDefault();
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");
}
if(req['portal_severity'] == ""){
e.preventDefault();
show_error("Es necesario llenar el campo de Tipo de Gravedad");
}
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|");
}
}
});
function required_maintenance(){
return {
'partner_id': $("#partner_id").val(),
'portal_contact_name': $("#portal_contact_name").val(),
'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_severity': $("#portal_severity").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",
text: message,
icon: "error",
buttons: "Ok",
})
}
function validate_Date(date){
let dateformat = /^(0?[1-9]|[1-2][0-9]|3[01])[\/](0?[1-9]|1[0-2])/;
if (date.match(dateformat)){
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){
if( day > 0 && day <= ListofDays[month-1]){
return date
}else{
return "";
}
}else{
return "";
}
}else{
return "";
}
}
});
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_my_maitenance" name="Mis Tickets">
<t t-call="portal.portal_layout">
<t t-set="breadcrumbs_searchbar" t-value="True" />
<t t-call="portal.portal_searchbar">
<t t-set="title">Mantenimiento</t>
</t>
<input type="hidden" name="mdl_shw" id="mdl_shw" t-att-value="created"/>
<div id="createticketModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content" style="max-height:650px;">
<div class="modal-body">
<div class="row">
<div class="col-sm-12 col-md-6 col-lg-6 border-right">
<h4>Crear Ticket</h4>
<form action="/portal-create-ticket-maintenance" method="POST" id="form_id" class="form-horizontal mt32" enctype="multipart/form-data">
<input type="hidden" name="sh_file_size" id="sh_file_size" t-att-value="request.env.company.sh_file_size"/>
<input type="hidden" name="tck_type" id="tck_type" value="mantenimiento"/>
<div class="form-group">
<t t-if="request.env.user.has_group('base.group_portal') and request.env.user.sh_portal_user_access or not request.env.user.has_group('base.group_portal')">
<label class="control-label" for="partner">Usuario:</label>
<input class="form-control " list="partner_ids" name="partner" id="partner" />
<input type="hidden" name="partner_id" id="partner_id" />
<datalist id="partner_ids"> </datalist>
</t>
</div>
<t t-if="request.env.user.has_group('base.group_portal') and not request.env.user.sh_portal_user_access">
<div t-attf-class="form-group #{error and 'portal_contact_name' in error and 'has-error' or ''}">
<label class="control-label" for="portal_contact_name">Nombre:</label>
<input type="text" class="form-control" id="portal_contact_name" name="portal_contact_name" t-att-value="request.env.user.partner_id.name" readonly="True" />
</div>
<div name="portal_email_from_container" t-attf-class="form-group #{error and 'portal_email' in error and 'has-error' or ''}">
<label class="control-label" for="portal_email">Correo:</label>
<input type="email" class="form-control" id="portal_email" name="portal_email" t-att-value="request.env.user.partner_id.email" readonly="True" />
</div>
</t>
<t t-else="">
<div t-attf-class="form-group #{error and 'portal_contact_name' in error and 'has-error' or ''}">
<label class="control-label" for="portal_contact_name">Nombre:</label>
<input type="text" class="form-control" id="portal_contact_name" name="portal_contact_name" required="True" />
</div>
<div name="portal_email_from_container" t-attf-class="form-group #{error and 'portal_email' in error and 'has-error' or ''}">
<label class="control-label" for="portal_email">Correo:</label>
<input type="email" class="form-control" id="portal_email" name="portal_email" required="True" />
</div>
</t>
<div t-attf-class="form-group s_website_form_required">
<label class="control-label s_website_form_required" for="portal_phone">Teléfono:</label>
<input type="text" class="form-control form-field s_website_form_required" id="portal_phone" name="portal_phone" required="" />
</div>
<!--Tipo de mantenimiento-->
<div t-attf-class="form-group o_website_form_required_custom #{error and 'portal_main_type' in error and 'has-error' or ''}">
<label class="control-label" for="portal_main_type">Tipo de Mantenimiento:</label>
<select class="form-control form-field o_website_form_required_custom" id="portal_main_type" name="portal_main_type">
<option></option>
<t t-foreach="request.env['maintenance.type'].sudo().search([])" t-as="type">
<option t-att-value="type.id"><t t-esc="type.name" /></option>
</t>
</select>
</div>
<!--fecha de decteción de falla-->
<div t-attf-class="form-group o_website_form_required_custom #{error and 'portal_date_fail' in error and 'has-error' or ''}">
<label class="control-label" for="portal_date_fail">¿Cuando detecto la falla?</label>
<input type="text" class="form-control form-field s_website_form_required" id="portal_date_fail" name="portal_date_fail" placeholder="(dd/mm/yyyy)" required="" />
</div>
<!--Tipo de gravedad-->
<div t-attf-class="form-group o_website_form_required_custom #{error and 'portal_severity' in error and 'has-error' or ''}">
<strong><span class="control-label" >Selecciona el tipo de Gravedad;</span></strong><br/><br/>
<input class="mr5" type="radio" name="portal_severity" id="portal_severity" value="1">Leve</input>
<input class="mr5" type="radio" name="portal_severity" id="portal_severity" value="2">Medio</input>
<input class="mr5" type="radio" name="portal_severity" id="portal_severity" value="3">Grave</input>
</div>
<!--Descripción detallada de falla-->
<div t-attf-class="form-group o_website_form_required_custom #{error and 'portal_description' in error and 'has-error' or ''}">
<label class="control-label" for="portal_description">Descripción</label>
<textarea id="description" name="portal_description" class="form-control form-field o_website_form_required_custom" placeholder="Description" required=""/>
</div>
<!--Tipo de falla-->
<div t-attf-class="form-group o_website_form_required_custom #{error and 'portal_fail_type' in error and 'has-error' or ''}">
<strong><span class="control-label" >Selecciona el tipo de falla:</span></strong><br/><br/>
<input type="radio" class="mr5" name="portal_fail_type" id="portal_fail_type" value="fail">Falla</input>
<input type="radio" class="mr5" name="portal_fail_type" id="portal_fail_type" value="warranty">Garantía</input>
</div>
<div name="portal_file_container" t-attf-class="form-group #{error and 'portal_file' in error and 'has-error' or ''}">
<label class="control-label" for="portal_file">Evidencias:</label>
<label class="custom-file">
<input name="portal_file" id="portal_file" type="file" multiple="true" />
<span class="custom-file-control" />
</label>
</div>
<div class="row mb-2">
<div class="col-12 text-center border-top ">
<button type="submit" id="create_helpdesk_ticket" class="btn btn-primary mt-2 rounded">Crear Ticket</button>
</div>
</div>
</form>
</div>
<div class="col-sm-12 col-md-6 col-lg-6 o_center_object mt-2">
<button type="button" class="btn btn-secondary rounded" data-dismiss="modal">Ver mis tickets</button>
</div>
</div>
</div>
</div>
</div>
</div>
<t t-if="not tickets">
<p>No hay tickets relacionados.</p>
</t>
<t t-if="grouped_tickets" t-call="portal.portal_table">
<t t-foreach="grouped_tickets" t-as="ticket">
<thead>
<tr t-attf-class="{{'thead-light' if not groupby == 'none' else ''}}">
<th t-if="groupby == 'create_by'">
<em class="font-weight-normal text-muted">Creado por:</em>
<span t-field="ticket[0].create_uid.name" />
</th>
<th t-if="groupby == 'ticket_type'">
<em class="font-weight-normal text-muted">Tipo de Ticket:</em>
<span t-field="ticket[0].ticket_type.name" />
</th>
<th t-if="groupby == 'status'">
<em class="font-weight-normal text-muted">Estado:</em>
<span t-esc="ticket[0].stage_id.name" />
</th>
<th t-if="groupby == 'priority'">
<em class="font-weight-normal text-muted">Prioridad:</em>
<span t-esc="ticket[0].priority.name" />
</th>
<th t-if="groupby == 'state'">
<em class="font-weight-normal text-muted">Estatus de Respuesta:</em>
<span t-esc="ticket[0].state" />
</th>
<th>Fecha de creación</th>
<th>Última actualización</th>
<th>Tipo de Ticket</th>
<th>Estado</th>
</tr>
</thead>
<tbody>
<t t-foreach="ticket" t-as="t">
<tr>
<td>
<a t-att-href="t.get_portal_url()" t-att-title="t.name">
<t t-esc="t.name" t-if="t.name" />
<em t-else="">Ticket</em>
</a>
</td>
<td><span t-field="t.create_date" t-options='{"widget": "date"}' /></td>
<td><span t-field="t.write_date" t-options='{"widget": "date"}' /></td>
<td><span t-field="t.ticket_type" /></td>
<td><span t-field="t.stage_id" /></td>
</tr>
</t>
</tbody>
</t>
</t>
</t>
</template>
</odoo>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_home_maintenance" name="Portal My Home : IT" inherit_id="portal.portal_my_home" priority="101">
<xpath expr="//div[hasclass('o_portal_docs')]" position="inside">
<t t-call="portal.portal_docs_entry">
<t t-set="title">Mantenimiento</t>
<t t-set="url" t-value="'/my/mantenimiento'" />
<t t-set="background" t-value="'/helpdesk_maintenance/static/src/img/mantenimiento.svg'"/>
</t>
</xpath>
</template>
<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>
<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>
</xpath>
</template>
<template id="portal_my_maintenance" name="Mantenimiento">
<t t-call="portal.portal_layout">
<t t-set="my_details" t-value="True"/>
<div class="o_portal_my_home">
<div class="oe_structure" id="oe_structure_portal_my_ti_1"/>
<h3>Solicitud de Mantenimiento</h3>
<div id="portal_cards" class="o_portal_docs row">
<t t-call="portal.portal_docs_entry">
<t t-set="title">Mantenimiento</t>
<t t-set="url" t-value="'/my/mantenimientos'" />
<t t-set="count" t-value="maintenance_count" />
<t t-set="desc" t-value="'Levanta tu nuevo ticket de mantenimiento'"/>
<t t-set="avatar" t-value="'/helpdesk_maintenance/static/src/img/matenimiento_icon.svg'"/>
<t t-set="background" t-value="'/helpdesk_maintenance/static/src/img/mantenimineto_back.svg'"/>
</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>
</div>
</div>
<div class="oe_structure" id="oe_structure_portal_my_ti_2"/>
</t>
</template>
</odoo>
\ No newline at end of file
......@@ -18,6 +18,7 @@
],
"data": [
'security/ir.model.access.csv',
'data/region.xml',
'data/helpdesk_team.xml',
'data/helpdesk_stage.xml',
'data/sla_policies.xml',
......
......@@ -25,17 +25,12 @@ class PortalHelpdeskMorsa(PortalHelpdesk):
return {}
@http.route('/my/ti',type='http',auth="user",website=True)
def prepare_portal_ti(self,**kw):
values = self._prepare_home_portal_values()
return request.render("helpdesk_morsa.portal_my_ti",values)
@http.route('/selected-partner-data',type="http",auth="public",csrf=False)
def selected_partner_data(self, **kw):
dic = {}
......@@ -51,13 +46,6 @@ class PortalHelpdeskMorsa(PortalHelpdesk):
return json.dumps(dic)
@http.route(['/unvaluated/tickets'],type='http',auth="none",website=True,csrf=False)
def verify_unvaluated_tikets(self,**kw):
......
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data noupdate="1">
<record id="region_northwest" model="region.helpdesk">
<field name="name">Noroeste</field>
</record>
<record id="region_west" model="region.helpdesk">
<field name="name">Occidente</field>
</record>
<record id="region_southeast" model="region.helpdesk">
<field name="name">Sureste</field>
</record>
</data>
</odoo>
\ No newline at end of file
......@@ -3,60 +3,79 @@
<data noupdate="1">
<record id="wh_zapopan" model="warehouse.helpdesk">
<field name="name">ZAPOPAN</field>
<field name="region_id" ref="helpdesk_morsa.region_west"/>
</record>
<record id="wh_culiacan" model="warehouse.helpdesk">
<field name="name">CULIACAN</field>
<field name="region_id" ref="helpdesk_morsa.region_northwest"/>
</record>
<record id="wh_mochis" model="warehouse.helpdesk">
<field name="name">MOCHIS</field>
<field name="region_id" ref="helpdesk_morsa.region_northwest"/>
</record>
<record id="wh_mazatlan" model="warehouse.helpdesk">
<field name="name">MAZATLAN</field>
<field name="region_id" ref="helpdesk_morsa.region_northwest"/>
</record>
<record id="wh_merida" model="warehouse.helpdesk">
<field name="name">MERIDA</field>
<field name="region_id" ref="helpdesk_morsa.region_southeast"/>
</record>
<record id="wh_la_paz" model="warehouse.helpdesk">
<field name="name">LA PAZ</field>
<field name="region_id" ref="helpdesk_morsa.region_northwest"/>
</record>
<record id="wh_cancun" model="warehouse.helpdesk">
<field name="name">CANCUN</field>
<field name="region_id" ref="helpdesk_morsa.region_southeast"/>
</record>
<record id="wh_tepic" model="warehouse.helpdesk">
<field name="name">TEPIC</field>
<field name="region_id" ref="helpdesk_morsa.region_west"/>
</record>
<record id="wh_villahermosa" model="warehouse.helpdesk">
<field name="name">VILLAHERMOSA</field>
<field name="region_id" ref="helpdesk_morsa.region_southeast"/>
</record>
<record id="wh_durango" model="warehouse.helpdesk">
<field name="name">DURANGO</field>
<field name="region_id" ref="helpdesk_morsa.region_west"/>
</record>
<record id="wh_guadalajara" model="warehouse.helpdesk">
<field name="name">GUADALAJARA</field>
<field name="region_id" ref="helpdesk_morsa.region_west"/>
</record>
<record id="wh_campeche" model="warehouse.helpdesk">
<field name="name">CAMPECHE</field>
<field name="region_id" ref="helpdesk_morsa.region_southeast"/>
</record>
<record id="wh_veracruz" model="warehouse.helpdesk">
<field name="name">VERACRUZ</field>
<field name="region_id" ref="helpdesk_morsa.region_southeast"/>
</record>
<record id="wh_hermosillo" model="warehouse.helpdesk">
<field name="name">HERMOSILLO</field>
<field name="region_id" ref="helpdesk_morsa.region_northwest"/>
</record>
<record id="wh_obregon" model="warehouse.helpdesk">
<field name="name">OBREGON</field>
<field name="region_id" ref="helpdesk_morsa.region_northwest"/>
</record>
<record id="wh_queretaro" model="warehouse.helpdesk">
<field name="name">QUERETARO</field>
<field name="region_id" ref="helpdesk_morsa.region_west"/>
</record>
<record id="wh_oaxaca" model="warehouse.helpdesk">
<field name="name">OAXACA</field>
<field name="region_id" ref="helpdesk_morsa.region_southeast"/>
</record>
<record id="wh_torreon" model="warehouse.helpdesk">
<field name="name">TORREON</field>
<field name="region_id" ref="helpdesk_morsa.region_west"/>
</record>
<record id="wh_tuxtla" model="warehouse.helpdesk">
<field name="name">TUXTLA</field>
<field name="region_id" ref="helpdesk_morsa.region_southeast"/>
</record>
</data>
</odoo>
\ No newline at end of file
from . import ticket_reason
from . import warehouse_helpdesk
from . import erp_module
from . import region_helpdesk
from . import res_users
from . import helpdesk_team
from . import helpdesk_ticket
from . import helpdesk_settings
from . import helpdesk_sla
......@@ -6,5 +6,5 @@ class ErpModules(models.Model):
_rec_name = "name"
name = fields.Char(string="Nombre")
\ No newline at end of file
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class RegionHelpdesk(models.Model):
_name = 'region.helpdesk'
_rec_name = 'name'
name = fields.Char('Nombre')
\ 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')
\ No newline at end of file
......@@ -8,3 +8,5 @@ hlp_warehouse_helpdesk,warehouse.helpdesk.admin,model_warehouse_helpdesk,sh_all_
user_ticket_reason,ticket.reason.user,model_ticket_reason,base.group_user,,1,0,0,0
hlp_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
hlp_region_helpdesk,region.helpdesk.admin,model_region_helpdesk,sh_all_in_one_helpdesk.helpdesk_group_manager,1,1,1,1
\ No newline at end of file
......@@ -41,10 +41,7 @@ $(document).ready(function(e) {
var ticket_type = $("#tck_type").val();
if(ticket_type == 'soporte'){
var rqued = required_support();
console.log(rqued);
ajax_unvalued_tickets(rqued);
console.log('Sin valorar');
console.log(unvaluated);
if (rqued['portal_contact_name'] == ""){
e.preventDefault();
swal({
......
......@@ -7,6 +7,7 @@
<field name="arch" type="xml">
<tree editable="top">
<field name="name"/>
<field name="region_id"/>
</tree>
</field>
</record>
......
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="portal_my_home_IT" name="Portal My Home : IT" inherit_id="portal.portal_my_home" priority="100">
<template id="portal_my_home_it" name="Portal My Home : IT" inherit_id="portal.portal_my_home" priority="100">
<xpath expr="//div[hasclass('o_portal_docs')]" position="inside">
<t t-call="portal.portal_docs_entry">
<t t-set="title">Tecnologías de la información</t>
......@@ -13,8 +11,6 @@
</xpath>
</template>
<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 == 'soporte' or soporte" t-attf-class="breadcrumb-item #{'active ' if not soporte else ''}">
......
......@@ -6,7 +6,7 @@
<div class="o_portal_my_home">
<div class="oe_structure" id="oe_structure_portal_my_ti_1"/>
<h3>Mesa de Ayuda</h3>
<div class="o_portal_docs row">
<div id="portal_cards" class="o_portal_docs row" >
<t t-call="portal.portal_docs_entry">
<t t-set="title">Soporte Técnico</t>
<t t-set="url" t-value="'/my/soporte'" />
......@@ -16,7 +16,7 @@
<t t-set="background" t-value="'/helpdesk_morsa/static/src/img/support_back.svg'"/>
</t>
<t t-call="portal.portal_docs_entry">
<t t-set="title">Asistencia ERP / Odoo</t>
<t t-set="title">Asistencia ERP</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'"/>
......
......@@ -4,14 +4,11 @@
<t t-call="portal.portal_layout">
<t t-set="breadcrumbs_searchbar" t-value="True" />
<t t-call="portal.portal_searchbar">
<t t-set="title">Soporte Técnico</t>
</t>
<input type="hidden" name="mdl_shw" id="mdl_shw" t-att-value="created"/>
<div id="createticketModal" class="modal fade" role="dialog">
<div class="modal-dialog">
......
......@@ -28,6 +28,7 @@
'assets': {
'web.assets_frontend': [
'/portal_design_helpdesk/static/src/scss/portal.scss',
'/portal_design_helpdesk/static/src/js/portal.js',
],
},
"application":False,
......
$(document).ready(function(e) {
var card = document.getElementById('portal_cards');
var cards = card.children;
if(cards.length == 1){
card.appendChild(newdiv1);
for (var i = 0; i <= cards.length; i++){
cards[i].classList.remove("col-lg-4");
cards[i+1].classList.add("col-lg-6");
}
}
if(cards.length == 2){
for (var i = 0; i <= cards.length; i++){
cards[i].classList.remove("col-lg-4");
cards[i].classList.add("col-lg-6");
}
}
});
/*var card = $('#portal_cards').children('div')
var cards = card.length;
if(cards == 1){
card.each(function (){
var element = $(this)
element.removeClass('col-lg-4');
element.addClass('col-lg-6');
element.addClass('o_center_object');
})
}else if(cards == 2){
card.each(function (){
var element = $(this)
element.removeClass('col-lg-4');
element.addClass('col-lg-6');
})
}*/
......@@ -56,7 +56,6 @@
}
/* Card Styles */
$deeppurple500: #673ab7;
$grey500: #9e9e9e;
......
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_layout_inherit" name="portal inherit" inherit_id="portal.portal_layout">
<xpath expr="//div[@id='o_my_sidebar']" position="replace">
<xpath expr="//div[@id='o_my_sidebar']" position="replace"></xpath>
<xpath expr="//div[@t-attf-class='col-12 col-md col-lg-6']" position="after">
<div class="col-sm-12 col-md-12 col-lg-1"/>
</xpath>
<xpath expr="//div[@t-attf-class='col-12 col-md col-lg-6']" position="before">
<div class="col-sm-12 col-md-12 col-lg-1"/>
</xpath>
<xpath expr="//div[@t-attf-class='col-12 col-md col-lg-6']" position="attributes">
<attribute name="t-attf-class">col-12 col-md-12 col-lg-12 col-xl-12 col-sm-12</attribute>
<attribute name="t-attf-class">col-lg-10 col-md-12 col-sm-12</attribute>
</xpath>
</template>
......@@ -20,83 +29,75 @@
<xpath expr="//h3" position="replace">
<h2>BIENVENIDO</h2>
</xpath>
<xpath expr="//div[@class='o_portal_docs list-group']" position="attributes">
<attribute name="class">o_portal_docs row</attribute>
<attribute name="id">portal_cards</attribute>
</xpath>
</template>
<template id="remove_invoices" name="remove invoices" inherit_id="account.portal_my_home_invoice">
<xpath expr="//t[@t-call='portal.portal_docs_entry']" position="replace">
<div></div>
</xpath>
<xpath expr="//t[@t-call='portal.portal_docs_entry']" position="replace"></xpath>
</template>
<template id="remove_sale_orders" name="remove sale orders" inherit_id="sale.portal_my_home_sale">
<xpath expr="//t[@t-call='portal.portal_docs_entry']" position="replace">
<div></div>
</xpath>
<xpath expr="//t[@t-call='portal.portal_docs_entry']" position="replace">
<div></div>
</xpath>
<xpath expr="//t[@t-call='portal.portal_docs_entry']" position="replace"></xpath>
<xpath expr="//t[@t-call='portal.portal_docs_entry']" position="replace"></xpath>
</template>
<template id="remove_purchase_orders" name="remove purchase orders" inherit_id="purchase.portal_my_home_purchase">
<xpath expr="//t[@t-call='portal.portal_docs_entry']" position="replace">
<div></div>
</xpath>
<xpath expr="//t[@t-call='portal.portal_docs_entry']" position="replace">
<div></div>
</xpath>
<xpath expr="//t[@t-call='portal.portal_docs_entry']" position="replace"></xpath>
<xpath expr="//t[@t-call='portal.portal_docs_entry']" position="replace"></xpath>
</template>
<template id="remove_proyects" name="remove proyects" inherit_id="project.portal_my_home">
<xpath expr="//t[@t-call='portal.portal_docs_entry']" position="replace"><div></div></xpath>
<xpath expr="//t[@t-call='portal.portal_docs_entry']" position="replace"><div></div></xpath>
<xpath expr="//t[@t-call='portal.portal_docs_entry']" position="replace"></xpath>
<xpath expr="//t[@t-call='portal.portal_docs_entry']" position="replace"></xpath>
</template>
<template id="template_id" name="template_name" inherit_id="sh_all_in_one_helpdesk.portal_my_home_ticket">
<xpath expr="//t[@t-call='portal.portal_docs_entry']" position="replace"><div></div></xpath>
<xpath expr="//t[@t-call='portal.portal_docs_entry']" position="replace"></xpath>
</template>
<template id="remove_timesheet" name="remove timesheet" inherit_id="hr_timesheet.portal_my_home_timesheet">
<xpath expr="//t[@t-call='portal.portal_docs_entry']" position="replace"><div></div></xpath>
<xpath expr="//t[@t-call='portal.portal_docs_entry']" position="replace"></xpath>
</template>
<template id="change_portal_layout" name="portal update docs" inherit_id="portal.portal_docs_entry">
<xpath expr="//a" position="replace">
<div class="col-sm-12 col-md-6 col-lg-4 mb-5">
<div class="card-body card-body-custom" style="background-color:white !important;">
<header class="card__primary-title">
<t t-if="avatar">
<figure class="image image--avatar">
<img t-att-src="avatar"/>
</figure>
</t>
<div class="item item--two-lines">
<h5 t-att-title="title"><t t-esc="title"/></h5>
<div class="card">
<div t-if="url" class="card-body card-body-custom" style="background-color:white !important;">
<header class="card__primary-title">
<t t-if="avatar">
<figure class="image image--avatar">
<img t-att-src="avatar"/>
</figure>
</t>
<div class="item item--two-lines">
<h5 t-att-title="title"><t t-esc="title"/></h5>
</div>
</header>
<t t-if="background">
<figure class="image">
<img t-att-src="background"/>
</figure>
</t>
<t t-if="desc">
<span class="card__supporting-text"><t t-esc="desc"/></span>
</t>
<footer class="card__actions">
<a class="btn btn-primary" t-att-href="url">Ver mis tickets</a>
</footer>
</div>
</header>
<t t-if="background">
<figure class="image">
<img t-att-src="background"/>
</figure>
</t>
<t t-if="desc">
<span class="card__supporting-text"><t t-esc="desc"/></span>
</t>
<footer class="card__actions">
<a class="btn btn-primary" t-att-href="url">Ver mis tickets</a>
</footer>
</div>
</div>
</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