Commit df5561a7 by adrian

listo para las primeras pruebas

1 parent 42bc81a6
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
# always loaded # always loaded
'data': [ 'data': [
# 'security/ir.model.access.csv', 'security/ir.model.access.csv',
'views/referencias.xml', 'views/referencias.xml',
'views/comprobante.xml', 'views/comprobante.xml',
], ],
......
...@@ -31,22 +31,39 @@ class asw_comprobante(models.Model): ...@@ -31,22 +31,39 @@ class asw_comprobante(models.Model):
@api.depends('afip_qr_img') @api.depends('afip_qr_img')
def _compute_afip_qr(self): def _compute_afip_qr(self):
for rec in self: for rec in self:
print(rec.comp_fecha) #import ipdb; ipdb.def_colors='NoColor'; ipdb.set_trace()
print(rec.comp_talonario.tal_tpc_id.tc_cod_afip) fecha_emision = rec.comp_fecha
print(rec.comp_talonario.tal_ptv_id.ptv_nro) cod_afip = rec.comp_talonario.tal_tpc_id.tc_cod_afip
print(rec.afip_auth_code) punt_venta = rec.comp_talonario.tal_ptv_id.ptv_nro
print(rec.comp_total) 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: try:
cuit = int(rec.company_id.vat)
if rec.afip_auth_code == False: if rec.afip_auth_code == False:
continue() rec.afip_qr_img = False
print(self.cae_due_qr(rec)) continue
QR = qrfiscal(FechaEmision=rec.comp_fecha,) #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() QR.GenerarQR()
rec.afip_qr_img = QR.LeerQR() rec.afip_qr_img = QR.LeerQR()
rec. afip_qr = QR.URL
except: except:
rec.afip_qr_img = False 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( cae_due = ''.join(
[c for c in str( [c for c in str(
rec.afip_auth_code_due or '') if c.isdigit()]) rec.afip_auth_code_due or '') if c.isdigit()])
......
...@@ -35,6 +35,7 @@ class qrfiscal(): ...@@ -35,6 +35,7 @@ class qrfiscal():
"codAut":codAut, "codAut":codAut,
} }
self.archivo = """/dev/shm/{}.png""".format(self.data["cuit"]) self.archivo = """/dev/shm/{}.png""".format(self.data["cuit"])
#print(self.data)
def GenerarQR(self): def GenerarQR(self):
json_dump = json.dumps(self.data,separators=(',', ':')) json_dump = json.dumps(self.data,separators=(',', ':'))
...@@ -42,7 +43,9 @@ class qrfiscal(): ...@@ -42,7 +43,9 @@ class qrfiscal():
base64_bytes = base64.b64encode(data) base64_bytes = base64.b64encode(data)
base64_message = base64_bytes.decode('ascii') base64_message = base64_bytes.decode('ascii')
URL = """https://www.afip.gob.ar/fe/qr/?p={}""".format(base64_message) URL = """https://www.afip.gob.ar/fe/qr/?p={}""".format(base64_message)
self.URL = json_dump
self.generadorQR(URL) self.generadorQR(URL)
#print(URL)
def generadorQR(self, URL): def generadorQR(self, URL):
qr = qrcode.QRCode(version=1,box_size=2,border=2) qr = qrcode.QRCode(version=1,box_size=2,border=2)
......
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink 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 \ 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 \ No newline at end of file
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!