This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user