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 e99f2c84
authored
2022-12-09 09:31:23 -0300
by
juan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Informas adjuntos, no sube duplicados
1 parent
bf33f8a8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
15 deletions
models/adjuntos.py
models/incidencia.py
wizard/adjuntar.py
models/adjuntos.py
View file @
e99f2c8
...
...
@@ -9,7 +9,6 @@ class hgt_soporte_adjunto(models.Model):
name
=
fields
.
Char
(
string
=
'Codigo'
)
creador
=
fields
.
Many2one
(
string
=
'Creador'
,
comodel_name
=
'res.users'
,
...
...
@@ -44,7 +43,7 @@ class hgt_soporte_adjunto(models.Model):
return
(
"ADJ_LOC"
)
def
GenerarCodigoArchivo
(
self
):
self
.
name
=
f
"""{self.CodigoBase()}{str(self.id).zfill(5)}"""
self
.
name
=
f
"""{self.CodigoBase()}
_
{str(self.id).zfill(5)}"""
def
DescargarArchivo
(
self
):
vals
=
{
...
...
models/incidencia.py
View file @
e99f2c8
...
...
@@ -392,23 +392,41 @@ class hgt_soporte_incidencia(models.Model):
'res_id'
:
msj
.
id
,
'target'
:
'new'
,
}
#print(hgt_soporte_incidencia.GenerarToken())
# si_url = fields.Char(string='Url de ticketera')
# _sql_constraints = [('id_ost_uniq', 'unique (id_ost)', 'Id Ticket must be unique.')]
# si_id_ost = fields.Integer(string='Id osticket')
# si_ost_cliente = fields.Char(string='Ost cliente')
# si_ost_asunto = fields.Char(string='Ost asunto')
def
InformarAdjuntos
(
self
):
"""Esta funcion informa al server HGT de los
adjuntos subidos por los clientes"""
if
self
.
subida
==
False
:
return
(
None
)
if
len
(
self
.
adjunto
)
==
0
:
return
(
None
)
lista
=
[]
for
adj
in
self
.
adjunto
:
val
=
{
"usuario"
:
adj
.
usuario
,
"file_name"
:
adj
.
file_name
,
"name"
:
adj
.
name
,
"fecha"
:
adj
.
fecha
,
}
lista
.
append
(
val
)
database
=
self
.
env
.
cr
.
dbname
# si_ost_mail = fields.Char(string='Ost mail')
datos
=
{
'params'
:
{
'token'
:
self
.
GenerarToken
(),
'archivos'
:
lista
,
'database'
:
database
,
'codigo'
:
self
.
si_name
,
}
}
# si_ost_telefeno = fields.Char(string='Ost telefono'
)
datos_json
=
json
.
dumps
(
datos
)
f
=
requests
.
post
(
f
"{HgtUrlBase}soporteIncidencias/soporteAdjunto"
,
data
=
datos_json
,
headers
=
headers
)
frespuesta
=
f
.
json
()
if
frespuesta
[
"result"
][
"estado"
]
!=
"ok"
:
raise
UserError
(
str
(
frespuesta
))
#forma de adjuntar queda pendiente
...
...
wizard/adjuntar.py
View file @
e99f2c8
...
...
@@ -19,7 +19,8 @@ class tpv_generar_nota(models.TransientModel):
file
=
fields
.
Binary
(
string
=
'Archivo'
)
def
CargarAdjunto
(
self
):
if
self
.
file
==
False
:
if
self
.
file
==
None
or
self
.
file_name
==
""
:
raise
UserError
(
"No se selecciono archivo"
)
vals
=
{
"file_name"
:
self
.
file_name
,
...
...
@@ -34,7 +35,7 @@ class tpv_generar_nota(models.TransientModel):
def
PostProcesado
(
self
,
adjunto
):
"""Luego de agregar el adjunto se debe Notificar al server externo
Via webservice"""
pass
self
.
incidencia
.
InformarAdjuntos
()
def
EnviarMensajeSoporte
(
self
):
if
self
.
incidencia
.
subida
==
False
:
...
...
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