Chore: Reformatted everthing

Fix: Product ledger was not totalling.
This is because for some reason, pydantic was sending the data as string when the field was nullable
This commit is contained in:
2023-08-04 21:00:26 +05:30
parent af27bf74ef
commit ac868257b7
194 changed files with 513 additions and 1580 deletions
+3 -11
View File
@@ -184,9 +184,7 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
if (this.account === null || amount <= 0) {
return;
}
const oldFiltered = this.voucher.journals.filter(
(x) => x.account.id === (this.account as Account).id,
);
const oldFiltered = this.voucher.journals.filter((x) => x.account.id === (this.account as Account).id);
const old = oldFiltered.length ? oldFiltered[0] : null;
if (old && (old.debit === -1 || old.id === this.paymentJournal.id)) {
return;
@@ -221,10 +219,7 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
updateView() {
const journals = this.voucher.journals.filter((x) => x.debit === 1);
this.journalObservable.next(journals);
this.paymentJournal.amount = round(
Math.abs(journals.map((x) => x.amount).reduce((p, c) => p + c, 0)),
2,
);
this.paymentJournal.amount = round(Math.abs(journals.map((x) => x.amount).reduce((p, c) => p + c, 0)), 2);
this.form.controls.paymentAmount.setValue(this.paymentJournal.amount);
}
@@ -265,10 +260,7 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
if (this.voucher.posted && this.auth.allowed('edit-posted-vouchers')) {
return true;
}
return (
this.voucher.user.id === (this.auth.user as User).id ||
this.auth.allowed("edit-other-user's-vouchers")
);
return this.voucher.user.id === (this.auth.user as User).id || this.auth.allowed("edit-other-user's-vouchers");
}
post() {