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

View File

@ -210,15 +210,11 @@ export class PurchaseComponent implements OnInit, AfterViewInit, OnDestroy {
? (this.product.costPrice as number)
: this.math.parseAmount(formValue.price, 2);
const tax = this.product.isRateContracted ? 0 : this.math.parseAmount(formValue.tax, 5);
const discount = this.product.isRateContracted
? 0
: this.math.parseAmount(formValue.discount, 5);
const discount = this.product.isRateContracted ? 0 : this.math.parseAmount(formValue.discount, 5);
if ((price as number) <= 0 || (tax as number) < 0 || (discount as number) < 0) {
return;
}
const oldFiltered = this.voucher.inventories.filter(
(x) => x.batch?.sku.id === (this.product as ProductSku).id,
);
const oldFiltered = this.voucher.inventories.filter((x) => x.batch?.sku.id === (this.product as ProductSku).id);
if (oldFiltered.length) {
this.toaster.show('Danger', 'Product already added');
return;
@ -291,10 +287,7 @@ export class PurchaseComponent 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() {