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

eslint fixes

This commit is contained in:
Faris Ansari 2018-07-12 17:05:24 +05:30
parent bb5dc896c8
commit 1a5d01ffeb
2 changed files with 95 additions and 94 deletions

View File

@ -1,7 +1,7 @@
const frappe = require('frappejs');
module.exports = class LedgerPosting {
constructor({reference, party, date, description}) {
constructor({ reference, party, date, description }) {
Object.assign(this, arguments[0]);
this.entries = [];
this.entryMap = {};
@ -54,8 +54,11 @@ module.exports = class LedgerPosting {
}
validateEntries() {
let debit = 0, credit = 0;
let debitAccounts = [], creditAccounts = [];
let debit = 0;
let credit = 0;
let debitAccounts = [];
let creditAccounts = [];
for (let entry of this.entries) {
debit += entry.debit;
credit += entry.credit;
@ -67,7 +70,7 @@ module.exports = class LedgerPosting {
}
if (debit !== credit) {
throw frappe.errors.ValidationError(frappe._("Debit {0} must be equal to Credit {1}", [debit, credit]));
throw frappe.errors.ValidationError(frappe._('Debit {0} must be equal to Credit {1}', [debit, credit]));
}
}
@ -80,4 +83,4 @@ module.exports = class LedgerPosting {
await entryDoc.insert();
}
}
}
};

View File

@ -1,10 +1,9 @@
const Invoice = require('./InvoiceDocument');
const frappe = require('frappejs');
const LedgerPosting = require('../../../accounting/ledgerPosting');
module.exports = class InvoiceServer extends Invoice {
getPosting() {
let entries = new LedgerPosting({reference: this, party: this.customer});
let entries = new LedgerPosting({ reference: this, party: this.customer });
entries.debit(this.account, this.grandTotal);
for (let item of this.items) {
@ -17,7 +16,6 @@ module.exports = class InvoiceServer extends Invoice {
}
}
return entries;
}
async afterSubmit() {
@ -27,4 +25,4 @@ module.exports = class InvoiceServer extends Invoice {
async afterRevert() {
await this.getPosting().postReverse();
}
}
};