fix: show read only indicator
This commit is contained in:
parent
e3a67b1aa1
commit
3f3bf04395
2 changed files with 10 additions and 5 deletions
|
|
@ -64,7 +64,7 @@ class FormBuilder {
|
|||
() => this.store.dirty,
|
||||
(dirty) => {
|
||||
if (dirty) {
|
||||
this.page.set_indicator("Not Saved", "orange");
|
||||
this.page.set_indicator(__("Not Saved"), "orange");
|
||||
this.reset_changes_btn.show();
|
||||
} else {
|
||||
this.page.clear_indicator();
|
||||
|
|
@ -85,7 +85,10 @@ class FormBuilder {
|
|||
|
||||
watch(
|
||||
() => this.store.read_only,
|
||||
(value) => this.primary_btn.toggle(!value),
|
||||
(value) => {
|
||||
this.primary_btn.toggle(!value);
|
||||
value && this.page.set_indicator(__("Read Only"), "orange");
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,10 +53,8 @@ export const useStore = defineStore("store", {
|
|||
doc.doc_type = this.doctype;
|
||||
let r = await frappe.call({ method: "fetch_to_customize", doc });
|
||||
this.doc = r.docs[0];
|
||||
this.read_only = false;
|
||||
} else {
|
||||
this.doc = await frappe.db.get_doc("DocType", this.doctype);
|
||||
this.read_only = !frappe.boot.developer_mode && !this.doc.custom;
|
||||
}
|
||||
|
||||
if (!this.get_docfields.length) {
|
||||
|
|
@ -72,7 +70,11 @@ export const useStore = defineStore("store", {
|
|||
|
||||
this.layout = this.get_layout();
|
||||
this.active_tab = this.layout.tabs[0].df.name;
|
||||
nextTick(() => (this.dirty = false));
|
||||
nextTick(() => {
|
||||
this.dirty = false;
|
||||
this.read_only =
|
||||
!this.is_customize_form && !frappe.boot.developer_mode && !this.doc.custom;
|
||||
});
|
||||
},
|
||||
async reset_changes() {
|
||||
await this.fetch();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue