mirror of
https://github.com/frappe/books.git
synced 2026-08-24 10:04:45 -05:00
removed unnecessary codes
This commit is contained in:
@@ -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 = {
|
||||
|
||||
@@ -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')}.`
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user