se agrega fallback OWTR y calculo de fecha de vencimiento por condicion de pago
- hana_manager.get_delivery ahora busca en ODLN y, si no encuentra, en OWTR - sapb1_manager resuelve StockTransfers -> Orders (via U_IDC_NUMOV) para validar precios de flete cuando la guia es un traslado de inventario - se corrige el orden de parametros tipo/serie/numero (sin cruces) en get_delivery, get_delivery_notes y _get_delivery_entries - se agrega sapb1_manager.obtener_condicion_pago (BusinessPartners + PaymentTermsTypes) y pipeline._calcular_fecha_vencimiento para que DocDueDate del draft sea fecha de contabilizacion + dias de la condicion de pago del proveedor - se agrega variante de regex para "VALOR REFER" truncado en sunat_schema.py - se actualiza documentacion (docs/) reflejando estos cambios Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6b0ed6f519
commit
15e3b5079c
231 files changed
+21421
-475
No files matched your search
@@ -0,0 +1,49 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||
|
||||
from sunat_schema import NAMESPACES, _find_text
|
||||
|
||||
ns = NAMESPACES
|
||||
ns["cbc"] = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
|
||||
|
||||
CARPETA_BASE = os.path.join(os.path.dirname(__file__), "correos_prueba")
|
||||
|
||||
|
||||
def explorar_notes(ruta_carpeta):
|
||||
archivos = sorted(
|
||||
os.path.join(ruta_carpeta, f) for f in os.listdir(ruta_carpeta)
|
||||
if f.lower().endswith(".xml") and os.path.isfile(os.path.join(ruta_carpeta, f))
|
||||
)
|
||||
|
||||
for xml_path in archivos:
|
||||
tree = ET.parse(xml_path)
|
||||
root = tree.getroot()
|
||||
|
||||
if "Invoice" not in root.tag:
|
||||
continue
|
||||
|
||||
tipo = _find_text(root, "inv:InvoiceTypeCode", ns) or _find_text(root, "cbc:InvoiceTypeCode", ns) or ""
|
||||
if tipo != "01":
|
||||
continue
|
||||
|
||||
print(f"\n=== {os.path.basename(xml_path)} ===")
|
||||
lineas = root.findall(".//cac:InvoiceLine", ns)
|
||||
for i, linea in enumerate(lineas):
|
||||
notes = linea.findall("cbc:Note", ns)
|
||||
desc = _find_text(linea, "cac:Item/cbc:Description", ns) or ""
|
||||
print(f" Línea {i}: Description={desc[:80]}...")
|
||||
for note in notes:
|
||||
print(f" Note[{note.attrib.get('languageLocaleID', '?')}]: {note.text}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
carpeta = sys.argv[1] if len(sys.argv) > 1 else "001_correo"
|
||||
ruta = os.path.join(CARPETA_BASE, carpeta)
|
||||
if os.path.isdir(ruta):
|
||||
explorar_notes(ruta)
|
||||
else:
|
||||
print(f"❌ Carpeta no encontrada: {ruta}")
|
||||
Reference in new issue
Block a user