How cyam12/ropusac_2026 works
Purpose and Runtime
ROPUSAC is a server-rendered Flask business-management system for users, suppliers, customers, products, sale prices, quotations, sales, and electronic receipts. The executable entry point is run.py; application setup and extensions are centralized in app/__init__.py and app/extensiones.py. It runs on Python/Flask with Bootstrap templates.
HTTP Application Boundary
Route modules form the primary controller layer, separating workflows by role and domain. Authentication starts in app/rutas/autenticacion.py; the landing/dashboard flow is in app/rutas/dashboard.py. Role-specific route partitions support administrator, commercial area, and seller experiences, e.g. app/rutas/administrador.py, app/rutas/productos_comercial.py, and app/rutas/productos_vendedor.py. HTML is rendered from corresponding template trees under app/plantillas/.
Identity, Roles, and Authorization
Users, roles, permissions, and role-permission assignments define access control: app/modelos/usuario.py, app/modelos/rol.py, and app/modelos/permiso.py. Route-level authorization behavior is likely enforced through reusable decorators in app/utilidades/decoradores.py. This establishes a boundary between authentication/authorization and domain routes, with distinct UIs for administrator, commercial, and seller roles.
Commercial Master Data and Pricing
Products and suppliers are managed through dedicated models and route surfaces: app/modelos/producto.py, app/modelos/proveedor.py, and app/rutas/productos.py. Product pricing is tracked historically through app/modelos/historial_precio_base.py and app/modelos/historial_precio_venta.py, exposed in pricing route modules such as app/rutas/precios_venta.py. Product image and import capabilities are represented by app/modelos/imagen_producto.py and app/modelos/importacion_producto.py.
Customer-to-Document Transaction Flow
The core commercial flow begins with customer records (app/modelos/cliente.py), creates quotations with line items (app/modelos/cotizacion.py, app/modelos/detalle_cotizacion.py), and tracks quotation status transitions (app/modelos/historial_estado_cotizacion.py). Sales and their lines are persisted in app/modelos/venta.py and app/modelos/detalle_venta.py; electronic receipts are represented by app/modelos/boleta.py. Seller quotation and receipt workflows are handled by app/rutas/cotizaciones_vendedor.py and app/rutas/boletas_vendedor.py.
Persistence and Operational Audit
PostgreSQL is accessed via SQLAlchemy, with schema evolution managed by Flask-Migrate/Alembic. The canonical migration chain is under migrations/versions/, beginning at migrations/versions/0001_baseline_ropusac.py; a legacy/initial SQL schema also exists at SQL/esquema_inicial_ropusac.sql. Operational/API activity is modeled separately via app/modelos/bitacora_operacion.py and app/modelos/registro_api.py, indicating auditability around business actions and integrations.
Integrations and Deployment
External-service adapters are isolated under app/servicios/: electronic invoicing through app/servicios/nubefact.py, email through app/servicios/correo.py, PDF quotation generation through app/servicios/pdf_cotizacion.py, and product-image hosting through app/servicios/imgbb.py. Additional API, geocoding, and exchange-rate integrations appear in app/servicios/apis_net.py, app/servicios/geoapify.py, and app/servicios/exchange_rate.py; integration endpoints are grouped in app/rutas/integraciones.py. Credentials and database configuration are environment-driven via .env.example and config.py. Deployment targets are Render for the Flask application and Neon PostgreSQL for persistence.
Main entry points: administrador.py Role and domain routes · __init__.py App setup · cotizaciones_vendedor.py Seller documents · autenticacion.py Authentication
Components 18
Flask runtime
- Application entry
run.py - App setup · Centralizes application initialization and extensions.
app/__init__.py - Extensions
app/extensiones.py
HTTP and UI
- Authentication
app/rutas/autenticacion.py - Role and domain routes · Administrator, commercial, seller, product, dashboard, and integration workflows.
app/rutas/administrador.py - Seller documents · Quotation and receipt workflows for sellers.
app/rutas/cotizaciones_vendedor.py - Server-rendered UI
Business domain
- Identity and access control
app/modelos/usuario.py - Authorization decorators
app/utilidades/decoradores.py - Catalog and suppliers · Products, suppliers, images, imports, and price history.
app/modelos/producto.py - Sale pricing
app/modelos/historial_precio_venta.py - Quotations · Quotation lines and status history.
app/modelos/cotizacion.py - Sales and receipts · Sales, line items, and electronic receipts.
app/modelos/venta.py
Persistence and audit
- Neon PostgreSQL
- Schema migrations
migrations/versions/0001_baseline_ropusac.py - Operational audit
app/modelos/bitacora_operacion.py
External services
- Document services · Electronic invoicing, email delivery, and quotation PDFs.
app/servicios/nubefact.py - External API adapters
app/servicios/apis_net.py
Connections 25
- Application entry → App setup: starts
- App setup → Extensions: initializes
- App setup → Authentication: registers
- App setup → Role and domain routes: registers
- App setup → Seller documents: registers
- Authentication → Identity and access control: authenticates
- Role and domain routes → Authorization decorators: guards with
- Authorization decorators → Identity and access control: checks
- Authentication → Server-rendered UI: renders
- Role and domain routes → Server-rendered UI: renders
- Seller documents → Server-rendered UI: renders
- Role and domain routes → Catalog and suppliers: manages
- Role and domain routes → Sale pricing: maintains
- Seller documents → Quotations: creates and updates
- Seller documents → Sales and receipts: records
- Quotations → Sales and receipts: converts to
- Catalog and suppliers → Neon PostgreSQL: persists
- Identity and access control → Neon PostgreSQL: persists
- Quotations → Neon PostgreSQL: persists
- Sales and receipts → Neon PostgreSQL: persists
- Schema migrations → Neon PostgreSQL: evolves schema
- Role and domain routes → Operational audit: records activity
- Seller documents → Document services: generates and sends
- Document services → Operational audit: logs API activity
- Role and domain routes → External API adapters: uses