Fix pay invoice in other currencies
This commit is contained in:
parent
93e64eafd8
commit
968c2744ec
|
@ -7616,7 +7616,6 @@ class CfdiPagos(BaseModel):
|
|||
|
||||
return impuestos
|
||||
|
||||
# ~ Revisar Pagos
|
||||
def _get_related_xml(self, id_mov, currency):
|
||||
TAX_IVA_16 = '002|0.160000'
|
||||
|
||||
|
@ -7626,8 +7625,7 @@ class CfdiPagos(BaseModel):
|
|||
Facturas.serie.alias('Serie'),
|
||||
Facturas.folio.alias('Folio'),
|
||||
Facturas.moneda.alias('MonedaDR'),
|
||||
FacturasPagos.tipo_cambio.alias('TipoCambioDR'),
|
||||
# ~ Facturas.metodo_pago.alias('MetodoDePagoDR'),
|
||||
FacturasPagos.tipo_cambio.alias('EquivalenciaDR'),
|
||||
FacturasPagos.numero.alias('NumParcialidad'),
|
||||
FacturasPagos.saldo_anterior.alias('ImpSaldoAnt'),
|
||||
FacturasPagos.importe.alias('ImpPagado'),
|
||||
|
@ -7640,15 +7638,15 @@ class CfdiPagos(BaseModel):
|
|||
|
||||
for r in related:
|
||||
r['taxes'] = self._get_taxes_by_pay(self, r, taxes_pay)
|
||||
# ~ print('\n\nMONEDA', currency, r['MonedaDR'])
|
||||
r['IdDocumento'] = str(r['IdDocumento'])
|
||||
r['Folio'] = str(r['Folio'])
|
||||
r['NumParcialidad'] = str(r['NumParcialidad'])
|
||||
r['TipoCambioDR'] = FORMAT6.format(r['TipoCambioDR'])
|
||||
# ~ r['MetodoDePagoDR'] = DEFAULT_CFDIPAY['WAYPAY']
|
||||
|
||||
# REVISAR
|
||||
equivalencia = r['EquivalenciaDR']
|
||||
if currency == r['MonedaDR']:
|
||||
r['EquivalenciaDR'] = '1'
|
||||
else:
|
||||
r['EquivalenciaDR'] = FORMAT6.format(equivalencia)
|
||||
|
||||
r['ObjetoImpDR'] = '01'
|
||||
if r['taxes']['traslados'] or r['taxes']['retenciones']:
|
||||
|
@ -7660,8 +7658,7 @@ class CfdiPagos(BaseModel):
|
|||
r['ImpSaldoInsoluto'] = '0.00'
|
||||
else:
|
||||
r['ImpSaldoInsoluto'] = FORMAT.format(r['ImpSaldoInsoluto'])
|
||||
if currency == r['MonedaDR']:
|
||||
del r['TipoCambioDR']
|
||||
|
||||
if not r['Serie']:
|
||||
del r['Serie']
|
||||
|
||||
|
@ -7678,6 +7675,10 @@ class CfdiPagos(BaseModel):
|
|||
tax_tasa = taxes_pay['traslados'][k]['TasaOCuotaP']
|
||||
tax_base = taxes_pay['traslados'][k]['BaseP']
|
||||
importe = taxes_pay['traslados'][k]['ImporteP']
|
||||
|
||||
tax_base /= equivalencia
|
||||
importe /= equivalencia
|
||||
|
||||
if f'{tax_type}|{tax_tasa}' == TAX_IVA_16:
|
||||
total_tax_iva_16_base += tax_base
|
||||
total_tax_iva_16_importe += importe
|
||||
|
@ -7913,6 +7914,7 @@ class CfdiPagos(BaseModel):
|
|||
target = emisor.rfc + '/' + str(obj.fecha)[:7].replace('-', '/')
|
||||
values = cls._get_not_in_xml(cls, obj, emisor)
|
||||
data = util.get_data_from_xml(obj, values)
|
||||
data.update(utils.CfdiToDict(obj.xml).values)
|
||||
data['informacion_global'] = {}
|
||||
|
||||
obj = SATFormaPago.get(SATFormaPago.key==data['pays']['FormaDePagoP'])
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue