feat: include CNPJ (digits) in the internal Fiscal client payload
Needed by the Fiscal's searchable client combobox (search by name/code/CNPJ). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
b1f93c2d68
commit
34cc9c75a5
+4
-4
@@ -92,17 +92,17 @@ def listar_clientes_para_fiscal() -> list[dict]:
|
||||
o Fiscal espelha TODOS os clientes (ativos e inativos — inativo continua
|
||||
aparecendo em histórico do lado de lá), nunca só uma página. Payload
|
||||
mínimo: ID é a PK técnica estável (CODIGO é editável, não serve de
|
||||
identidade — mesma razão de FUNCIONARIO_PAINEL.ID no SSO). Sem CNPJ/
|
||||
endereço/contato: o Fiscal não precisa desses campos hoje."""
|
||||
identidade — mesma razão de FUNCIONARIO_PAINEL.ID no SSO). CNPJ (só dígitos) entra só para a busca/identificação no seletor do
|
||||
Fiscal; sem endereço/contato."""
|
||||
conn = get_connection()
|
||||
try:
|
||||
with conn.cursor() as cur:
|
||||
cur.execute(
|
||||
"SELECT ID, CODIGO, COALESCE(NULLIF(FANTASIA, ''), RAZAO) AS NOME, ATIVO "
|
||||
"SELECT ID, CODIGO, CNPJ, COALESCE(NULLIF(FANTASIA, ''), RAZAO) AS NOME, ATIVO "
|
||||
"FROM CLIENTE ORDER BY ID"
|
||||
)
|
||||
return [
|
||||
{"external_client_id": row["ID"], "code": row["CODIGO"], "display_name": row["NOME"], "active": bool(row["ATIVO"])}
|
||||
{"external_client_id": row["ID"], "code": row["CODIGO"], "display_name": row["NOME"], "cnpj": "".join(ch for ch in (row["CNPJ"] or "") if ch.isdigit()) or None, "active": bool(row["ATIVO"])}
|
||||
for row in cur.fetchall()
|
||||
]
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user