mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Improve reconciliation to only check for unchecked invoices
Refine BLReconciliation page logic to only perform initial verification for deliveries that have not yet been found (i.e., have no invoice amount) and have not already been processed or are currently being verified. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 1e4433b5-47ab-464c-b663-fea2e53367dd Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 1e02676a-c064-41b5-8cc9-18cc13f26b5d Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/1e4433b5-47ab-464c-b663-fea2e53367dd/lCj0xbO
This commit is contained in:
1 parent
55c010c2f6
commit
3a8a2cb0b3
1 file changed
+20
-5
@@ -405,14 +405,17 @@ export default function BLReconciliation() {
|
||||
return; // Autres livraisons réconciliées = AUCUNE vérification nécessaire
|
||||
}
|
||||
|
||||
// VÉRIFICATION AUTOMATIQUE pour afficher les coches (UNE SEULE FOIS au chargement)
|
||||
// Vérifier seulement les livraisons NON réconciliées qui n'ont PAS encore été vérifiées
|
||||
// VÉRIFICATION AUTOMATIQUE pour afficher les coches
|
||||
// NE vérifier QUE les factures qui n'ont PAS encore de montant renseigné (pas encore trouvées)
|
||||
const hasVerifiableData = delivery.invoiceReference || delivery.blNumber;
|
||||
const notAlreadyProcessed = !verificationResults[delivery.id] && !verifyingDeliveries.has(delivery.id);
|
||||
const hasNoInvoiceAmount = !delivery.invoiceAmount; // Pas encore trouvée dans NocoDB
|
||||
const notAlreadyVerified = !verificationResults[delivery.id];
|
||||
const notCurrentlyVerifying = !verifyingDeliveries.has(delivery.id);
|
||||
|
||||
if (hasVerifiableData && notAlreadyProcessed) {
|
||||
// Ne vérifier que si : a des données ET pas de montant (pas encore trouvée) ET pas déjà vérifiée
|
||||
if (hasVerifiableData && hasNoInvoiceAmount && notAlreadyVerified && notCurrentlyVerifying) {
|
||||
if (import.meta.env.DEV) {
|
||||
console.log(`🔍 Vérification initiale pour affichage coche ${delivery.id}:`, {
|
||||
console.log(`🔍 Vérification initiale ${delivery.id} (pas encore trouvée):`, {
|
||||
invoiceRef: delivery.invoiceReference,
|
||||
blNumber: delivery.blNumber
|
||||
});
|
||||
@@ -423,6 +426,18 @@ export default function BLReconciliation() {
|
||||
handleVerifyInvoice(delivery, false);
|
||||
}, Math.random() * 1000);
|
||||
}
|
||||
|
||||
// Si la facture a déjà un montant → marquer comme trouvée (coche verte) sans vérifier
|
||||
if (hasVerifiableData && delivery.invoiceAmount && !verificationResults[delivery.id]) {
|
||||
newVerificationResults[delivery.id] = {
|
||||
exists: true,
|
||||
matchType: delivery.invoiceReference ? 'invoice_reference' : 'bl_number',
|
||||
fromCache: true,
|
||||
permanent: true,
|
||||
invoiceAmount: delivery.invoiceAmount
|
||||
};
|
||||
hasNewReconciledResults = true;
|
||||
}
|
||||
});
|
||||
}, [deliveriesWithBL, suppliers, verificationResults, verifyingDeliveries]);
|
||||
|
||||
|
||||
Reference in new issue
Block a user