Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Maria Agustina
/
hgt_incidencias
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 8ce12e45
authored
2021-01-16 23:19:06 -0300
by
juan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
integracionmensajes
1 parent
560f9b91
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
33 deletions
models/incidencias.py
views/incidencias.xml
models/incidencias.py
View file @
8ce12e4
...
...
@@ -4,6 +4,7 @@ from odoo import models, fields, api
import
requests
class
hgt_incidencias
(
models
.
Model
):
_name
=
'hgt.incidencias'
_order
=
"id desc"
responsabilidad
=
fields
.
Selection
(
string
=
u'Responsabilidad'
,
...
...
@@ -42,6 +43,8 @@ class hgt_incidencias(models.Model):
ost_telefeno
=
fields
.
Char
(
string
=
'Ost telefono'
)
ost_mensaje
=
fields
.
Text
(
string
=
'Mensajes'
)
fecha_creacion
=
fields
.
Date
(
string
=
u'Fecha de creación'
,
default
=
fields
.
Date
.
context_today
,
...
...
@@ -104,39 +107,20 @@ class hgt_incidencias(models.Model):
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
def
mensajes_ost
(
self
,
val
):
#print(val[0])
dom
=
[[
"numero"
,
"="
,
val
[
0
]]]
ins
=
self
.
env
[
'hgt.incidencias'
]
.
search
(
dom
,
limit
=
1
)
if
len
(
ins
)
==
0
:
#print("no esta en sistemma")
return
(
True
)
text_orig
=
ins
.
ost_mensaje
texto_nuevo
=
"""
\n
{} {} {}
\n
{}
\n\n
#######################################################
\n
"""
.
format
(
val
[
1
],
val
[
2
],
val
[
4
],
val
[
3
])
Texto
=
"""{}
\n
{}"""
.
format
(
text_orig
,
texto_nuevo
)
#print(Texto)
ins
.
ost_mensaje
=
Texto
return
(
True
)
...
...
views/incidencias.xml
View file @
8ce12e4
...
...
@@ -24,6 +24,7 @@
<field
name=
"ost_asunto"
/>
<field
name=
"fecha_creacion"
/>
<field
name=
"url"
widget=
"url"
/>
<field
colspan=
"2"
name=
"cliente"
/>
<field
name=
"descripcion"
/>
</tree>
</field>
...
...
@@ -63,7 +64,10 @@
<field
name=
"ost_asunto"
nolabel=
"1"
/>
<h2>
Descripcion
</h2>
<field
name=
"descripcion"
nolabel=
"1"
/>
<h2>
Mensajes
</h2>
<field
name=
"ost_mensaje"
nolabel=
"1"
/>
</group>
<notebook>
<page
string=
"Tareas"
>
<group
col=
"4"
>
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment