From c324eb9c755ae1063fb4641088738ca61d8411a3 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 2 Jun 2021 17:47:44 +0000 Subject: [PATCH] --- ayanova/src/views/svc-workorder.vue | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/ayanova/src/views/svc-workorder.vue b/ayanova/src/views/svc-workorder.vue index ed9576fc..c2b56320 100644 --- a/ayanova/src/views/svc-workorder.vue +++ b/ayanova/src/views/svc-workorder.vue @@ -1102,16 +1102,33 @@ async function saveParts(vm, woItemIndex) { } for (let i = 0; i < vm.obj.items[woItemIndex].parts.length; i++) { - let o = vm.obj.items[woItemIndex].parts[i]; - if (o.isDirty) { - //const isPost = o.id == 0; - let res = await window.$gz.api.upsert(`${API_BASE_URL}items/parts`, o); + if (vm.obj.items[woItemIndex].parts[i].isDirty) { + const o = vm.obj.items[woItemIndex].parts[i]; + const uid = o.uid; + //strip out viz fields before sending + o.isDirty = undefined; + o.uid = undefined; + o.partViz = undefined; + o.upcViz = undefined; + o.partWarehouseViz = undefined; + o.taxPartSaleViz = undefined; + o.cost = undefined; + o.listPrice = undefined; + o.unitOfMeasureViz = undefined; + o.priceViz = undefined; + o.netViz = undefined; + o.taxAViz = undefined; + o.taxBViz = undefined; + o.partVizlineTotalViz = undefined; + o.lineTotalViz = undefined; + + const res = await window.$gz.api.upsert(`${API_BASE_URL}items/parts`, o); if (res.error) { handleSaveError(vm, { error: res.error, itemUid: vm.obj.items[woItemIndex].uid, childKey: "parts", - childUid: o.uid + childUid: uid }); } else { //Server will update fields on put or post for most workorder graph objecs so need to update entire object here