2
0
mirror of https://github.com/frappe/books.git synced 2025-01-03 15:17:30 +00:00

fix: update total rate and apply free item when quantity changes

This commit is contained in:
AbleKSaju 2024-09-04 17:53:00 +05:30
parent 0d2108f8a8
commit 7404da3483

View File

@ -106,7 +106,7 @@
:show-label="true" :show-label="true"
:border="true" :border="true"
:value="row.transferUnit" :value="row.transferUnit"
@change="(value:string) => setTransferUnit((row.transferUnit = value))" @change="(value:string) => row.set('transferUnit', value)"
:read-only="isReadOnly" :read-only="isReadOnly"
/> />
<feather-icon <feather-icon
@ -130,7 +130,7 @@
:border="true" :border="true"
:show-label="true" :show-label="true"
:value="row.transferQuantity" :value="row.transferQuantity"
@change="(value:number) => setTransferQty((row.transferQuantity = value))" @change="(value:string) => row.set('transferQuantity', value)"
:read-only="isReadOnly" :read-only="isReadOnly"
/> />
</div> </div>
@ -266,6 +266,7 @@ import { Money } from 'pesa';
import { DiscountType } from './types'; import { DiscountType } from './types';
import { t } from 'fyo'; import { t } from 'fyo';
import { validateSerialNumberCount } from 'src/utils/pos'; import { validateSerialNumberCount } from 'src/utils/pos';
import { ApplicablePricingRules } from 'models/baseModels/Invoice/types';
export default defineComponent({ export default defineComponent({
name: 'SelectedItemRow', name: 'SelectedItemRow',
@ -319,7 +320,7 @@ export default defineComponent({
); );
}, },
async setBatch(batch: string) { async setBatch(batch: string) {
this.row.batch = batch; this.row.set('batch', batch);
this.availableQtyInBatch = await this.getAvailableQtyInBatch(); this.availableQtyInBatch = await this.getAvailableQtyInBatch();
}, },
setSerialNumber(serialNumber: string) { setSerialNumber(serialNumber: string) {
@ -336,14 +337,12 @@ export default defineComponent({
}, },
setItemDiscount(type: DiscountType, value: Money | number) { setItemDiscount(type: DiscountType, value: Money | number) {
if (type === 'percent') { if (type === 'percent') {
this.row.setItemDiscountAmount = false; this.row.set('setItemDiscountAmount', false);
this.row.itemDiscountPercent = value as number; this.row.set('itemDiscountPercent', value as number);
this.$emit('runSinvFormulas');
return; return;
} }
this.row.setItemDiscountAmount = true; this.row.set('setItemDiscountAmount', true);
this.row.itemDiscountAmount = value as Money; this.row.set('itemDiscountAmount', value as Money);
this.$emit('runSinvFormulas');
}, },
setRate(rate: Money) { setRate(rate: Money) {
this.row.setRate = rate; this.row.setRate = rate;