Fix in tax object 04
This commit is contained in:
parent
51daf0ad5e
commit
4020237f68
|
@ -5777,6 +5777,9 @@ class Facturas(BaseModel):
|
|||
|
||||
rows = FacturasDetalle.select().where(FacturasDetalle.factura==invoice)
|
||||
for row in rows:
|
||||
|
||||
object_tax = row.producto.objeto_impuesto
|
||||
|
||||
if is_global:
|
||||
key_sat = row.clave_sat
|
||||
key = row.clave
|
||||
|
@ -5830,49 +5833,50 @@ class Facturas(BaseModel):
|
|||
else:
|
||||
product_taxes = row.producto.impuestos
|
||||
|
||||
for impuesto in product_taxes:
|
||||
base = float(row.importe - row.descuento)
|
||||
if is_global:
|
||||
base = float(impuesto.base)
|
||||
impuesto = impuesto.impuesto
|
||||
if object_tax == '02':
|
||||
for impuesto in product_taxes:
|
||||
base = float(row.importe - row.descuento)
|
||||
if is_global:
|
||||
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 = {
|
||||
'Base': FORMAT.format(base),
|
||||
'Impuesto': '002',
|
||||
'TipoFactor': 'Exento',
|
||||
"Base": FORMAT.format(base),
|
||||
"Impuesto": impuesto.key,
|
||||
"TipoFactor": tipo_factor,
|
||||
"TasaOCuota": str(impuesto.tasa),
|
||||
"Importe": xml_importe,
|
||||
}
|
||||
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 = {
|
||||
"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 impuesto.tipo == 'T':
|
||||
traslados.append(tax)
|
||||
else:
|
||||
retenciones.append(tax)
|
||||
|
||||
if traslados:
|
||||
taxes['traslados'] = traslados
|
||||
|
|
Loading…
Reference in New Issue