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
+11
-4
@@ -1,6 +1,12 @@
|
||||
import pdfplumber
|
||||
import os
|
||||
import re
|
||||
import unicodedata
|
||||
|
||||
|
||||
def _sin_tildes(texto: str) -> str:
|
||||
"""Quita tildes/diacríticos para comparaciones tolerantes a variaciones de formato."""
|
||||
return "".join(c for c in unicodedata.normalize("NFKD", texto) if not unicodedata.combining(c))
|
||||
|
||||
|
||||
TIPO_MAP = {
|
||||
@@ -53,13 +59,14 @@ def _extract_base_data(text: str, pdf_path: str) -> dict:
|
||||
if standalone_ruc:
|
||||
data["ruc_emisor"] = standalone_ruc.group(1)
|
||||
|
||||
if "FACTURA ELECTRÓNICA" in text.upper():
|
||||
text_norm = _sin_tildes(text.upper())
|
||||
if "FACTURA ELECTRONICA" in text_norm:
|
||||
data["tipo_documento"] = "FACTURA"
|
||||
elif "BOLETA DE VENTA" in text.upper():
|
||||
elif "BOLETA DE VENTA" in text_norm:
|
||||
data["tipo_documento"] = "BOLETA"
|
||||
elif "TRANSPORTISTA" in text.upper() and "GUÍA DE REMISIÓN" in text.upper():
|
||||
elif "TRANSPORTISTA" in text_norm and "GUIA DE REMISION" in text_norm:
|
||||
data["tipo_documento"] = "GUIA DE REMISION TRANSPORTISTA"
|
||||
elif "GUÍA DE REMISIÓN" in text.upper() or "GRRE:" in text.upper():
|
||||
elif "GUIA DE REMISION" in text_norm or "GRRE:" in text_norm:
|
||||
data["tipo_documento"] = "GUIA DE REMISION"
|
||||
|
||||
serie_numero_match = re.search(r"(?:N°\s*)?([A-Z0-9]{4})\s*-\s*(\d+)", text)
|
||||
|
||||
Reference in new issue
Block a user