Release v4928.1.4.2 stable

This commit is contained in:
2026-06-09 22:55:58 +01:00
commit 6445044ac6
280 changed files with 41775 additions and 0 deletions

109
app/admin_ui/labels.py Normal file
View File

@@ -0,0 +1,109 @@
"""Centralized Portuguese labels for the admin UI.
v4.7.3 keeps business rules unchanged, but moves display labels out of the
route handlers so Operations, Tasks and Opportunities use the same wording.
"""
from __future__ import annotations
from typing import Any
ACTION_LABELS = {
"SEND_INFO": "Enviar informação",
"SEND_QUOTE": "Preparar orçamento",
"SEND_PROFORMA": "Emitir pró-forma",
"SEND_INVOICE": "Emitir fatura",
"CONFIRM_PAYMENT": "Confirmar pagamento",
"CONFIRM_PAYMENT_AND_PREPARE_SHIPMENT": "Confirmar pagamento",
"PREPARE_ORDER": "Preparar encomenda",
"CREATE_SHIPMENT": "Criar envio",
"REVIEW_MANUALLY": "Rever manualmente",
"ASSOCIATE_CUSTOMER": "Associar cliente",
"ASSOCIATE_OPPORTUNITY": "Associar oportunidade",
"MARK_NO_INTEREST": "Marcar sem interesse",
"REMOVE_FROM_LIST": "Remover da lista",
"SUPPORT": "Responder suporte",
"NO_ACTION": "Sem ação",
"IGNORE_SPAM": "Ignorar spam",
}
PRIMARY_ACTION_LABELS = {
"SEND_INFO": "Preparar resposta",
"SEND_QUOTE": "Preparar orçamento",
"SEND_PROFORMA": "Preparar pró-forma",
"SEND_INVOICE": "Emitir fatura",
"CONFIRM_PAYMENT": "Confirmar pagamento",
"CONFIRM_PAYMENT_AND_PREPARE_SHIPMENT": "Confirmar pagamento",
"PREPARE_ORDER": "Preparar encomenda",
"CREATE_SHIPMENT": "Criar envio",
"REVIEW_MANUALLY": "Rever mensagem",
"ASSOCIATE_CUSTOMER": "Associar cliente",
"ASSOCIATE_OPPORTUNITY": "Associar oportunidade",
"MARK_NO_INTEREST": "Marcar sem interesse",
"REMOVE_FROM_LIST": "Remover da lista",
"SUPPORT": "Responder suporte",
}
QUEUE_LABELS = {
"vendas": "Vendas",
"financeiro": "Financeiro",
"operacoes": "Operações",
"operações": "Operações",
"logistica": "Logística",
"logística": "Logística",
"rever": "Revisão",
"revisao": "Revisão",
"revisão": "Revisão",
"suporte": "Suporte",
}
STATUS_LABELS = {
"pending": "Pendente",
"done": "Concluída",
"skipped": "Ignorada",
"failed": "Falhada",
"blocked": "Bloqueada",
"processing": "Em processamento",
"sent": "Enviada",
"dry_run": "Dry-run",
"ignored": "Ignorada",
"cancelled": "Cancelada",
"created": "Criada",
"issued": "Emitida",
"converted": "Convertida",
}
BLOCK_REASON_LABELS = {
"ambiguous_opportunity": "Associação por confirmar",
"missing_customer": "Cliente fiscal em falta",
"missing_product_code": "Produto sem código externo",
"outbox_failed": "Integração falhada",
"payment_confirmation": "Confirmação financeira obrigatória",
}
def normalized_code(value: Any) -> str:
return str(value or "").strip().upper()
def action_label(code: Any, fallback: str = "Ação") -> str:
return ACTION_LABELS.get(normalized_code(code), str(code or fallback))
def primary_action_label(code: Any, fallback: str = "Abrir") -> str:
normalized = normalized_code(code)
return PRIMARY_ACTION_LABELS.get(normalized) or ACTION_LABELS.get(normalized) or str(code or fallback)
def queue_label(queue: Any) -> str:
key = str(queue or "").strip().lower()
return QUEUE_LABELS.get(key, str(queue or ""))
def status_label(status: Any) -> str:
key = str(status or "").strip().lower()
return STATUS_LABELS.get(key, str(status or ""))
def block_reason_label(reason: Any) -> str:
key = str(reason or "").strip().lower()
return BLOCK_REASON_LABELS.get(key, str(reason or "Bloqueio operacional"))