From 7404da34839fbdb9cccfab6503de8efe3246e3d0 Mon Sep 17 00:00:00 2001 From: AbleKSaju <126228406+AbleKSaju@users.noreply.github.com> Date: Wed, 4 Sep 2024 17:53:00 +0530 Subject: [PATCH] fix: update total rate and apply free item when quantity changes --- src/components/POS/SelectedItemRow.vue | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/components/POS/SelectedItemRow.vue b/src/components/POS/SelectedItemRow.vue index 45fde7f2..13910c53 100644 --- a/src/components/POS/SelectedItemRow.vue +++ b/src/components/POS/SelectedItemRow.vue @@ -106,7 +106,7 @@ :show-label="true" :border="true" :value="row.transferUnit" - @change="(value:string) => setTransferUnit((row.transferUnit = value))" + @change="(value:string) => row.set('transferUnit', value)" :read-only="isReadOnly" /> @@ -266,6 +266,7 @@ import { Money } from 'pesa'; import { DiscountType } from './types'; import { t } from 'fyo'; import { validateSerialNumberCount } from 'src/utils/pos'; +import { ApplicablePricingRules } from 'models/baseModels/Invoice/types'; export default defineComponent({ name: 'SelectedItemRow', @@ -319,7 +320,7 @@ export default defineComponent({ ); }, async setBatch(batch: string) { - this.row.batch = batch; + this.row.set('batch', batch); this.availableQtyInBatch = await this.getAvailableQtyInBatch(); }, setSerialNumber(serialNumber: string) { @@ -336,14 +337,12 @@ export default defineComponent({ }, setItemDiscount(type: DiscountType, value: Money | number) { if (type === 'percent') { - this.row.setItemDiscountAmount = false; - this.row.itemDiscountPercent = value as number; - this.$emit('runSinvFormulas'); + this.row.set('setItemDiscountAmount', false); + this.row.set('itemDiscountPercent', value as number); return; } - this.row.setItemDiscountAmount = true; - this.row.itemDiscountAmount = value as Money; - this.$emit('runSinvFormulas'); + this.row.set('setItemDiscountAmount', true); + this.row.set('itemDiscountAmount', value as Money); }, setRate(rate: Money) { this.row.setRate = rate;