2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 03:19:01 +00:00

fix: issues in Pricing rule

This commit is contained in:
AbleKSaju 2024-09-02 11:46:15 +05:30
parent 2119c301d7
commit 57ee64e2b1
3 changed files with 20 additions and 7 deletions

View File

@ -1133,7 +1133,7 @@ export abstract class Invoice extends Transactional {
); );
if (!pricingRuleDetailForItem.length) { if (!pricingRuleDetailForItem.length) {
return; continue;
} }
const pricingRuleDoc = (await this.fyo.doc.getDoc( const pricingRuleDoc = (await this.fyo.doc.getDoc(

View File

@ -88,8 +88,8 @@
:border="true" :border="true"
:show-label="true" :show-label="true"
:value="row.quantity" :value="row.quantity"
@change="(value:number) => (row.quantity = value)" @change="(value:number) => setQuantity((row.quantity = value))"
:read-only="false" :read-only="isReadOnly"
/> />
</div> </div>
@ -147,8 +147,8 @@
:show-label="true" :show-label="true"
:border="true" :border="true"
:value="row.rate" :value="row.rate"
:read-only="false" :read-only="isReadOnly"
@change="(value:Money) => (row.rate = value)" @change="(value:Money) => setRate((row.rate = value))"
/> />
<feather-icon <feather-icon
name="refresh-ccw" name="refresh-ccw"
@ -169,7 +169,7 @@
:show-label="true" :show-label="true"
:border="true" :border="true"
:value="row.itemDiscountAmount" :value="row.itemDiscountAmount"
:read-only="row.itemDiscountPercent as number > 0" :read-only="row.itemDiscountPercent as number > 0 || isReadOnly"
@change="(value:number) => setItemDiscount('amount', value)" @change="(value:number) => setItemDiscount('amount', value)"
/> />
</div> </div>
@ -186,7 +186,7 @@
:show-label="true" :show-label="true"
:border="true" :border="true"
:value="row.itemDiscountPercent" :value="row.itemDiscountPercent"
:read-only="!row.itemDiscountAmount?.isZero()" :read-only="!row.itemDiscountAmount?.isZero() || isReadOnly"
@change="(value:number) => setItemDiscount('percent', value)" @change="(value:number) => setItemDiscount('percent', value)"
/> />
</div> </div>
@ -296,6 +296,9 @@ export default defineComponent({
hasSerialNumber(): boolean { hasSerialNumber(): boolean {
return !!(this.row.links?.item && this.row.links?.item.hasSerialNumber); return !!(this.row.links?.item && this.row.links?.item.hasSerialNumber);
}, },
isReadOnly() {
return this.row.isFreeItem;
},
}, },
methods: { methods: {
async getAvailableQtyInBatch(): Promise<number> { async getAvailableQtyInBatch(): Promise<number> {
@ -340,6 +343,14 @@ export default defineComponent({
this.row.itemDiscountAmount = value as Money; this.row.itemDiscountAmount = value as Money;
this.$emit('runSinvFormulas'); this.$emit('runSinvFormulas');
}, },
setRate(rate: Money) {
this.row.setRate = rate;
this.$emit('runSinvFormulas');
},
setQuantity(quantity: number) {
this.row.setQuantity = quantity;
this.$emit('runSinvFormulas');
},
setTransferUnit(unit: string) { setTransferUnit(unit: string) {
this.row.setTransferUnit = unit; this.row.setTransferUnit = unit;
this.row._applyFormula('transferUnit'); this.row._applyFormula('transferUnit');

View File

@ -447,6 +447,8 @@ export default defineComponent({
rate: item.rate as Money, rate: item.rate as Money,
item: item.name, item: item.name,
}); });
await this.applyPricingRule();
await this.sinvDoc.runFormulas();
}, },
async createTransaction(shouldPrint = false) { async createTransaction(shouldPrint = false) {
try { try {