fix: Remove old option from UI
It will continue to work in DB and logic by setting `format:` prefix.
This commit is contained in:
parent
7b7c6390f4
commit
192fd21634
2 changed files with 8 additions and 0 deletions
|
|
@ -455,6 +455,7 @@ class DocType(Document):
|
|||
# We swapped naming_rule field old/new to discourage use of "format:"
|
||||
if self.autoname and self.autoname.startswith("format:"):
|
||||
self.naming_rule = "Expression (old style)"
|
||||
frappe.toast(_("Warning: Usage of 'format:' is discouraged."), indicator="yellow")
|
||||
|
||||
if self.naming_rule == "Expression (old style)" and not self.autoname.startswith("format:"):
|
||||
self.naming_rule = "Expression"
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ frappe.model.DocTypeController = class DocTypeController extends frappe.ui.form.
|
|||
|
||||
refresh() {
|
||||
this.show_db_utilization();
|
||||
this.remove_old_style_naming_option();
|
||||
}
|
||||
|
||||
show_db_utilization() {
|
||||
|
|
@ -45,6 +46,12 @@ frappe.model.DocTypeController = class DocTypeController extends frappe.ui.form.
|
|||
});
|
||||
}
|
||||
|
||||
remove_old_style_naming_option() {
|
||||
let df = this.frm.get_docfield("naming_rule");
|
||||
df.options = df.options.replace("Expression (old style)\n", "");
|
||||
this.frm.refresh_field("naming_rule");
|
||||
}
|
||||
|
||||
max_attachments() {
|
||||
if (!this.frm.doc.max_attachments) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue