2
0
mirror of https://github.com/frappe/books.git synced 2024-12-22 10:58:59 +00:00

incr: use common form for now

- fix custom field type
This commit is contained in:
18alantom 2023-08-09 10:26:45 +05:30
parent bf10927be9
commit 93ad5d6a9a
2 changed files with 23 additions and 7 deletions

View File

@ -4,12 +4,15 @@ import { getListFromMap, getMapFromList } from 'utils';
import regionalSchemas from './regional';
import { appSchemas, coreSchemas, metaSchemas } from './schemas';
import type {
DynamicLinkField,
Field,
OptionField,
Schema,
SchemaMap,
SchemaStub,
SchemaStubMap,
SelectOption,
TargetField,
} from './types';
const NAME_FIELD = {
@ -319,16 +322,28 @@ function getFieldMapFromRawCustomFields(
label,
fieldname,
fieldtype,
required: isRequired,
section,
tab,
target,
options,
references,
isCustom: true,
};
} as Field;
map[parent].push(field as Field);
if (options?.length) {
(field as OptionField).options = options;
}
if (typeof isRequired === 'number' || typeof isRequired === 'boolean') {
field.required = Boolean(isRequired);
}
if (typeof target === 'string') {
(field as TargetField).target === 'target';
}
if (typeof references === 'string') {
(field as DynamicLinkField).references === 'references';
}
map[parent].push(field);
return map;
},
{} as Record<string, Field[]>

View File

@ -287,7 +287,8 @@ function getCompleteSidebar(): SidebarConfig {
{
label: t`Customize Form`,
name: 'customize-form',
route: `/customize-form`,
// route: `/customize-form`,
route: `/list/CustomForm/${t`Customize Form`}`,
hidden: () =>
!fyo.singles.AccountingSettings?.enableFormCustomization,
},