2
0
mirror of https://github.com/frappe/books.git synced 2024-12-22 19:09: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) {
return;
continue;
}
const pricingRuleDoc = (await this.fyo.doc.getDoc(

View File

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

View File

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