Skip to content

Commit b924dc4

Browse files
authored
Merge pull request #139 from ivannrnt/main
Update Python 3 webservices RG5616 (sync develop) * WSMTX/RECEM: cancela_misma_moneda_ext & condicion_iva_receptor_id * WSBFEv1/RECEB: cancela_misma_moneda_ext & condicion_iva_receptor_id * WSFEXv1/RECEX1: cancela_misma_moneda_ext * WSCT: cancela_misma_moneda_ext * PyFPDF: ampliacion campo precio
2 parents 810bcf8 + 6d13a12 commit b924dc4

10 files changed

Lines changed: 125 additions & 26 deletions

File tree

formatos/formato_txt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
("codigo", 30, A),
109109
("qty", (12, 2), I),
110110
("umed", 2, N),
111-
("precio", (12, 3), I),
111+
("precio", (15, 3), I),
112112
("importe", (14, 3), I),
113113
("iva_id", 5, N),
114114
("ds", 4000, A),
@@ -118,7 +118,7 @@
118118
("imp_iva", 15, I),
119119
("despacho", 20, A),
120120
("u_mtx", 10, N),
121-
("cod_mtx", 30, N),
121+
("cod_mtx", 30, A),
122122
("dato_a", 15, A),
123123
("dato_b", 15, A),
124124
("dato_c", 15, A),

receb1.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
from past.builtins import basestring
2020

2121
__author__ = "Mariano Reingart (reingart@gmail.com)"
22-
__copyright__ = "Copyright (C) 2009-2021 Mariano Reingart"
22+
__copyright__ = "Copyright (C) 2009-2025 Mariano Reingart"
2323
__license__ = "LGPL-3.0-or-later"
24-
__version__ = "3.19a"
24+
__version__ = "3.20a"
2525

2626
import datetime
2727
import os
@@ -81,6 +81,8 @@
8181
("obs", 2, A),
8282
("reproceso", 1, A),
8383
("id", 15, N),
84+
('cancela_misma_moneda_ext', 1, A), # opcional S o N
85+
('condicion_iva_receptor_id', 4, N),
8486
]
8587

8688
DETALLE = [
@@ -362,6 +364,8 @@ def main():
362364
fecha_cbte=fecha,
363365
imp_neto="390.00",
364366
impto_liq="81.90",
367+
cancela_misma_moneda_ext="N",
368+
condicion_iva_receptor_id="1",
365369
)
366370
ws.AgregarItem(
367371
umed=7,

recem.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
from builtins import str
1919

2020
__author__ = "Mariano Reingart (reingart@gmail.com)"
21-
__copyright__ = "Copyright (C) 2011-2021 Mariano Reingart"
21+
__copyright__ = "Copyright (C) 2011-2025 Mariano Reingart"
2222
__license__ = "LGPL-3.0-or-later"
23-
__version__ = "3.34a"
23+
__version__ = "3.35a"
2424

2525
import datetime
2626
import os
@@ -88,6 +88,8 @@
8888
("observaciones", 1000, A), # observaciones (opcional)
8989
("tipo_cbte", 3, N),
9090
("punto_vta", 5, N),
91+
('cancela_misma_moneda_ext', 1, A), # opcional S o N
92+
('condicion_iva_receptor_id', 4, N),
9193
]
9294

9395
DETALLE = [
@@ -475,6 +477,8 @@ def main():
475477
moneda_id = "PES"
476478
moneda_ctz = "1.000"
477479
obs = "Observaciones Comerciales, libre"
480+
cancela_misma_moneda_ext = 'N'
481+
condicion_iva_receptor_id = 1
478482

479483
ws.CrearFactura(
480484
concepto,
@@ -497,6 +501,8 @@ def main():
497501
moneda_id,
498502
moneda_ctz,
499503
obs,
504+
condicion_iva_receptor_id=condicion_iva_receptor_id,
505+
cancela_misma_moneda_ext=cancela_misma_moneda_ext,
500506
)
501507

502508
if tipo_cbte not in (1, 2, 6, 7, 201):

recet.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
from builtins import str
1919

2020
__author__ = "Mariano Reingart (reingart@gmail.com)"
21-
__copyright__ = "Copyright (C) 2017-2021 Mariano Reingart"
21+
__copyright__ = "Copyright (C) 2017-2025 Mariano Reingart"
2222
__license__ = "LGPL-3.0-or-later"
23-
__version__ = "3.01d"
23+
__version__ = "3.02d"
2424

2525
import datetime
2626
import json
@@ -43,7 +43,7 @@
4343

4444
LICENCIA = """
4545
recet.py: Interfaz de texto para generar Facturas Electrónica Turismo
46-
Copyright (C) 2017 Mariano Reingart reingart@gmail.com
46+
Copyright (C) 2025 Mariano Reingart reingart@gmail.com
4747
4848
Este progarma es software libre, se entrega ABSOLUTAMENTE SIN GARANTIA
4949
y es bienvenido a redistribuirlo bajo la licencia GPLv3.
@@ -87,6 +87,7 @@
8787
("reproceso", 1, A),
8888
("emision_tipo", 4, A),
8989
("observaciones", 1000, A), # observaciones (opcional)
90+
('cancela_misma_moneda_ext', 1, A), # opcional S o N
9091
]
9192

9293
DETALLE = [
@@ -461,6 +462,7 @@ def main():
461462
moneda_id = "PES"
462463
moneda_ctz = "1.000"
463464
obs = "Observaciones Comerciales, libre"
465+
cancela_misma_moneda_ext = 'N'
464466

465467
ws.CrearFactura(
466468
tipo_doc,
@@ -483,6 +485,7 @@ def main():
483485
moneda_id,
484486
moneda_ctz,
485487
obs,
488+
cancela_misma_moneda_ext=cancela_misma_moneda_ext
486489
)
487490

488491
tributo_id = 99

recex1.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from builtins import str
1919

2020
__author__ = "Mariano Reingart (reingart@gmail.com)"
21-
__copyright__ = "Copyright (C) 2011-2021 Mariano Reingart"
21+
__copyright__ = "Copyright (C) 2011-2025 Mariano Reingart"
2222
__license__ = "LGPL-3.0-or-later"
2323
__version__ = "3.28c"
2424

@@ -89,6 +89,7 @@
8989
("err_code", 100, A),
9090
("err_msg", 1000, A),
9191
("fecha_pago", 8, A),
92+
('cancela_misma_moneda_ext', 1, A), # opcional S o N
9293
]
9394

9495
DETALLE = [
@@ -489,6 +490,7 @@ def main():
489490
incoterms,
490491
idioma_cbte,
491492
incoterms_ds,
493+
cancela_misma_moneda_ext="N"
492494
)
493495

494496
# Agrego un item:

tests/facturas.txt

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

wsbfev1.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,11 @@ def CrearFactura(
161161
imp_moneda_id=0,
162162
imp_moneda_ctz=1.0,
163163
fecha_venc_pago=None,
164+
cancela_misma_moneda_ext="N",
165+
condicion_iva_receptor_id="1",
164166
**kwargs
165167
):
168+
166169
"Creo un objeto factura (interna)"
167170
# Creo una factura para bonos fiscales electrónicos
168171

@@ -193,6 +196,10 @@ def CrearFactura(
193196
"detalles": [],
194197
}
195198
self.factura = fact
199+
200+
if cancela_misma_moneda_ext: fact['cancela_misma_moneda_ext'] = cancela_misma_moneda_ext
201+
if condicion_iva_receptor_id: fact['condicion_iva_receptor_id'] = condicion_iva_receptor_id
202+
196203
return True
197204

198205
def AgregarItem(
@@ -260,6 +267,8 @@ def Authorize(self, id):
260267
"Imp_iibb": f["imp_iibb"],
261268
"Imp_internos": f["imp_internos"],
262269
"Fecha_vto_pago": f["fecha_venc_pago"],
270+
"CanMisMonExt": f.get("cancela_misma_moneda_ext"),
271+
"CondicionIVAReceptorId": f.get("condicion_iva_receptor_id"),
263272
"Items": [
264273
{
265274
"Item": {
@@ -731,6 +740,8 @@ def main():
731740
imp_moneda_id,
732741
imp_moneda_ctz,
733742
fecha_venc_pago,
743+
cancela_misma_moneda_ext=None,
744+
condicion_iva_receptor_id=None,
734745
)
735746

736747
# Agrego un item:
@@ -862,4 +873,4 @@ def main():
862873
print(wsbfev1.GetParamCtz("DOL"))
863874

864875
if __name__ == "__main__":
865-
main()
876+
main()

wsct.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
from builtins import str
2121

2222
__author__ = "Mariano Reingart <reingart@gmail.com>"
23-
__copyright__ = "Copyright (C) 2017-2021 Mariano Reingart"
23+
__copyright__ = "Copyright (C) 2017-2025 Mariano Reingart"
2424
__license__ = "LGPL-3.0-or-later"
25-
__version__ = "3.02c"
25+
__version__ = "3.03c"
2626

2727
import datetime
2828
import decimal
@@ -195,6 +195,7 @@ def CrearFactura(
195195
moneda_id=None,
196196
moneda_ctz=None,
197197
observaciones=None,
198+
cancela_misma_moneda_ext=None,
198199
**kwargs
199200
):
200201
"Creo un objeto factura (interna)"
@@ -228,6 +229,8 @@ def CrearFactura(
228229
"formas_pago": [],
229230
}
230231

232+
if cancela_misma_moneda_ext is not None: fact['cancela_misma_moneda_ext'] = cancela_misma_moneda_ext
233+
231234
self.factura = fact
232235
return True
233236

@@ -368,7 +371,8 @@ def AutorizarComprobante(self):
368371
"importeReintegro": f["imp_reintegro"],
369372
"fechaEmision": f["fecha_cbte"],
370373
"codigoMoneda": f["moneda_id"],
371-
"cotizacionMoneda": f["moneda_ctz"],
374+
"cotizacionMoneda": f.get["moneda_ctz"],
375+
"cancelaEnMismaMonedaExtranjera": f.get("cancela_misma_moneda_ext"),
372376
"observaciones": f["observaciones"],
373377
"fechaVencimientoPago": f.get("fecha_venc_pago"),
374378
"fechaServicioDesde": f.get("fecha_serv_desde"),
@@ -573,7 +577,7 @@ def ConsultarComprobante(self, tipo_cbte, punto_vta, cbte_nro, reproceso=False):
573577
or None,
574578
"importeSubtotal": f["imp_subtotal"],
575579
"importeReintegro": f["imp_reintegro"],
576-
"codigoMoneda": f["moneda_id"],
580+
"codigoMoneda": f.get["moneda_id"],
577581
"cotizacionMoneda": str(decimal.Decimal(str(f["moneda_ctz"]))),
578582
"arrayItems": [
579583
{
@@ -770,15 +774,15 @@ def ConsultarTiposTributo(self):
770774
]
771775

772776
@inicializar_y_capturar_excepciones
773-
def ConsultarCotizacion(self, moneda_id):
777+
def ConsultarCotizacion(self, moneda_id, fecha_cotizacion=None):
774778
"Este método permite consultar los tipos de comprobantes habilitados en este WS"
775779
ret = self.client.consultarCotizacion(
776780
authRequest={
777781
"token": self.Token,
778782
"sign": self.Sign,
779783
"cuitRepresentada": self.Cuit,
780784
},
781-
codigoMoneda=moneda_id,
785+
codigoMoneda=moneda_id,FchCotiz=fecha_cotizacion,
782786
)
783787
self.__analizar_errores(ret)
784788
if "cotizacionMoneda" in ret:
@@ -1047,6 +1051,7 @@ def main():
10471051
moneda_id,
10481052
moneda_ctz,
10491053
obs,
1054+
cancela_misma_moneda_ext='N',
10501055
)
10511056

10521057
tributo_id = 99

wsfexv1.py

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
from builtins import str
2222

2323
__author__ = "Mariano Reingart (reingart@gmail.com)"
24-
__copyright__ = "Copyright (C) 2011-2023 Mariano Reingart"
24+
__copyright__ = "Copyright (C) 2011-2025 Mariano Reingart"
2525
__license__ = "LGPL-3.0-or-later"
26-
__version__ = "3.11a"
26+
__version__ = "3.12a"
2727

2828
import datetime
2929
import decimal
@@ -163,6 +163,7 @@ def CrearFactura(
163163
idioma_cbte=7,
164164
incoterms_ds=None,
165165
fecha_pago=None,
166+
cancela_misma_moneda_ext=None,
166167
**kwargs
167168
):
168169
"Creo un objeto factura (interna)"
@@ -196,6 +197,9 @@ def CrearFactura(
196197
"detalles": [],
197198
"actividades": [],
198199
}
200+
201+
if cancela_misma_moneda_ext: fact['cancela_misma_moneda_ext'] = cancela_misma_moneda_ext
202+
199203
self.factura = fact
200204

201205
return True
@@ -278,6 +282,7 @@ def Authorize(self, id):
278282
"Id_impositivo": f["id_impositivo"],
279283
"Moneda_Id": f["moneda_id"],
280284
"Moneda_ctz": f["moneda_ctz"],
285+
'CanMisMonExt': f.get('cancela_misma_moneda_ext'),
281286
"Obs_comerciales": f["obs_comerciales"],
282287
"Imp_total": f["imp_total"],
283288
"Obs": f["obs_generales"],
@@ -818,6 +823,29 @@ def GetParamActividades(self, sep="|"):
818823
else:
819824
return ret
820825

826+
@inicializar_y_capturar_excepciones
827+
def GetParamActividades(self, sep="|"):
828+
"Recuperar lista de valores referenciales de c�digos de Idiomas"
829+
ret = self.client.FEXGetPARAM_Actividades(
830+
Auth={'Token': self.Token, 'Sign': self.Sign, 'Cuit': self.Cuit, })
831+
result = ret['FEXGetPARAM_ActividadesResult']
832+
self.__analizar_errores(result)
833+
834+
ret = []
835+
for u in result.get('FEXResultGet', []):
836+
u = u['ClsFEXResponse_ActividadTipo']
837+
try:
838+
r = {'codigo': u.get('Id'), 'ds': u.get('Desc'),
839+
'orden': u.get('Orden'), }
840+
except Exception as e:
841+
print(e)
842+
843+
ret.append(r)
844+
if sep:
845+
return [("\t%(codigo)s\t%(ds)s\t%(orden)s\t"
846+
% it).replace("\t", sep) for it in ret]
847+
else:
848+
return ret
821849

822850
class WSFEX(WSFEXv1):
823851
"Wrapper para retrocompatibilidad con WSFEX"
@@ -953,7 +981,7 @@ def main():
953981
incoterms,
954982
idioma_cbte,
955983
incoterms_ds,
956-
fecha_pago,
984+
fecha_pago,cancela_misma_moneda_ext="N",
957985
)
958986

959987
# Agrego un item:
@@ -989,7 +1017,11 @@ def main():
9891017
cbteasoc_tipo, cbteasoc_pto_vta, cbteasoc_nro, cbteasoc_cuit
9901018
)
9911019

992-
ok = wsfexv1.AgregarActividad(1234)
1020+
##id = "99000000000100" # n�mero propio de transacci�n
1021+
# obtengo el �ltimo ID y le adiciono 1
1022+
# (advertencia: evitar overflow y almacenar!)
1023+
id = long(wsfexv1.GetLastID()) + 1
1024+
ok = wsfexv1.AgregarActividad(1234)
9931025

9941026
##id = "99000000000100" # número propio de transacción
9951027
# obtengo el último ID y le adiciono 1

0 commit comments

Comments
 (0)