fix(accounts): respect account payable checkbox in cheque printing

(cherry picked from commit 911b3546dd)
This commit is contained in:
nareshkannasln
2026-10-24 08:23:10 +00:00
committed by Mergify
parent 091d8abdf1
commit e6be39af05
2 changed files with 16 additions and 7 deletions
@@ -23,10 +23,12 @@ frappe.ui.form.on("Cheque Print Template", {
height: {{ cheque_height }}cm;\
background-repeat: no-repeat;\
background-size: cover;">\
{% if is_account_payable %}\
<span style="top: {{ acc_pay_dist_from_top_edge }}cm;\
left: {{ acc_pay_dist_from_left_edge }}cm;\
border-bottom: solid 1px;border-top:solid 1px;\
position: absolute;"> {{ message_to_show || __("Account Pay Only") }} </span>\
{% endif %}\
<span style="top: {{ date_dist_from_top_edge }}cm;\
left: {{ date_dist_from_left_edge }}cm;\
position: absolute;"> {{ frappe.datetime.obj_to_user() }} </span>\
@@ -66,6 +66,18 @@ def create_or_update_cheque_print_format(template_name):
doc = frappe.get_doc("Cheque Print Template", template_name)
account_payee = ""
if doc.is_account_payable:
account_payee = """
<span style="top:{acc_pay_dist_from_top_edge}cm; left:{acc_pay_dist_from_left_edge}cm;
border-bottom: solid 1px;border-top:solid 1px; width:2cm;text-align: center; position: absolute;">
{message_to_show}
</span>""".format(
acc_pay_dist_from_top_edge=doc.acc_pay_dist_from_top_edge,
acc_pay_dist_from_left_edge=doc.acc_pay_dist_from_left_edge,
message_to_show=doc.message_to_show or _("Account Pay Only"),
)
cheque_print.html = """
<style>
.print-format {{
@@ -79,10 +91,7 @@ def create_or_update_cheque_print_format(template_name):
</style>
<div style="position: relative; top:{starting_position_from_top_edge}cm">
<div style="width:{cheque_width}cm;height:{cheque_height}cm;">
<span style="top:{acc_pay_dist_from_top_edge}cm; left:{acc_pay_dist_from_left_edge}cm;
border-bottom: solid 1px;border-top:solid 1px; width:2cm;text-align: center; position: absolute;">
{message_to_show}
</span>
{account_payee}
<span style="top:{date_dist_from_top_edge}cm; left:{date_dist_from_left_edge}cm;
position: absolute;">
{{{{ frappe.utils.formatdate(doc.reference_date) or '' }}}}
@@ -115,9 +124,7 @@ def create_or_update_cheque_print_format(template_name):
else 0.0,
cheque_width=doc.cheque_width,
cheque_height=doc.cheque_height,
acc_pay_dist_from_top_edge=doc.acc_pay_dist_from_top_edge,
acc_pay_dist_from_left_edge=doc.acc_pay_dist_from_left_edge,
message_to_show=doc.message_to_show if doc.message_to_show else _("Account Pay Only"),
account_payee=account_payee,
date_dist_from_top_edge=doc.date_dist_from_top_edge,
date_dist_from_left_edge=doc.date_dist_from_left_edge,
acc_no_dist_from_top_edge=doc.acc_no_dist_from_top_edge,