From 45f6db947995ead4d2277dc1ab4e8569cb52787e Mon Sep 17 00:00:00 2001 From: mandreshope Date: Mon, 4 Aug 2025 10:15:12 +0300 Subject: [PATCH] feat: Updates local reception record status Marks the local stock picking record as synchronized and done after successful backorder confirmation. This ensures the client-side data accurately reflects the completion of the backorder process. --- .../reception/reception_details_page_model.dart | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/pages/operation/reception/reception_details_page_model.dart b/lib/pages/operation/reception/reception_details_page_model.dart index e55bac1..4d6bd7a 100644 --- a/lib/pages/operation/reception/reception_details_page_model.dart +++ b/lib/pages/operation/reception/reception_details_page_model.dart @@ -109,6 +109,9 @@ class ReceptionDetailsPageModel }) async { await save(receptionId: receptionId); try { + final stockPickingRecords = objectboxManager.store + .box(); + final stockPikingEntity = stockPickingRecords.get(receptionId); state = state.copyWith(withBackorderLoading: true); final createBackorderConfirmationId = await ApiCalls.createBackorderConfirmation( @@ -121,6 +124,9 @@ class ReceptionDetailsPageModel createBackorderConfirmationId: createBackorderConfirmationId, ); if (res) { + stockPikingEntity?.synchronized = true; + stockPikingEntity?.state = 'done'; + stockPickingRecords.put(stockPikingEntity!); await getReceptionById(id: receptionId); onSuccess?.call(); } else { @@ -143,6 +149,9 @@ class ReceptionDetailsPageModel }) async { await save(receptionId: receptionId); try { + final stockPickingRecords = objectboxManager.store + .box(); + final stockPikingEntity = stockPickingRecords.get(receptionId); state = state.copyWith(withBackorderLoading: true); final createBackorderConfirmationId = await ApiCalls.createBackorderConfirmation( @@ -155,6 +164,9 @@ class ReceptionDetailsPageModel createBackorderConfirmationId: createBackorderConfirmationId, ); if (res) { + stockPikingEntity?.synchronized = true; + stockPikingEntity?.state = 'done'; + stockPickingRecords.put(stockPikingEntity!); await getReceptionById(id: receptionId); onSuccess?.call(); } else {