fix(cheque_print_template): print format creation from cheque print template requires system manager (backport #55708) (#55711)

Co-authored-by: Diptanil Saha <diptanil@frappe.io>
fix(cheque_print_template): print format creation from cheque print template requires system manager (#55708)
This commit is contained in:
mergify[bot]
2026-06-09 13:01:40 +05:30
committed by GitHub
parent aeed6a459f
commit 2f5b93e308
5 changed files with 304 additions and 1060 deletions

View File

@@ -6,12 +6,14 @@ frappe.provide("erpnext.cheque_print");
frappe.ui.form.on("Cheque Print Template", { frappe.ui.form.on("Cheque Print Template", {
refresh: function (frm) { refresh: function (frm) {
if (!frm.doc.__islocal) { if (!frm.doc.__islocal) {
frm.add_custom_button( if (frappe.user.has_role("System Manager")) {
frm.doc.has_print_format ? __("Update Print Format") : __("Create Print Format"), frm.add_custom_button(
function () { frm.doc.has_print_format ? __("Update Print Format") : __("Create Print Format"),
erpnext.cheque_print.view_cheque_print(frm); function () {
} erpnext.cheque_print.view_cheque_print(frm);
).addClass("btn-primary"); }
).addClass("btn-primary");
}
$(frm.fields_dict.cheque_print_preview.wrapper).empty(); $(frm.fields_dict.cheque_print_preview.wrapper).empty();

View File

@@ -48,6 +48,8 @@ class ChequePrintTemplate(Document):
@frappe.whitelist() @frappe.whitelist()
def create_or_update_cheque_print_format(template_name): def create_or_update_cheque_print_format(template_name):
frappe.only_for("System Manager")
if not frappe.db.exists("Print Format", template_name): if not frappe.db.exists("Print Format", template_name):
cheque_print = frappe.new_doc("Print Format") cheque_print = frappe.new_doc("Print Format")
cheque_print.update( cheque_print.update(

View File

@@ -20,7 +20,6 @@ field_map = {
} }
def execute(filters=None): def execute(filters=None):
columns, data = get_columns(filters), get_data(filters) columns, data = get_columns(filters), get_data(filters)
return columns, data return columns, data

View File

@@ -88,6 +88,7 @@ def get_timesheets(project, start=0, search=None):
timesheet.update(info[0]) timesheet.update(info[0])
return timesheets return timesheets
def get_attachments(project): def get_attachments(project):
return frappe.get_all( return frappe.get_all(
"File", "File",