fix(UX): use autocomplete for variant fields
This commit is contained in:
parent
33863cd6ab
commit
f4b39b87e3
@ -13,10 +13,16 @@ frappe.ui.form.on('Item Variant Settings', {
|
||||
const exclude_field_types = ['HTML', 'Section Break', 'Column Break', 'Button', 'Read Only'];
|
||||
|
||||
frappe.model.with_doctype('Item', () => {
|
||||
const field_label_map = {};
|
||||
frappe.get_meta('Item').fields.forEach(d => {
|
||||
field_label_map[d.fieldname] = __(d.label) + ` (${d.fieldname})`;
|
||||
|
||||
if (!in_list(exclude_field_types, d.fieldtype)
|
||||
&& !d.no_copy && !in_list(exclude_fields, d.fieldname)) {
|
||||
allow_fields.push(d.fieldname);
|
||||
allow_fields.push({
|
||||
label: field_label_map[d.fieldname],
|
||||
value: d.fieldname,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1,72 +1,32 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2017-08-29 16:33:33.978574",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"actions": [],
|
||||
"creation": "2022-02-11 11:26:20.611960",
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"field_name"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "field_name",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"fieldtype": "Autocomplete",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Field Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-29 17:19:20.353197",
|
||||
"links": [],
|
||||
"modified": "2022-03-25 05:48:30.946201",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Variant Field",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
"states": [],
|
||||
"track_changes": 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user