From 7358dab1d00632aa6bc6ff86d16e5a4d60f8f84e Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 10 Sep 2024 00:16:01 +0200 Subject: [PATCH] fix: call upsert when crudModel haschanges --- src/components/VnTable/VnTable.vue | 1 + src/pages/Item/ItemFixedPrice.vue | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 6745a2f49..899e4d000 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -296,6 +296,7 @@ defineExpose({ reload, redirect: redirectFn, selected, + CrudModelRef, }); function handleOnDataSaved(_, res) { diff --git a/src/pages/Item/ItemFixedPrice.vue b/src/pages/Item/ItemFixedPrice.vue index 59a3e74db..16091d473 100644 --- a/src/pages/Item/ItemFixedPrice.vue +++ b/src/pages/Item/ItemFixedPrice.vue @@ -262,10 +262,13 @@ const updateMinPrice = async (value, props) => { }); }; -const upsertPrice = async ({ row }, resetMinPrice = false) => { +const upsertPrice = async (props, resetMinPrice = false) => { try { - if (resetMinPrice) row.hasMinPrice = 0; - row = await upsertFixedPrice(row); + const { row } = props; + if (tableRef.value.CrudModelRef.getChanges().updates.length > 0) { + if (resetMinPrice) row.hasMinPrice = 0; + await upsertFixedPrice(row); + } } catch (err) { console.error('Error editing price', err); }