Merge pull request #9923 from gavindsouza/dirty-form
feat: don't save document if not updated
This commit is contained in:
commit
aef809d67a
2 changed files with 3 additions and 2 deletions
|
|
@ -1052,7 +1052,7 @@ frappe.ui.form.Form = class FrappeForm {
|
|||
}
|
||||
|
||||
is_dirty() {
|
||||
return this.doc.__unsaved;
|
||||
return !!this.doc.__unsaved;
|
||||
}
|
||||
|
||||
is_new() {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ frappe.ui.form.save = function (frm, action, callback, btn) {
|
|||
remove_empty_rows();
|
||||
|
||||
$(frm.wrapper).addClass('validated-form');
|
||||
if (check_mandatory()) {
|
||||
if (frm.is_dirty() && check_mandatory()) {
|
||||
_call({
|
||||
method: "frappe.desk.form.save.savedocs",
|
||||
args: { doc: frm.doc, action: action },
|
||||
|
|
@ -36,6 +36,7 @@ frappe.ui.form.save = function (frm, action, callback, btn) {
|
|||
freeze_message: freeze_message
|
||||
});
|
||||
} else {
|
||||
frappe.show_alert({message: __("Document not updated"), indicator: "yellow"});
|
||||
$(btn).prop("disabled", false);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue