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

fix(ux): allow NumberSeries search and create

This commit is contained in:
18alantom 2023-04-03 10:34:59 +05:30 committed by Alan
parent b618340cec
commit 6f11d6e6c2
3 changed files with 9 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import { Doc } from 'fyo/model/doc'; import { Doc } from 'fyo/model/doc';
import { ReadOnlyMap } from 'fyo/model/types';
function getPaddedName(prefix: string, next: number, padZeros: number): string { function getPaddedName(prefix: string, next: number, padZeros: number): string {
return prefix + next.toString().padStart(padZeros ?? 4, '0'); return prefix + next.toString().padStart(padZeros ?? 4, '0');
@ -46,4 +47,10 @@ export default class NumberSeries extends Doc {
getPaddedName(next: number): string { getPaddedName(next: number): string {
return getPaddedName(this.name as string, next, this.padZeros as number); return getPaddedName(this.name as string, next, this.padZeros as number);
} }
readOnly: ReadOnlyMap = {
referenceType: () => this.inserted,
padZeros: () => this.inserted,
start: () => this.inserted,
};
} }

View File

@ -61,8 +61,7 @@
} }
], ],
"default": "-", "default": "-",
"required": true, "required": true
"readOnly": true
}, },
{ {
"fieldname": "current", "fieldname": "current",

View File

@ -214,6 +214,7 @@ function getListViewList(fyo: Fyo): SearchItem[] {
ModelNameEnum.Address, ModelNameEnum.Address,
ModelNameEnum.AccountingLedgerEntry, ModelNameEnum.AccountingLedgerEntry,
ModelNameEnum.Currency, ModelNameEnum.Currency,
ModelNameEnum.NumberSeries,
]; ];
const hasInventory = fyo.doc.singles.AccountingSettings?.enableInventory; const hasInventory = fyo.doc.singles.AccountingSettings?.enableInventory;