Commit df5561a7 by adrian

listo para las primeras pruebas

1 parent 42bc81a6
......@@ -25,7 +25,7 @@
# always loaded
'data': [
# 'security/ir.model.access.csv',
'security/ir.model.access.csv',
'views/referencias.xml',
'views/comprobante.xml',
],
......
......@@ -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()])
......
......@@ -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)
......
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
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!