fix(opportunity-flow): wait after sent quote until payment evidence
This commit is contained in:
@@ -333,18 +333,34 @@ def decide_blif_next_action(e: OpportunityEvidence, profile: CompanyWorkflowProf
|
||||
)
|
||||
|
||||
# Default/BLIF normal sequence: budget document, payment, invoice, then preparation/shipping.
|
||||
if e.payment_terms in {PAYMENT_BEFORE_SHIPPING, "", "undefined", "agreement"} and e.has_quote and not e.payment_confirmed:
|
||||
if (
|
||||
e.payment_terms in {PAYMENT_BEFORE_SHIPPING, "", "undefined", "agreement"}
|
||||
and e.has_quote
|
||||
and e.quote_sent
|
||||
and not e.has_invoice
|
||||
and not e.payment_confirmed
|
||||
):
|
||||
next_action = _action(
|
||||
profile,
|
||||
ACTION_CONFIRM_PAYMENT,
|
||||
f"Orçamento {e.quote_number or ''} associado. Confirmar pagamento antes de emitir fatura.",
|
||||
priority="alta",
|
||||
ACTION_NO_ACTION,
|
||||
f"Orçamento {e.quote_number or ''} enviado. Aguardar decisão do cliente ou evidência de pagamento.",
|
||||
force_label="Aguardar cliente / pagamento",
|
||||
target_url=f"/opportunities/{e.opportunity_id}#operacao" if e.opportunity_id else None,
|
||||
document_id=e.quote_id,
|
||||
document_number=e.quote_number,
|
||||
)
|
||||
available_actions.append(next_action)
|
||||
return OpportunityDecision(next_action, "Fluxo normal BLIF exige pagamento confirmado depois do orçamento e antes da fatura.", available_actions=available_actions, warnings=warnings, commercial_stage=COMMERCIAL_STAGE_WAITING_PAYMENT, financial_state=_financial_state(e), physical_state=_physical_state(e), profile_name=profile.name, decision_version=profile.version)
|
||||
return OpportunityDecision(
|
||||
next_action,
|
||||
"O orçamento foi enviado e ainda não existe evidência de pagamento que exija validação. "
|
||||
"Aguardar o cliente; o follow-up comercial assume quando ficar devido.",
|
||||
warnings=warnings,
|
||||
commercial_stage=COMMERCIAL_STAGE_WAITING_PAYMENT,
|
||||
financial_state=_financial_state(e),
|
||||
physical_state=_physical_state(e),
|
||||
profile_name=profile.name,
|
||||
decision_version=profile.version,
|
||||
)
|
||||
|
||||
|
||||
if e.payment_confirmed and not e.has_invoice and (
|
||||
not e.has_fiscal_customer or not e.fiscal_data_complete
|
||||
|
||||
Reference in New Issue
Block a user