Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Maria Agustina
/
hgt_soporte
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 b210394c
authored
2023-06-24 19:43:48 -0300
by
Juan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Se borran prints
1 parent
06531f70
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
13 deletions
controllers/controller_mensaje.py
models/incidencia.py
controllers/controller_mensaje.py
View file @
b210394
...
...
@@ -11,7 +11,7 @@ class controlador_soporte_mensajes(http.Controller):
def
index
(
self
,
**
kw
):
if
not
kw
[
"token"
]
==
TOKEN
:
return
({
"resultado"
:
"ALERTA DE SEGURIDAD error autenticacion"
})
print
(
kw
)
#
print(kw)
inci_model
=
http
.
request
.
env
[
"hgt.soporte_incidencia"
]
.
sudo
()
incidencia
=
inci_model
.
search
([(
'id'
,
'='
,
kw
[
"id_incide_original"
]
)])
...
...
@@ -28,11 +28,11 @@ class controlador_soporte_mensajes(http.Controller):
def
NotificarMensajeNuevo
(
self
,
incidencia
):
"""Este solo funciona en el server de soporte"""
print
(
"Notificador de incidencia"
)
#
print("Notificador de incidencia")
try
:
notif_push
=
incidencias
.
env
[
'ext.notificador'
]
.
sudo
()
except
Exception
as
e
:
print
(
e
)
#
print(e)
return
()
try
:
self
.
_NotificarMensajeNuevo
(
incidencia
,
notif_push
)
...
...
models/incidencia.py
View file @
b210394
...
...
@@ -407,17 +407,19 @@ class hgt_soporte_incidencia(models.Model):
return
()
incidencia
.
Generarmensaje
(
opt
[
"mensaje"
],
opt
[
"usuario"
],
opt
[
"fecha"
])
self
.
NotificarMensajeNuevo
(
incidencia
)
self
.
EnviarAvisoTelegram
()
#
self.EnviarAvisoTelegram()
def
EnviarAvisoTelegram
(
self
):
def
EnviarAvisoTelegram
(
self
,
mensaje
,
uids
):
model
=
self
.
env
[
"hgt.telegram"
]
.
sudo
()
try
:
model
=
NotificarUsuario
(
self
,
f
"Se ha actualizado la incidencia {self.name}"
,
self
.
si_responsable
.
id
)
except
Exception
as
E
:
print
(
E
)
#raise UserError(str(opt))
echo
=
[]
for
uid
in
uids
:
try
:
if
not
uid
in
echo
:
model
.
NotificarUsuario
(
mensaje
,
uids
)
echo
.
append
(
uid
)
except
Exception
as
E
:
print
(
E
)
#raise UserError(str(opt))
def
Generarmensaje
(
self
,
texto
,
usuario
,
fecha
):
if
texto
==
False
:
...
...
@@ -513,7 +515,7 @@ class hgt_soporte_incidencia(models.Model):
pass
def
NotificarMensajeNuevo
(
self
,
incidencia
):
print
(
"Notificador de incidencia"
)
#
print("Notificador de incidencia")
try
:
notif_push
=
incidencia
.
env
[
'ext.notificador'
]
.
sudo
()
except
Exception
as
e
:
...
...
@@ -532,6 +534,7 @@ class hgt_soporte_incidencia(models.Model):
uids
.
append
(
mensaje
.
si_creador
.
id
)
msm
=
f
"""Se a recivido un mensaje en el incidente {incidencia.si_descripcion}"""
pak
=
notif_push
.
GenerarMensajeMasivo
(
mensaje
=
msm
,
titulo
=
""
,
users
=
uids
)
self
.
EnviarAvisoTelegram
(
msm
,
uids
)
...
...
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