瀏覽代碼

fix: customizing print formats

Currently system managers can only customize the print formats even though
the other roles has a permissions to do so. Fixed it to show
customize button based on permissions.

(cherry picked from commit f9486fce5f)
version-14
leela 3 年之前
committed by mergify-bot
父節點
當前提交
3594890eb2
共有 3 個檔案被更改,包括 18 行新增16 行删除
  1. +16
    -14
      frappe/printing/doctype/print_format/print_format.js
  2. +1
    -1
      frappe/printing/page/print/print.js
  3. +1
    -1
      frappe/public/js/frappe/views/pageview.js

+ 16
- 14
frappe/printing/doctype/print_format/print_format.js 查看文件

@@ -36,21 +36,23 @@ frappe.ui.form.on("Print Format", {
else if (frm.doc.custom_format && !frm.doc.raw_printing) {
frm.set_df_property("html", "reqd", 1);
}
frappe.db.get_value('DocType', frm.doc.doc_type, 'default_print_format', (r) => {
if (r.default_print_format != frm.doc.name) {
frm.add_custom_button(__("Set as Default"), function () {
frappe.call({
method: "frappe.printing.doctype.print_format.print_format.make_default",
args: {
name: frm.doc.name
},
callback: function() {
frm.refresh();
}
if (frappe.perm.has_perm('DocType', 0, 'read', frm.doc.doc_type)) {
frappe.db.get_value('DocType', frm.doc.doc_type, 'default_print_format', (r) => {
if (r.default_print_format != frm.doc.name) {
frm.add_custom_button(__("Set as Default"), function () {
frappe.call({
method: "frappe.printing.doctype.print_format.print_format.make_default",
args: {
name: frm.doc.name
},
callback: function() {
frm.refresh();
}
});
});
});
}
});
}
});
}
}
},
custom_format: function (frm) {


+ 1
- 1
frappe/printing/page/print/print.js 查看文件

@@ -174,7 +174,7 @@ frappe.ui.form.PrintView = class {
});
}

if (frappe.user.has_role('System Manager')) {
if (frappe.perm.has_perm('Print Format', 0, 'create')) {
this.page.add_menu_item(__('Customize'), () =>
this.edit_print_format()
);


+ 1
- 1
frappe/public/js/frappe/views/pageview.js 查看文件

@@ -148,4 +148,4 @@ frappe.show_message_page = function(opts) {
);

frappe.container.change_to(opts.page_name);
};
};

Loading…
取消
儲存