fix(portal): show PO pay button if payments installed

(cherry picked from commit ae7be84d873cee0b0ea35614804a249ea56c05bb)
This commit is contained in:
Gursheen Anand 2024-01-30 17:24:59 +05:30 committed by Mergify
parent 29eb090528
commit cea4ed6f88
2 changed files with 16 additions and 1 deletions

View File

@ -34,6 +34,18 @@
</a> </a>
</ul> </ul>
</div> </div>
{% if show_pay_button %}
<div class="form-column col-sm-6">
<div class="page-header-actions-block" data-html-block="header-actions">
<p>
<a href="/api/method/erpnext.accounts.doctype.payment_request.payment_request.make_payment_request?dn={{ doc.name }}&dt={{ doc.doctype }}&submit_doc=1&order_type=Shopping Cart"
class="btn btn-primary btn-sm" id="pay-for-order">
{{ _("Pay") }} {{doc.get_formatted("grand_total") }}
</a>
</p>
</div>
</div>
{% endif %}
</div> </div>
{% endblock %} {% endblock %}

View File

@ -48,7 +48,10 @@ def get_context(context):
) )
context.available_loyalty_points = int(loyalty_program_details.get("loyalty_points")) context.available_loyalty_points = int(loyalty_program_details.get("loyalty_points"))
context.show_pay_button = frappe.db.get_single_value("Buying Settings", "show_pay_button") context.show_pay_button = (
"payments" in frappe.get_installed_apps()
and frappe.db.get_single_value("Buying Settings", "show_pay_button")
)
context.show_make_pi_button = False context.show_make_pi_button = False
if context.doc.get("supplier"): if context.doc.get("supplier"):
# show Make Purchase Invoice button based on permission # show Make Purchase Invoice button based on permission