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'];
|
const exclude_field_types = ['HTML', 'Section Break', 'Column Break', 'Button', 'Read Only'];
|
||||||
|
|
||||||
frappe.model.with_doctype('Item', () => {
|
frappe.model.with_doctype('Item', () => {
|
||||||
|
const field_label_map = {};
|
||||||
frappe.get_meta('Item').fields.forEach(d => {
|
frappe.get_meta('Item').fields.forEach(d => {
|
||||||
|
field_label_map[d.fieldname] = __(d.label) + ` (${d.fieldname})`;
|
||||||
|
|
||||||
if (!in_list(exclude_field_types, d.fieldtype)
|
if (!in_list(exclude_field_types, d.fieldtype)
|
||||||
&& !d.no_copy && !in_list(exclude_fields, d.fieldname)) {
|
&& !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,
|
"actions": [],
|
||||||
"allow_guest_to_view": 0,
|
"creation": "2022-02-11 11:26:20.611960",
|
||||||
"allow_import": 0,
|
"doctype": "DocType",
|
||||||
"allow_rename": 0,
|
"editable_grid": 1,
|
||||||
"beta": 0,
|
"engine": "InnoDB",
|
||||||
"creation": "2017-08-29 16:33:33.978574",
|
"field_order": [
|
||||||
"custom": 0,
|
"field_name"
|
||||||
"docstatus": 0,
|
],
|
||||||
"doctype": "DocType",
|
|
||||||
"document_type": "",
|
|
||||||
"editable_grid": 1,
|
|
||||||
"engine": "InnoDB",
|
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"fieldname": "field_name",
|
||||||
"allow_on_submit": 0,
|
"fieldtype": "Autocomplete",
|
||||||
"bold": 0,
|
"in_list_view": 1,
|
||||||
"collapsible": 0,
|
"label": "Field Name",
|
||||||
"columns": 0,
|
"reqd": 1
|
||||||
"fieldname": "field_name",
|
|
||||||
"fieldtype": "Select",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"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
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"has_web_view": 0,
|
"istable": 1,
|
||||||
"hide_heading": 0,
|
"links": [],
|
||||||
"hide_toolbar": 0,
|
"modified": "2022-03-25 05:48:30.946201",
|
||||||
"idx": 0,
|
"modified_by": "Administrator",
|
||||||
"image_view": 0,
|
"module": "Stock",
|
||||||
"in_create": 0,
|
"name": "Variant Field",
|
||||||
"is_submittable": 0,
|
"owner": "Administrator",
|
||||||
"issingle": 0,
|
"permissions": [],
|
||||||
"istable": 1,
|
"quick_entry": 1,
|
||||||
"max_attachments": 0,
|
"sort_field": "modified",
|
||||||
"modified": "2017-08-29 17:19:20.353197",
|
"sort_order": "DESC",
|
||||||
"modified_by": "Administrator",
|
"states": [],
|
||||||
"module": "Stock",
|
"track_changes": 1
|
||||||
"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
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user