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.
This commit is contained in:
mandreshope 2025-08-04 10:15:12 +03:00
parent bac7acc185
commit 45f6db9479

View File

@ -109,6 +109,9 @@ class ReceptionDetailsPageModel
}) async {
await save(receptionId: receptionId);
try {
final stockPickingRecords = objectboxManager.store
.box<StockPickingRecordEntity>();
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<StockPickingRecordEntity>();
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 {