2
0
mirror of https://github.com/frappe/books.git synced 2024-11-08 14:50:56 +00:00

chore: add translation credits

- convert a few funcs to predicate funcs
This commit is contained in:
18alantom 2023-01-16 09:43:59 +05:30
parent 15545ff379
commit fe68edd94d
7 changed files with 23 additions and 22 deletions

View File

@ -129,7 +129,7 @@ If you want to contribute code then you can fork this repo, make changes and rai
## Translation Contributors
| Language | Contributors |
| ------------------ | ---------------------------------------------------------------------------------- |
| ------------------ | ------------------------------------------------------------------------------------------------ |
| French | [DeepL](https://www.deepl.com/), [mael-chouteau](https://github.com/mael-chouteau) |
| German | [DeepL](https://www.deepl.com/), [barredterra](https://github.com/barredterra) |
| Portuguese | [DeepL](https://www.deepl.com/) |
@ -137,7 +137,7 @@ If you want to contribute code then you can fork this repo, make changes and rai
| Catalan | Dídac E. Jiménez |
| Dutch | [FastAct](https://github.com/FastAct) |
| Spanish | [talmax1124](https://github.com/talmax1124) |
| Gujarati | [dhruvilxcode](https://github.com/dhruvilxcode) |
| Gujarati | [dhruvilxcode](https://github.com/dhruvilxcode), [4silvertooth](https://github.com/4silvertooth) |
| Korean | [Isaac-Kwon](https://github.com/Isaac-Kwon) |
| Simplified Chinese | [wcxu21](https://github.com/wcxu21) |
| Swedish | [papplo](https://github.com/papplo) |

View File

@ -295,7 +295,7 @@ function toDocAttachment(value: RawValue, field: Field): null | Attachment {
function toRawCurrency(value: DocValue, fyo: Fyo, field: Field): string {
if (isPesa(value)) {
return (value as Money).store;
return value.store;
}
if (getIsNullOrUndef(value)) {

View File

@ -543,7 +543,7 @@ export class Doc extends Observable<DocValue | Doc[]> {
}
if (isPesa(value)) {
value = (value as Money).copy();
value = value.copy();
}
if (value === null && this.schema.isSingle) {
@ -966,7 +966,8 @@ export class Doc extends Observable<DocValue | Doc[]> {
throw err;
}
}
return value as Money;
return value;
})
.reduce((a, b) => a.add(b), this.fyo.pesa(0));

View File

@ -17,7 +17,7 @@ export function areDocValuesEqual(
if (isPesa(dvOne)) {
try {
return (dvOne as Money).eq(dvTwo as string | number);
return dvOne.eq(dvTwo as string | number);
} catch {
return false;
}
@ -134,7 +134,7 @@ function shouldApplyFormulaPreSync(
export function isDocValueTruthy(docValue: DocValue | Doc[]) {
if (isPesa(docValue)) {
return !(docValue as Money).isZero();
return !docValue.isZero();
}
if (Array.isArray(docValue)) {

View File

@ -36,7 +36,7 @@ export function getDuplicates(array: unknown[]) {
return duplicates;
}
export function isPesa(value: unknown): boolean {
export function isPesa(value: unknown): value is Money {
return value instanceof Money;
}

View File

@ -7,7 +7,7 @@ import { isPesa } from 'fyo/utils';
import {
BaseError,
DuplicateEntryError,
LinkValidationError
LinkValidationError,
} from 'fyo/utils/errors';
import { Money } from 'pesa';
import { Field, FieldType, FieldTypeEnum } from 'schemas/types';
@ -85,7 +85,7 @@ export function convertPesaValuesToFloat(obj: Record<string, unknown>) {
return;
}
obj[key] = (value as Money).float;
obj[key] = value.float;
});
}

View File

@ -83,7 +83,7 @@ export function getListFromMap<T>(map: Record<string, T>): T[] {
return Object.keys(map).map((n) => map[n]);
}
export function getIsNullOrUndef(value: unknown): boolean {
export function getIsNullOrUndef(value: unknown): value is null | undefined {
return value === null || value === undefined;
}