seitime-frappe/frappe
Himanshu 70409a3c7b
fix: set translated text to link field (#15451)
- 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
2022-05-16 13:21:42 +00:00
..
automation fix(linting): no single quotes :'| 2022-04-18 17:29:03 +05:30
change_log chore: Added Change log for v13.3.0 2021-05-17 10:58:30 +05:30
commands refactor: Remove dead code (#16886) 2022-05-12 18:04:44 +05:30
config style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
contacts fix: change ordering to creation (#16863) 2022-05-10 19:41:11 +05:30
core fix: set translated text to link field (#15451) 2022-05-16 13:21:42 +00:00
custom fix: set translated text to link field (#15451) 2022-05-16 13:21:42 +00:00
data Merge branch 'develop' of https://github.com/frappe/frappe into print-format-builder-beta 2021-10-20 18:40:18 +05:30
data_migration style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
database fix: set translated text to link field (#15451) 2022-05-16 13:21:42 +00:00
desk feat: Quick List Block for Workspace (#16887) 2022-05-13 15:34:35 +05:30
email fix(UX): suggest app-specific password for gmail logins (#16812) 2022-05-02 17:30:21 +05:30
event_streaming fix(linting): no single quotes :'| 2022-04-18 17:29:03 +05:30
geo Merge pull request #15538 from noahjacob/phone_field_control 2022-04-28 10:27:52 +05:30
integrations perf: remove naming series from log-like doctypes (#16823) 2022-05-04 10:54:52 +05:30
model feat: Quick List Block for Workspace (#16887) 2022-05-13 15:34:35 +05:30
modules feat: Added force flag to install-app command 2022-05-11 16:18:14 +05:30
patches fix(patch): Reload workspace child tables in pre_model_sync (#16897) 2022-05-14 12:59:54 +05:30
printing style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
public fix: set translated text to link field (#15451) 2022-05-16 13:21:42 +00:00
query_builder Merge branch 'develop' of github.com:frappe/frappe into bg-rename_doc 2022-04-14 13:41:56 +05:30
search style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
social fix(conflicts): fix conflicts' 2022-04-18 17:29:03 +05:30
templates feat: Use autocomplete attributes for login, signup and password reset 2022-05-05 13:13:40 +02:00
tests test: verify ALL translation file syntax 2022-05-13 16:12:40 +05:30
translations fix: Update translation 2022-05-02 20:26:03 +03:00
utils refactor: Remove dead code (#16886) 2022-05-12 18:04:44 +05:30
website fix(webform): only title on the page should be h1 (#16880) 2022-05-16 13:33:29 +05:30
workflow fix: bad query if user has ' in the email address (#16796) 2022-05-04 19:07:51 +05:30
www test: test for metatag rendering 2022-05-11 13:29:03 +05:30
__init__.py refactor(DX): add type hints for some utilities (#16871) 2022-05-11 06:14:31 +00:00
api.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
app.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
auth.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
boot.py fix: set translated text to link field (#15451) 2022-05-16 13:21:42 +00:00
build.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
cache_manager.py fix(minor): circular imports? 2022-04-18 17:29:03 +05:30
client.py fix: use set instead of list in insert_many client function 2022-05-11 23:41:47 +05:30
coverage.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
defaults.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
deferred_insert.py fix: dont manually commit after flushing deferred_insert 2022-05-04 14:59:19 +05:30
exceptions.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
frappeclient.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
handler.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
hooks.py chore!: remove dead hooks app_icon & app_color 2022-05-10 14:41:01 +05:30
installer.py chore: use secho instead of raising exception if app is already installed 2022-05-11 16:18:14 +05:30
middlewares.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
migrate.py fix: Check for required services running after frappe init 2022-04-20 11:25:38 +05:30
modules.txt chore: Remove Chat Module 2021-11-09 13:44:57 +05:30
monitor.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
oauth.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
parallel_test_runner.py test!: dont autocommit on test object recreation 2022-04-22 19:47:54 +05:30
patches.txt fix(patch): Reload workspace child tables in pre_model_sync (#16897) 2022-05-14 12:59:54 +05:30
permissions.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
rate_limiter.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
realtime.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
recorder.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
sessions.py fix: set translated text to link field (#15451) 2022-05-16 13:21:42 +00:00
share.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30
test_runner.py test!: dont autocommit on test object recreation 2022-04-22 19:47:54 +05:30
translate.py test: verify ALL translation file syntax 2022-05-13 16:12:40 +05:30
twofactor.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30