feat(orders): add order/item duplicate-detection fields to Order type

This commit is contained in:
Dave 2026-08-30 22:22:34 +02:00
parent d32d71f55b
commit d0f24dd299

View file

@ -669,6 +669,37 @@ export interface Order extends BaseRecord {
* orders-service.ts:253). delivery_note_number is immutable once
* assigned, so copying carries no staleness risk. */
potential_delivery_note_number?: string;
/**
* Relation to another order sharing the exact same `order_number`,
* of any status, no time limit. Set by
* suggestOrderNumberDuplicate (order-number-duplicate-link-service.ts).
* Visibility only — free-text custom order numbers (customer PO
* refs, "NO-REF" placeholders) are allowed to repeat by design; this
* flag exists so the operator can eyeball whether a given repeat was
* intentional.
*/
order_number_duplicate?: string;
/** True once suggestOrderNumberDuplicate has run for this order —
* distinguishes "checked, no match" from "never checked." */
order_number_duplicate_checked?: boolean;
/**
* Relation to another order whose line items (description +
* quantity) exactly match this order's, for the same company,
* within the last 60 days, regardless of either order's status. Set
* by suggestOrderDuplicate (order-order-duplicate-link-service.ts).
* Visibility only.
*/
potential_duplicate_order?: string;
/** Denormalized copy of the matched order's order_number — same
* reasoning as potential_delivery_note_number: lets the list pill
* render without a second expand. */
potential_duplicate_order_number?: string;
/** 1 if potential_duplicate_order is set, 0 otherwise. */
duplicate_order_match_confidence?: number;
/** "exact_items_same_company" | "no_match" */
duplicate_order_match_method?: string;
/** True once suggestOrderDuplicate has run for this order. */
duplicate_order_matching_attempted?: boolean;
is_repair_order: boolean;
/**
* Sales rep handling this order. Free-text — auto-populated from the