feat(invoice+import): refresh facturi, detalii factura, fix duplicate CODMAT + rollback
- PL/SQL: handle duplicate CODMAT in nom_articole with MAX(id_articol) - import_service: add explicit conn.rollback() on Oracle errors - sync_service: auto-fix stale ERROR orders that exist in Oracle - invoice_service: add data_act (invoice date) from vanzari table - sync router: new POST /api/dashboard/refresh-invoices endpoint - order detail: enrich with invoice data (serie, numar, data factura) - dashboard: refresh invoices button (desktop + mobile icon) - quick map modal: compact single-row layout, pre-populate existing mappings - quick map: link on SKU column instead of CODMAT Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -759,7 +759,8 @@ async def get_uninvoiced_imported_orders() -> list:
|
||||
|
||||
async def update_order_invoice(order_number: str, serie: str = None,
|
||||
numar: str = None, total_fara_tva: float = None,
|
||||
total_tva: float = None, total_cu_tva: float = None):
|
||||
total_tva: float = None, total_cu_tva: float = None,
|
||||
data_act: str = None):
|
||||
"""Cache invoice data from Oracle onto the order record."""
|
||||
db = await get_sqlite()
|
||||
try:
|
||||
@@ -770,10 +771,11 @@ async def update_order_invoice(order_number: str, serie: str = None,
|
||||
factura_total_fara_tva = ?,
|
||||
factura_total_tva = ?,
|
||||
factura_total_cu_tva = ?,
|
||||
factura_data = ?,
|
||||
invoice_checked_at = datetime('now'),
|
||||
updated_at = datetime('now')
|
||||
WHERE order_number = ?
|
||||
""", (serie, numar, total_fara_tva, total_tva, total_cu_tva, order_number))
|
||||
""", (serie, numar, total_fara_tva, total_tva, total_cu_tva, data_act, order_number))
|
||||
await db.commit()
|
||||
finally:
|
||||
await db.close()
|
||||
|
||||
Reference in New Issue
Block a user