diff --git a/frappe/core/doctype/doctype/doctype.py b/frappe/core/doctype/doctype/doctype.py index 89b2a1a47e..d922cfe166 100644 --- a/frappe/core/doctype/doctype/doctype.py +++ b/frappe/core/doctype/doctype/doctype.py @@ -895,7 +895,7 @@ def validate_fields(meta): field.fetch_from = field.fetch_from.strip('\n').strip() def validate_data_field_type(docfield): - if docfield.fieldtype == "Data": + if docfield.fieldtype == "Data" and not (docfield.oldfieldtype and docfield.oldfieldtype != "Data"): if docfield.options and (docfield.options not in data_field_options): df_str = frappe.bold(_(docfield.label)) text_str = _("{0} is an invalid Data field.").format(df_str) + "
" * 2 + _("Only Options allowed for Data field are:") + "
" diff --git a/frappe/core/doctype/user/user.py b/frappe/core/doctype/user/user.py index 7837c90d2b..8370af6808 100644 --- a/frappe/core/doctype/user/user.py +++ b/frappe/core/doctype/user/user.py @@ -551,6 +551,7 @@ def update_password(new_password, logout_all_sessions=0, key=None, old_password= res = _get_user_for_update_password(key, old_password) if res.get('message'): + frappe.local.response.http_status_code = 410 return res['message'] else: user = res['user'] @@ -718,7 +719,7 @@ def _get_user_for_update_password(key, old_password): user = frappe.db.get_value("User", {"reset_password_key": key}) if not user: return { - 'message': _("Cannot Update: Incorrect / Expired Link.") + 'message': _("The Link specified has either been used before or Invalid") } elif old_password: diff --git a/frappe/desk/notifications.py b/frappe/desk/notifications.py index 3a8815ca71..109dd25f4f 100644 --- a/frappe/desk/notifications.py +++ b/frappe/desk/notifications.py @@ -268,8 +268,9 @@ def get_open_count(doctype, name, items=[]): "count": out, } - module = frappe.get_meta_module(doctype) - if hasattr(module, "get_timeline_data"): - out["timeline_data"] = module.get_timeline_data(doctype, name) + if not meta.custom: + module = frappe.get_meta_module(doctype) + if hasattr(module, "get_timeline_data"): + out["timeline_data"] = module.get_timeline_data(doctype, name) return out diff --git a/frappe/model/base_document.py b/frappe/model/base_document.py index f5612c1ec0..feeb96898a 100644 --- a/frappe/model/base_document.py +++ b/frappe/model/base_document.py @@ -565,10 +565,14 @@ class BaseDocument(object): for data_field in self.meta.get_data_fields(): data = self.get(data_field.fieldname) data_field_options = data_field.get("options") + old_fieldtype = data_field.get("oldfieldtype") + + if old_fieldtype and old_fieldtype != "Data": + continue if data_field_options == "Email": if (self.owner in STANDARD_USERS) and (data in STANDARD_USERS): - return + continue for email_address in frappe.utils.split_emails(data): frappe.utils.validate_email_address(email_address, throw=True) diff --git a/frappe/model/document.py b/frappe/model/document.py index f2495e9e20..5e01f5e65f 100644 --- a/frappe/model/document.py +++ b/frappe/model/document.py @@ -329,6 +329,10 @@ class Document(BaseDocument): self.update_children() self.run_post_save_methods() + # clear unsaved flag + if hasattr(self, "__unsaved"): + delattr(self, "__unsaved") + return self def copy_attachments_from_amended_from(self): diff --git a/frappe/public/js/frappe/form/controls/code.js b/frappe/public/js/frappe/form/controls/code.js index bdf36b706a..6b40201001 100644 --- a/frappe/public/js/frappe/form/controls/code.js +++ b/frappe/public/js/frappe/form/controls/code.js @@ -10,11 +10,11 @@ frappe.ui.form.ControlCode = frappe.ui.form.ControlText.extend({ .appendTo(this.input_area); this.expanded = false; - this.$expand_button = $(``).click(() => { + this.$expand_button = $(``).click(() => { this.expanded = !this.expanded; this.refresh_height(); - }).insertAfter(this.ace_editor_target); - + this.toggle_label(); + }).appendTo(this.$input_wrapper); // styling this.ace_editor_target.addClass('border rounded'); this.ace_editor_target.css('height', 300); @@ -37,6 +37,11 @@ frappe.ui.form.ControlCode = frappe.ui.form.ControlText.extend({ this.editor.resize(); }, + toggle_label() { + const button_label = this.expanded ? __('Collapse') : __('Expand'); + this.$expand_button.text(button_label); + }, + set_language() { const language_map = { 'Javascript': 'ace/mode/javascript', diff --git a/frappe/public/less/form.less b/frappe/public/less/form.less index b72d249aab..8e43b05122 100644 --- a/frappe/public/less/form.less +++ b/frappe/public/less/form.less @@ -770,6 +770,7 @@ h6.uppercase, .h6.uppercase { .help-box { margin-top: 3px; + margin-bottom: 6px; } pre { diff --git a/frappe/www/update-password.html b/frappe/www/update-password.html index f0ee0688d4..d12be86d12 100644 --- a/frappe/www/update-password.html +++ b/frappe/www/update-password.html @@ -9,7 +9,7 @@ {{ _("Reset Password") if frappe.db.get_default('company') else _("Set Password")}}
-
+ @@ -32,8 +32,8 @@