Commit eff637f9 by juan

cambios generales

1 parent df0046d3
# -*- coding: utf-8 -*-
from odoo import models, fields, api
import requests
class hgt_incidencias(models.Model):
_name = 'hgt.incidencias'
......@@ -20,14 +20,21 @@ class hgt_incidencias(models.Model):
cliente = fields.Many2one(
string='Cliente',
comodel_name='hgt.cliente',
ondelete='restrict',
comodel_name='hgt.instituciones',
)
descripcion = fields.Html(
string=u'Descripción',
)
url = fields.Char(string='Url de ticketera')
numero = fields.Char(string='Numero de ticket')
id_ost = fields.Integer(string='Id osticket')
fecha_creacion = fields.Date(
string=u'Fecha de creación',
default=fields.Date.context_today,
......@@ -87,6 +94,40 @@ class hgt_incidencias(models.Model):
vals['tarea'] = nueva_tar.id
result = super(hgt_incidencias, self).create(vals)
return result
def importarRango(self,key,inicio,final):
idticket = 1
ultimo = 5000
while idticket <= ultimo:
existe = self.env['asw.ticket'].search_count([('tic_id_externo', '=', idticket)])
if existe == False:
link = 'http://192.168.10.17:11876/get-info?id-tk=' + str(idticket) + '&api-key=' + key
info = requests.get(link).json()
if 'message'in info and info['message'] == 'Internal Server Error':
idticket += 1
else:
datos = {
'tic_id_externo':idticket,
'tic_asunto':info['asunto'],
'tic_cacilla':info['cacilla'],
'tic_cliente':info['cliente'],
'tic_resumen':info['cuerpo'],
'tic_departamento':info['departamento'],
'tic_estado':info['estado'],
'tic_numero':info['numero'],
'tic_mail':info['reporto'],
}
link2 = 'http://192.168.10.17:11876/get-client?id-t=' + str(idticket) + '&api-key=' + key
info2 = requests.get(link2).json()
if 'message'in info2 and info2['message'] == 'Internal Server Error':
self.env['asw.ticket'].create(datos)
idticket += 1
else:
datos['tic_notas'] = info2['notas']
datos['tic_telefono'] = info2['telefono']
self.env['asw.ticket'].create(datos)
idticket += 1
......
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_my_module_my_module,my_module.my_module,model_my_module_my_module,,1,0,0,0
\ No newline at end of file
access_my_module_my_module,my_module.my_module,model_my_module_my_module,group_crm_incidentes,1,1,1,0
\ No newline at end of file
<openerp>
<data>
<record model="ir.module.category" id="category_hgt_incidente">
<field name="name">CRM Incidentes</field>
<field name="description">CRM Incidentes</field>
</record>
<record model="res.groups" id="group_crm_incidentes">
<field name="name">Lista de incidentes</field>
<field name="category_id" eval="ref('category_hgt_incidente')"/>
</record>
</data>
</openerp>
\ No newline at end of file
......@@ -2,8 +2,9 @@
<odoo>
<data noupdate="0">
<menuitem name="Incidencias" id="hgt_incidencias" />
<menuitem name="Incidencias" id="hgt_incidencias_incidencias" parent="hgt_incidencias" />
<!--<menuitem name="Incidencias" id="hgt_incidencias" />-->
<menuitem name="Incidencias" id="hgt_incidencias_incidencias" parent="asw_crm.asw_crm_root" />
<menuitem name="Ver Incidencias" parent="hgt_incidencias_incidencias" id="hgt_incidencias_accion" action="action_incidencias_act_window" />
</data>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!