- Fixes [Issue/15324](https://github.com/frappe/frappe/issues/15324) - When selecting a value for Link Field, the English text was set as link field value. - This PR aims to fix it by setting the translated text as link field value on selection. Todo: - [x] Show translated text in the select dropdown - [x] Set translated value to Link field on select - [x] Show original value when link field is in focus - [x] Add option to toggle this behaviour ### Behaviour - Link field loses focus: show the translated name. - Link field is focused - If old value is present - If options **are** one of [Role, DocType]: show the translated name - Else: show the name (untranslated) to enable search in untranslated values - Else: show what the user typed (untranslated) to enable search in untranslated values - Value is selected: link field loses focus ## Demo ### Link to UOM in a custom Item DocType The UOM names are in english, so the search needs to happen in english. When possible, the translation is displayed. #### Before https://user-images.githubusercontent.com/14891507/156415248-e5e80d05-53dc-4ca8-89c7-998986ff6e99.mov #### After https://user-images.githubusercontent.com/14891507/156410386-a874430c-f340-43ed-9c3a-92e8d4d50fc9.mov ### Link to DocType in Customize Form The DocType names get translated before being searched. This is a preexisting hack in the framework for DocType and Role. In this case, we can search in the translations. #### Before https://user-images.githubusercontent.com/14891507/156414648-8e505f8c-9dee-4358-8182-3b358c28bb62.mov #### After https://user-images.githubusercontent.com/14891507/156411881-c4ca22e1-1397-4e13-9768-5e16b72f8d6d.mov https://docs.erpnext.com/docs/v13/user/manual/en/customize-erpnext/customize-form/edit?wiki_page_patch=fdafee2715
337 lines
12 KiB
SQL
337 lines
12 KiB
SQL
-- Core Elements to install WNFramework
|
|
-- To be called from install.py
|
|
|
|
|
|
--
|
|
-- Table structure for table `tabDocField`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `tabDocField`;
|
|
CREATE TABLE `tabDocField` (
|
|
`name` varchar(255) NOT NULL,
|
|
`creation` datetime(6) DEFAULT NULL,
|
|
`modified` datetime(6) DEFAULT NULL,
|
|
`modified_by` varchar(255) DEFAULT NULL,
|
|
`owner` varchar(255) DEFAULT NULL,
|
|
`docstatus` int(1) NOT NULL DEFAULT 0,
|
|
`parent` varchar(255) DEFAULT NULL,
|
|
`parentfield` varchar(255) DEFAULT NULL,
|
|
`parenttype` varchar(255) DEFAULT NULL,
|
|
`idx` int(8) NOT NULL DEFAULT 0,
|
|
`fieldname` varchar(255) DEFAULT NULL,
|
|
`label` varchar(255) DEFAULT NULL,
|
|
`oldfieldname` varchar(255) DEFAULT NULL,
|
|
`fieldtype` varchar(255) DEFAULT NULL,
|
|
`oldfieldtype` varchar(255) DEFAULT NULL,
|
|
`options` text,
|
|
`search_index` int(1) NOT NULL DEFAULT 0,
|
|
`show_dashboard` int(1) NOT NULL DEFAULT 0,
|
|
`hidden` int(1) NOT NULL DEFAULT 0,
|
|
`set_only_once` int(1) NOT NULL DEFAULT 0,
|
|
`allow_in_quick_entry` int(1) NOT NULL DEFAULT 0,
|
|
`print_hide` int(1) NOT NULL DEFAULT 0,
|
|
`report_hide` int(1) NOT NULL DEFAULT 0,
|
|
`reqd` int(1) NOT NULL DEFAULT 0,
|
|
`bold` int(1) NOT NULL DEFAULT 0,
|
|
`in_global_search` int(1) NOT NULL DEFAULT 0,
|
|
`collapsible` int(1) NOT NULL DEFAULT 0,
|
|
`unique` int(1) NOT NULL DEFAULT 0,
|
|
`no_copy` int(1) NOT NULL DEFAULT 0,
|
|
`allow_on_submit` int(1) NOT NULL DEFAULT 0,
|
|
`show_preview_popup` int(1) NOT NULL DEFAULT 0,
|
|
`trigger` varchar(255) DEFAULT NULL,
|
|
`collapsible_depends_on` text,
|
|
`mandatory_depends_on` text,
|
|
`read_only_depends_on` text,
|
|
`depends_on` text,
|
|
`permlevel` int(11) NOT NULL DEFAULT 0,
|
|
`ignore_user_permissions` int(1) NOT NULL DEFAULT 0,
|
|
`width` varchar(255) DEFAULT NULL,
|
|
`print_width` varchar(255) DEFAULT NULL,
|
|
`columns` int(11) NOT NULL DEFAULT 0,
|
|
`default` text,
|
|
`description` text,
|
|
`in_list_view` int(1) NOT NULL DEFAULT 0,
|
|
`fetch_if_empty` int(1) NOT NULL DEFAULT 0,
|
|
`in_filter` int(1) NOT NULL DEFAULT 0,
|
|
`remember_last_selected_value` int(1) NOT NULL DEFAULT 0,
|
|
`ignore_xss_filter` int(1) NOT NULL DEFAULT 0,
|
|
`print_hide_if_no_value` int(1) NOT NULL DEFAULT 0,
|
|
`allow_bulk_edit` int(1) NOT NULL DEFAULT 0,
|
|
`in_standard_filter` int(1) NOT NULL DEFAULT 0,
|
|
`in_preview` int(1) NOT NULL DEFAULT 0,
|
|
`read_only` int(1) NOT NULL DEFAULT 0,
|
|
`precision` varchar(255) DEFAULT NULL,
|
|
`max_height` varchar(10) DEFAULT NULL,
|
|
`length` int(11) NOT NULL DEFAULT 0,
|
|
`translatable` int(1) NOT NULL DEFAULT 0,
|
|
`hide_border` int(1) NOT NULL DEFAULT 0,
|
|
`hide_days` int(1) NOT NULL DEFAULT 0,
|
|
`hide_seconds` int(1) NOT NULL DEFAULT 0,
|
|
PRIMARY KEY (`name`),
|
|
KEY `parent` (`parent`),
|
|
KEY `label` (`label`),
|
|
KEY `fieldtype` (`fieldtype`),
|
|
KEY `fieldname` (`fieldname`)
|
|
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC CHARACTER SET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
|
|
--
|
|
-- Table structure for table `tabDocPerm`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `tabDocPerm`;
|
|
CREATE TABLE `tabDocPerm` (
|
|
`name` varchar(255) NOT NULL,
|
|
`creation` datetime(6) DEFAULT NULL,
|
|
`modified` datetime(6) DEFAULT NULL,
|
|
`modified_by` varchar(255) DEFAULT NULL,
|
|
`owner` varchar(255) DEFAULT NULL,
|
|
`docstatus` int(1) NOT NULL DEFAULT 0,
|
|
`parent` varchar(255) DEFAULT NULL,
|
|
`parentfield` varchar(255) DEFAULT NULL,
|
|
`parenttype` varchar(255) DEFAULT NULL,
|
|
`idx` int(8) NOT NULL DEFAULT 0,
|
|
`permlevel` int(11) DEFAULT '0',
|
|
`role` varchar(255) DEFAULT NULL,
|
|
`match` varchar(255) DEFAULT NULL,
|
|
`read` int(1) NOT NULL DEFAULT 1,
|
|
`write` int(1) NOT NULL DEFAULT 1,
|
|
`create` int(1) NOT NULL DEFAULT 1,
|
|
`submit` int(1) NOT NULL DEFAULT 0,
|
|
`cancel` int(1) NOT NULL DEFAULT 0,
|
|
`delete` int(1) NOT NULL DEFAULT 1,
|
|
`amend` int(1) NOT NULL DEFAULT 0,
|
|
`report` int(1) NOT NULL DEFAULT 1,
|
|
`export` int(1) NOT NULL DEFAULT 1,
|
|
`import` int(1) NOT NULL DEFAULT 0,
|
|
`share` int(1) NOT NULL DEFAULT 1,
|
|
`print` int(1) NOT NULL DEFAULT 1,
|
|
`email` int(1) NOT NULL DEFAULT 1,
|
|
PRIMARY KEY (`name`),
|
|
KEY `parent` (`parent`)
|
|
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC CHARACTER SET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
--
|
|
-- Table structure for table `tabDocType Action`
|
|
--
|
|
|
|
CREATE TABLE `tabDocType Action` (
|
|
`name` varchar(140) COLLATE utf8mb4_unicode_ci NOT NULL,
|
|
`creation` datetime(6) DEFAULT NULL,
|
|
`modified` datetime(6) DEFAULT NULL,
|
|
`modified_by` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
|
`owner` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
|
`docstatus` int(1) NOT NULL DEFAULT 0,
|
|
`parent` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
|
`parentfield` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
|
`parenttype` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
|
`idx` int(8) NOT NULL DEFAULT 0,
|
|
`label` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
|
`group` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
|
`action_type` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
|
`action` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
|
PRIMARY KEY (`name`),
|
|
KEY `parent` (`parent`),
|
|
KEY `modified` (`modified`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
|
|
|
|
--
|
|
-- Table structure for table `tabDocType Action`
|
|
--
|
|
|
|
CREATE TABLE `tabDocType Link` (
|
|
`name` varchar(140) COLLATE utf8mb4_unicode_ci NOT NULL,
|
|
`creation` datetime(6) DEFAULT NULL,
|
|
`modified` datetime(6) DEFAULT NULL,
|
|
`modified_by` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
|
`owner` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
|
`docstatus` int(1) NOT NULL DEFAULT 0,
|
|
`parent` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
|
`parentfield` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
|
`parenttype` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
|
`idx` int(8) NOT NULL DEFAULT 0,
|
|
`group` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
|
`link_doctype` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
|
`link_fieldname` varchar(140) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
|
PRIMARY KEY (`name`),
|
|
KEY `parent` (`parent`),
|
|
KEY `modified` (`modified`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
|
|
|
|
--
|
|
-- Table structure for table `tabDocType`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `tabDocType`;
|
|
CREATE TABLE `tabDocType` (
|
|
`name` varchar(255) NOT NULL,
|
|
`creation` datetime(6) DEFAULT NULL,
|
|
`modified` datetime(6) DEFAULT NULL,
|
|
`modified_by` varchar(255) DEFAULT NULL,
|
|
`owner` varchar(255) DEFAULT NULL,
|
|
`docstatus` int(1) NOT NULL DEFAULT 0,
|
|
`idx` int(8) NOT NULL DEFAULT 0,
|
|
`search_fields` varchar(255) DEFAULT NULL,
|
|
`issingle` int(1) NOT NULL DEFAULT 0,
|
|
`is_tree` int(1) NOT NULL DEFAULT 0,
|
|
`istable` int(1) NOT NULL DEFAULT 0,
|
|
`editable_grid` int(1) NOT NULL DEFAULT 1,
|
|
`track_changes` int(1) NOT NULL DEFAULT 0,
|
|
`module` varchar(255) DEFAULT NULL,
|
|
`restrict_to_domain` varchar(255) DEFAULT NULL,
|
|
`app` varchar(255) DEFAULT NULL,
|
|
`autoname` varchar(255) DEFAULT NULL,
|
|
`naming_rule` varchar(40) DEFAULT NULL,
|
|
`name_case` varchar(255) DEFAULT NULL,
|
|
`title_field` varchar(255) DEFAULT NULL,
|
|
`image_field` varchar(255) DEFAULT NULL,
|
|
`timeline_field` varchar(255) DEFAULT NULL,
|
|
`sort_field` varchar(255) DEFAULT NULL,
|
|
`sort_order` varchar(255) DEFAULT NULL,
|
|
`description` text,
|
|
`colour` varchar(255) DEFAULT NULL,
|
|
`read_only` int(1) NOT NULL DEFAULT 0,
|
|
`in_create` int(1) NOT NULL DEFAULT 0,
|
|
`menu_index` int(11) DEFAULT NULL,
|
|
`parent_node` varchar(255) DEFAULT NULL,
|
|
`smallicon` varchar(255) DEFAULT NULL,
|
|
`allow_copy` int(1) NOT NULL DEFAULT 0,
|
|
`allow_rename` int(1) NOT NULL DEFAULT 0,
|
|
`allow_import` int(1) NOT NULL DEFAULT 0,
|
|
`hide_toolbar` int(1) NOT NULL DEFAULT 0,
|
|
`track_seen` int(1) NOT NULL DEFAULT 0,
|
|
`max_attachments` int(11) NOT NULL DEFAULT 0,
|
|
`print_outline` varchar(255) DEFAULT NULL,
|
|
`document_type` varchar(255) DEFAULT NULL,
|
|
`icon` varchar(255) DEFAULT NULL,
|
|
`color` varchar(255) DEFAULT NULL,
|
|
`tag_fields` varchar(255) DEFAULT NULL,
|
|
`subject` varchar(255) DEFAULT NULL,
|
|
`_last_update` varchar(32) DEFAULT NULL,
|
|
`engine` varchar(20) DEFAULT 'InnoDB',
|
|
`default_print_format` varchar(255) DEFAULT NULL,
|
|
`is_submittable` int(1) NOT NULL DEFAULT 0,
|
|
`show_name_in_global_search` int(1) NOT NULL DEFAULT 0,
|
|
`_user_tags` varchar(255) DEFAULT NULL,
|
|
`custom` int(1) NOT NULL DEFAULT 0,
|
|
`beta` int(1) NOT NULL DEFAULT 0,
|
|
`has_web_view` int(1) NOT NULL DEFAULT 0,
|
|
`allow_guest_to_view` int(1) NOT NULL DEFAULT 0,
|
|
`route` varchar(255) DEFAULT NULL,
|
|
`is_published_field` varchar(255) DEFAULT NULL,
|
|
`website_search_field` varchar(255) DEFAULT NULL,
|
|
`email_append_to` int(1) NOT NULL DEFAULT 0,
|
|
`subject_field` varchar(255) DEFAULT NULL,
|
|
`sender_field` varchar(255) DEFAULT NULL,
|
|
`show_title_field_in_link` int(1) NOT NULL DEFAULT 0,
|
|
`migration_hash` varchar(255) DEFAULT NULL,
|
|
`translate_link_fields` int(1) NOT NULL DEFAULT 0,
|
|
PRIMARY KEY (`name`)
|
|
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC CHARACTER SET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
--
|
|
-- Table structure for table `tabSeries`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `tabSeries`;
|
|
CREATE TABLE `tabSeries` (
|
|
`name` varchar(100),
|
|
`current` int(10) NOT NULL DEFAULT 0,
|
|
PRIMARY KEY(`name`)
|
|
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC CHARACTER SET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
|
|
--
|
|
-- Table structure for table `tabSessions`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `tabSessions`;
|
|
CREATE TABLE `tabSessions` (
|
|
`user` varchar(255) DEFAULT NULL,
|
|
`sid` varchar(255) DEFAULT NULL,
|
|
`sessiondata` longtext,
|
|
`ipaddress` varchar(16) DEFAULT NULL,
|
|
`lastupdate` datetime(6) DEFAULT NULL,
|
|
`device` varchar(255) DEFAULT 'desktop',
|
|
`status` varchar(20) DEFAULT NULL,
|
|
KEY `sid` (`sid`)
|
|
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC CHARACTER SET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
|
|
--
|
|
-- Table structure for table `tabSingles`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `tabSingles`;
|
|
CREATE TABLE `tabSingles` (
|
|
`doctype` varchar(255) DEFAULT NULL,
|
|
`field` varchar(255) DEFAULT NULL,
|
|
`value` text,
|
|
KEY `singles_doctype_field_index` (`doctype`, `field`)
|
|
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC CHARACTER SET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
--
|
|
-- Table structure for table `__Auth`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `__Auth`;
|
|
CREATE TABLE `__Auth` (
|
|
`doctype` VARCHAR(140) NOT NULL,
|
|
`name` VARCHAR(255) NOT NULL,
|
|
`fieldname` VARCHAR(140) NOT NULL,
|
|
`password` TEXT NOT NULL,
|
|
`encrypted` INT(1) NOT NULL DEFAULT 0,
|
|
PRIMARY KEY (`doctype`, `name`, `fieldname`)
|
|
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC CHARACTER SET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
--
|
|
-- Table structure for table `tabFile`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `tabFile`;
|
|
CREATE TABLE `tabFile` (
|
|
`name` varchar(255) NOT NULL,
|
|
`creation` datetime(6) DEFAULT NULL,
|
|
`modified` datetime(6) DEFAULT NULL,
|
|
`modified_by` varchar(255) DEFAULT NULL,
|
|
`owner` varchar(255) DEFAULT NULL,
|
|
`docstatus` int(1) NOT NULL DEFAULT 0,
|
|
`parent` varchar(255) DEFAULT NULL,
|
|
`parentfield` varchar(255) DEFAULT NULL,
|
|
`parenttype` varchar(255) DEFAULT NULL,
|
|
`idx` int(8) NOT NULL DEFAULT 0,
|
|
`file_name` varchar(255) DEFAULT NULL,
|
|
`file_url` varchar(255) DEFAULT NULL,
|
|
`module` varchar(255) DEFAULT NULL,
|
|
`attached_to_name` varchar(255) DEFAULT NULL,
|
|
`file_size` int(11) NOT NULL DEFAULT 0,
|
|
`attached_to_doctype` varchar(255) DEFAULT NULL,
|
|
PRIMARY KEY (`name`),
|
|
KEY `parent` (`parent`),
|
|
KEY `attached_to_name` (`attached_to_name`),
|
|
KEY `attached_to_doctype` (`attached_to_doctype`)
|
|
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC CHARACTER SET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
--
|
|
-- Table structure for table `tabDefaultValue`
|
|
--
|
|
|
|
DROP TABLE IF EXISTS `tabDefaultValue`;
|
|
CREATE TABLE `tabDefaultValue` (
|
|
`name` varchar(255) NOT NULL,
|
|
`creation` datetime(6) DEFAULT NULL,
|
|
`modified` datetime(6) DEFAULT NULL,
|
|
`modified_by` varchar(255) DEFAULT NULL,
|
|
`owner` varchar(255) DEFAULT NULL,
|
|
`docstatus` int(1) NOT NULL DEFAULT 0,
|
|
`parent` varchar(255) DEFAULT NULL,
|
|
`parentfield` varchar(255) DEFAULT NULL,
|
|
`parenttype` varchar(255) DEFAULT NULL,
|
|
`idx` int(8) NOT NULL DEFAULT 0,
|
|
`defvalue` text,
|
|
`defkey` varchar(255) DEFAULT NULL,
|
|
PRIMARY KEY (`name`),
|
|
KEY `parent` (`parent`),
|
|
KEY `defaultvalue_parent_defkey_index` (`parent`,`defkey`)
|
|
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC CHARACTER SET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|