feat: Fase 1-3 completas - precios proveedor, multi-sucursal, factura global

Fase 1: Lista de precios de proveedor
- Tabla supplier_catalog_prices en master DB
- Endpoints GET/POST/PUT/DELETE /supplier-catalog/prices
- Upload CSV/Excel de precios de proveedor
- Visualizacion de supplier_price en catalogo y POS

Fase 2: Multi-sucursal completo
- Migracion v4.0: inventory.branch_id=NULL, tabla inventory_stock
- Campos fiscales en branches (RFC, regimen, CP, serie CFDI, certificados)
- Trigger trg_update_inventory_stock para sincronizar stock por sucursal
- Backend config_bp.py con CRUD de sucursales fiscales
- Backend inventory_bp.py y pos_bp.py refactorizados para inventario compartido
- Backend invoicing_bp.py usa datos fiscales de la sucursal de la venta
- Frontend config.html/js con modal de sucursales expandido

Fase 3: Factura global mensual
- Migracion v4.1: tablas global_invoice_sales, sales.global_invoiced_at
- build_global_invoice_xml() con InformacionGlobal SAT-compliant
- Servicio global_invoice.py para agrupar ventas PUE <=000
- Endpoints POST/GET /global-invoice y /global-invoice/eligible-sales
- Frontend invoicing.html/js con boton y modal de factura global
This commit is contained in:
2026-06-11 08:59:56 +00:00
parent ea29cc31c0
commit 2b73c2c6db
23 changed files with 1665 additions and 230 deletions

View File

@@ -259,7 +259,7 @@ def main():
# Prepare UPSERT statements
upsert_catalog_sql = """
INSERT INTO supplier_catalog (supplier_name, sku, name, category)
VALUES (%s, %s, %s, %s, %s)
VALUES (%s, %s, %s, %s)
ON CONFLICT (supplier_name, sku, category) DO UPDATE SET
name = EXCLUDED.name,
category = EXCLUDED.category
@@ -311,8 +311,8 @@ def main():
continue
sku = str(row[1]).strip()
name = str(row[14]).strip() if row[14] else ''
vehicle_raw = str(row[15]).strip() if row[15] else ''
name = str(row[14]).strip().replace('\n', ' ').replace('\r', '') if row[14] else ''
vehicle_raw = str(row[15]).strip().replace('\n', ' ').replace('\r', '') if row[15] else ''
if not sku or not name:
continue