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

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

(cherry picked from commit faf92b1368)

# Conflicts:
#	erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py

* chore: resolved conflicts

---------

Co-authored-by: Diptanil Saha <diptanil@frappe.io>
This commit is contained in:
mergify[bot]
2026-06-08 07:48:24 +00:00
committed by GitHub
parent 4471666c8c
commit 38dd2982f3
3 changed files with 15 additions and 12 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

@@ -1,5 +1,6 @@
{ {
"actions": [], "actions": [],
"allow_bulk_edit": 1,
"autoname": "field:bank_name", "autoname": "field:bank_name",
"creation": "2016-05-04 14:35:00.402544", "creation": "2016-05-04 14:35:00.402544",
"doctype": "DocType", "doctype": "DocType",
@@ -294,7 +295,7 @@
], ],
"links": [], "links": [],
"max_attachments": 1, "max_attachments": 1,
"modified": "2024-03-27 13:06:44.654989", "modified": "2026-06-08 12:10:35.829531",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Cheque Print Template", "name": "Cheque Print Template",
@@ -325,19 +326,17 @@
"write": 1 "write": 1
}, },
{ {
"create": 1,
"delete": 1,
"email": 1, "email": 1,
"export": 1, "export": 1,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts User", "role": "Accounts User",
"share": 1, "share": 1
"write": 1
} }
], ],
"row_format": "Dynamic",
"sort_field": "creation", "sort_field": "creation",
"sort_order": "DESC", "sort_order": "DESC",
"states": [] "states": []
} }

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(