Fix in tax object 04
This commit is contained in:
commit
602467c8e9
|
@ -5777,6 +5777,9 @@ class Facturas(BaseModel):
|
||||||
|
|
||||||
rows = FacturasDetalle.select().where(FacturasDetalle.factura==invoice)
|
rows = FacturasDetalle.select().where(FacturasDetalle.factura==invoice)
|
||||||
for row in rows:
|
for row in rows:
|
||||||
|
|
||||||
|
object_tax = row.producto.objeto_impuesto
|
||||||
|
|
||||||
if is_global:
|
if is_global:
|
||||||
key_sat = row.clave_sat
|
key_sat = row.clave_sat
|
||||||
key = row.clave
|
key = row.clave
|
||||||
|
@ -5830,49 +5833,50 @@ class Facturas(BaseModel):
|
||||||
else:
|
else:
|
||||||
product_taxes = row.producto.impuestos
|
product_taxes = row.producto.impuestos
|
||||||
|
|
||||||
for impuesto in product_taxes:
|
if object_tax == '02':
|
||||||
base = float(row.importe - row.descuento)
|
for impuesto in product_taxes:
|
||||||
if is_global:
|
base = float(row.importe - row.descuento)
|
||||||
base = float(impuesto.base)
|
if is_global:
|
||||||
impuesto = impuesto.impuesto
|
base = float(impuesto.base)
|
||||||
|
impuesto = impuesto.impuesto
|
||||||
|
|
||||||
if impuesto.tipo == 'E':
|
if impuesto.tipo == 'E':
|
||||||
|
tax = {
|
||||||
|
'Base': FORMAT.format(base),
|
||||||
|
'Impuesto': '002',
|
||||||
|
'TipoFactor': 'Exento',
|
||||||
|
}
|
||||||
|
traslados.append(tax)
|
||||||
|
base_iva_exento += base
|
||||||
|
continue
|
||||||
|
|
||||||
|
if impuesto.key == '000':
|
||||||
|
continue
|
||||||
|
|
||||||
|
tasa = float(impuesto.tasa)
|
||||||
|
|
||||||
|
if tax_decimals:
|
||||||
|
import_tax = round(tasa * base, DECIMALES_TAX)
|
||||||
|
tmp += import_tax
|
||||||
|
xml_importe = FORMAT_TAX.format(import_tax)
|
||||||
|
else:
|
||||||
|
import_tax = round(tasa * base, DECIMALES)
|
||||||
|
xml_importe = FORMAT.format(import_tax)
|
||||||
|
|
||||||
|
tipo_factor = 'Tasa'
|
||||||
|
if impuesto.factor != 'T':
|
||||||
|
tipo_factor = 'Cuota'
|
||||||
tax = {
|
tax = {
|
||||||
'Base': FORMAT.format(base),
|
"Base": FORMAT.format(base),
|
||||||
'Impuesto': '002',
|
"Impuesto": impuesto.key,
|
||||||
'TipoFactor': 'Exento',
|
"TipoFactor": tipo_factor,
|
||||||
|
"TasaOCuota": str(impuesto.tasa),
|
||||||
|
"Importe": xml_importe,
|
||||||
}
|
}
|
||||||
traslados.append(tax)
|
if impuesto.tipo == 'T':
|
||||||
base_iva_exento += base
|
traslados.append(tax)
|
||||||
continue
|
else:
|
||||||
|
retenciones.append(tax)
|
||||||
if impuesto.key == '000':
|
|
||||||
continue
|
|
||||||
|
|
||||||
tasa = float(impuesto.tasa)
|
|
||||||
|
|
||||||
if tax_decimals:
|
|
||||||
import_tax = round(tasa * base, DECIMALES_TAX)
|
|
||||||
tmp += import_tax
|
|
||||||
xml_importe = FORMAT_TAX.format(import_tax)
|
|
||||||
else:
|
|
||||||
import_tax = round(tasa * base, DECIMALES)
|
|
||||||
xml_importe = FORMAT.format(import_tax)
|
|
||||||
|
|
||||||
tipo_factor = 'Tasa'
|
|
||||||
if impuesto.factor != 'T':
|
|
||||||
tipo_factor = 'Cuota'
|
|
||||||
tax = {
|
|
||||||
"Base": FORMAT.format(base),
|
|
||||||
"Impuesto": impuesto.key,
|
|
||||||
"TipoFactor": tipo_factor,
|
|
||||||
"TasaOCuota": str(impuesto.tasa),
|
|
||||||
"Importe": xml_importe,
|
|
||||||
}
|
|
||||||
if impuesto.tipo == 'T':
|
|
||||||
traslados.append(tax)
|
|
||||||
else:
|
|
||||||
retenciones.append(tax)
|
|
||||||
|
|
||||||
if traslados:
|
if traslados:
|
||||||
taxes['traslados'] = traslados
|
taxes['traslados'] = traslados
|
||||||
|
|
Loading…
Reference in New Issue