fix: deduplicate reconciliation loose items
This commit is contained in:
@@ -2547,8 +2547,11 @@ def _record_reconciliation_decision(
|
||||
logger.warning("failed to record reconciliation decision %s: %s", decision_type, exc)
|
||||
|
||||
|
||||
def list_reconciliation_process_candidates(*, status: str = "open", days: int = 3, limit: int = 20) -> List[Dict[str, Any]]:
|
||||
"""Return grouped process candidates built from recent open items.
|
||||
def list_reconciliation_process_candidates(
|
||||
*, status: str = "open", external_type: Optional[str] = None,
|
||||
days: int = 3, limit: int = 20,
|
||||
) -> List[Dict[str, Any]]:
|
||||
"""Return process candidates built from items eligible in the active filter.
|
||||
|
||||
A candidate is shown when at least two pieces of evidence share the same
|
||||
NIF/email/name, when one item already has a strong open-operation
|
||||
@@ -2556,7 +2559,10 @@ def list_reconciliation_process_candidates(*, status: str = "open", days: int =
|
||||
(for example an Odoo sale order without ClientFlow).
|
||||
"""
|
||||
try:
|
||||
items = list_reconciliation_items(status=status, limit=300, days=days)
|
||||
item_filters: Dict[str, Any] = {"status": status, "limit": 300, "days": days}
|
||||
if external_type:
|
||||
item_filters["external_type"] = external_type
|
||||
items = list_reconciliation_items(**item_filters)
|
||||
except Exception as exc: # pragma: no cover - production safety guard
|
||||
logger.warning("failed to list reconciliation items for process candidates: %s", exc)
|
||||
return []
|
||||
|
||||
Reference in New Issue
Block a user