Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Maria Agustina
/
tpv_correcciones
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
1
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit df5561a7
authored
2021-02-14 19:16:04 -0300
by
adrian
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
listo para las primeras pruebas
1 parent
42bc81a6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
11 deletions
__manifest__.py
models/comprobante.py
models/qr.py
security/ir.model.access.csv
__manifest__.py
View file @
df5561a
...
...
@@ -25,7 +25,7 @@
# always loaded
'data'
:
[
#
'security/ir.model.access.csv',
'security/ir.model.access.csv'
,
'views/referencias.xml'
,
'views/comprobante.xml'
,
],
...
...
models/comprobante.py
View file @
df5561a
...
...
@@ -31,22 +31,39 @@ class asw_comprobante(models.Model):
@api.depends
(
'afip_qr_img'
)
def
_compute_afip_qr
(
self
):
for
rec
in
self
:
print
(
rec
.
comp_fecha
)
print
(
rec
.
comp_talonario
.
tal_tpc_id
.
tc_cod_afip
)
print
(
rec
.
comp_talonario
.
tal_ptv_id
.
ptv_nro
)
print
(
rec
.
afip_auth_code
)
print
(
rec
.
comp_total
)
#import ipdb; ipdb.def_colors='NoColor'; ipdb.set_trace()
fecha_emision
=
rec
.
comp_fecha
cod_afip
=
rec
.
comp_talonario
.
tal_tpc_id
.
tc_cod_afip
punt_venta
=
rec
.
comp_talonario
.
tal_ptv_id
.
ptv_nro
afip_aut
=
rec
.
afip_auth_code
total
=
rec
.
comp_total
documento_tipo
=
rec
.
comp_cliente
.
cli_tipo_documento
.
tdoc_codigo_afip
numero_doc
=
rec
.
comp_cliente
.
cli_nro_doc
numero_comprobante
=
rec
.
comp_nro
#print("fsdsdfc")
#import ipdb; ipdb.set_trace()
try
:
cuit
=
int
(
rec
.
company_id
.
vat
)
if
rec
.
afip_auth_code
==
False
:
continue
()
print
(
self
.
cae_due_qr
(
rec
))
QR
=
qrfiscal
(
FechaEmision
=
rec
.
comp_fecha
,)
rec
.
afip_qr_img
=
False
continue
#print(self.cae_due_qr(rec))
QR
=
qrfiscal
(
FechaEmision
=
rec
.
comp_fecha
,
cuit
=
cuit
,
PuntoVenta
=
int
(
punt_venta
),
tipoComprobante
=
int
(
cod_afip
),
nroCmp
=
numero_comprobante
,
importe
=
total
,
tipoDocRec
=
int
(
documento_tipo
),
nroDocRec
=
int
(
numero_doc
),
codAut
=
int
(
afip_aut
))
QR
.
GenerarQR
()
rec
.
afip_qr_img
=
QR
.
LeerQR
()
rec
.
afip_qr
=
QR
.
URL
except
:
rec
.
afip_qr_img
=
False
def
cae_due_qr
(
self
,
rec
):
def
cae_due_qr
(
self
,
rec
):
# no me va es la fecha
cae_due
=
''
.
join
(
[
c
for
c
in
str
(
rec
.
afip_auth_code_due
or
''
)
if
c
.
isdigit
()])
...
...
models/qr.py
View file @
df5561a
...
...
@@ -35,6 +35,7 @@ class qrfiscal():
"codAut"
:
codAut
,
}
self
.
archivo
=
"""/dev/shm/{}.png"""
.
format
(
self
.
data
[
"cuit"
])
#print(self.data)
def
GenerarQR
(
self
):
json_dump
=
json
.
dumps
(
self
.
data
,
separators
=
(
','
,
':'
))
...
...
@@ -42,7 +43,9 @@ class qrfiscal():
base64_bytes
=
base64
.
b64encode
(
data
)
base64_message
=
base64_bytes
.
decode
(
'ascii'
)
URL
=
"""https://www.afip.gob.ar/fe/qr/?p={}"""
.
format
(
base64_message
)
self
.
URL
=
json_dump
self
.
generadorQR
(
URL
)
#print(URL)
def
generadorQR
(
self
,
URL
):
qr
=
qrcode
.
QRCode
(
version
=
1
,
box_size
=
2
,
border
=
2
)
...
...
security/ir.model.access.csv
View file @
df5561a
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_asw_referencias,access_asw_referencias,model_asw_referencias,,1,1,1,0
\ 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