removed unnecessary codes

This commit is contained in:
suhailanzar
2025-06-06 11:10:38 +05:30
parent cc1a692aed
commit 2aba54f3f3
2 changed files with 8 additions and 31 deletions
+1 -15
View File
@@ -87,7 +87,6 @@ export abstract class Invoice extends Transactional {
stockNotTransferred?: number;
loyaltyProgram?: string;
backReference?: string;
originalGrandTotal?: Money;
submitted?: boolean;
cancelled?: boolean;
makeAutoPayment?: boolean;
@@ -262,15 +261,6 @@ export abstract class Invoice extends Transactional {
this.reduceUsedCountOfCoupons();
}
async grandTotalLpa() {
if (!this.originalGrandTotal) {
this.originalGrandTotal = this.grandTotal;
}
const amountAfterPoints = await this.getLPAddedBaseGrandTotal();
this.grandTotal = amountAfterPoints;
}
async _removeLoyaltyPointEntry() {
await removeLoyaltyPoint(this);
}
@@ -447,10 +437,6 @@ export abstract class Invoice extends Transactional {
}, (this.netTotal as Money).abs())
.sub(totalDiscount);
if (this.originalGrandTotal && !this.redeemLoyaltyPoints) {
grandTotal = this.originalGrandTotal;
}
return grandTotal;
}
@@ -758,7 +744,7 @@ export abstract class Invoice extends Transactional {
this.loyaltyPoints as number
);
return this.originalGrandTotal?.sub(totalLotaltyAmount);
return this.grandTotal?.sub(totalLotaltyAmount);
}
formulas: FormulaMap = {
+7 -16
View File
@@ -42,7 +42,6 @@ export class Payment extends Transactional {
referenceType?: ModelNameEnum.SalesInvoice | ModelNameEnum.PurchaseInvoice;
for?: PaymentFor[];
_accountsMap?: AccountTypeMap;
initialAmount?: Money;
async paymentMethodDoc() {
return (await this.loadAndGetLink('paymentMethod')) as PaymentMethod;
@@ -704,25 +703,17 @@ export class Payment extends Transactional {
return;
}
if (!this.initialAmount) {
this.initialAmount = this.amount as Money;
}
const amount = (this.getSum('for', 'amount', false) as Money).abs();
const moneyValue = value as Money;
if (moneyValue.gt(this.initialAmount)) {
if ((value as Money).gt(amount)) {
throw new ValidationError(
this.fyo.t`Payment amount cannot exceed ${this.fyo.format(
this.initialAmount,
'Currency'
)}.`
this.fyo.t`Payment amount cannot
exceed ${this.fyo.format(amount, 'Currency')}.`
);
} else if (moneyValue.isZero()) {
} else if ((value as Money).isZero()) {
throw new ValidationError(
this.fyo.t`Payment amount cannot be ${this.fyo.format(
moneyValue,
'Currency'
)}.`
this.fyo.t`Payment amount cannot
be ${this.fyo.format(value, 'Currency')}.`
);
}
},