Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Maria Agustina
/
hgt_transportar
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 71fc46db
authored
2022-07-17 12:07:53 -0300
by
Juan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
impresion e identificacion de comprobante para pagina
1 parent
06d0714b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
models/__init__.py
models/comprobante.py
models/__init__.py
View file @
71fc46d
...
@@ -7,3 +7,4 @@ from . import dias
...
@@ -7,3 +7,4 @@ from . import dias
from
.
import
solicitudes
from
.
import
solicitudes
from
.
import
mensajes
from
.
import
mensajes
from
.
import
no_transporta
from
.
import
no_transporta
from
.
import
comprobante
\ No newline at end of file
\ No newline at end of file
models/comprobante.py
0 → 100644
View file @
71fc46d
# -*- coding: utf-8 -*-
from
odoo
import
models
,
fields
,
api
,
exceptions
from
odoo.exceptions
import
UserError
,
ValidationError
,
Warning
,
RedirectWarning
import
base64
class
asw_comprobante
(
models
.
Model
):
_inherit
=
'asw.comprobante'
_order
=
'id desc'
tipo_comprobante_lappa
=
fields
.
Char
(
string
=
'Tipo de comprobante'
,
readonly
=
True
,
compute
=
"_tipo_comprobante_lappa"
)
@api.depends
(
'tipo_comprobante_lappa'
)
def
_tipo_comprobante_lappa
(
self
):
adap
=
{
"fac"
:
"Factura"
,
"rec"
:
"Recivo"
}
for
rec
in
self
:
tal
=
rec
.
comp_talonario
.
tal_menu
if
tal
in
[
"fac"
,
"rec"
]:
tipo
=
adap
[
tal
]
else
:
tipo
=
"otro"
rec
.
tipo_comprobante_lappa
=
tipo
def
DescargarPDF
(
self
,
val
):
if
len
(
self
)
!=
1
:
raise
Warning
(
"Seleccione un regisrto"
)
print
(
val
)
rec
=
self
.
sudo
(
8
)
# usuario que pueda imprimir bien
result
=
rec
.
imprimir
()
report_action
=
rec
.
env
[
result
[
'type'
]]
.
_get_report_from_name
(
result
[
'report_name'
])
pdf
=
report_action
.
render_aeroo
([
rec
.
id
],
{
'context'
:
rec
.
env
.
context
})
nombre_pdf
=
pdf
[
2
]
.
replace
(
' '
,
''
)
.
replace
(
".pdf.pdf"
,
".pdf"
)
contenido
=
base64
.
b64encode
(
pdf
[
0
])
return
({
"filename"
:
nombre_pdf
,
"file"
:
contenido
})
\ No newline at end of file
\ No newline at end of file
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