Skip to content

Commit

Permalink
Merge pull request #39643 from GursheenK/portal-po-pay-btn
Browse files Browse the repository at this point in the history
fix(portal): show PO pay button if payments installed
  • Loading branch information
rohitwaghchaure authored Jan 31, 2024
2 parents 6b8f046 + 7475233 commit 5e71d6a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion erpnext/buying/doctype/buying_settings/buying_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
},
{
"default": "1",
"depends_on": "eval: frappe.boot.versions && frappe.boot.versions.payments",
"fieldname": "show_pay_button",
"fieldtype": "Check",
"label": "Show Pay Button in Purchase Order Portal"
Expand Down Expand Up @@ -213,7 +214,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2024-01-30 14:04:43.177427",
"modified": "2024-01-31 13:34:18.101256",
"modified_by": "Administrator",
"module": "Buying",
"name": "Buying Settings",
Expand Down
12 changes: 12 additions & 0 deletions erpnext/templates/pages/order.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ <h3 class="m-0">{{ doc.name }}</h3>
</a>
</ul>
</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>
{% endblock %}

Expand Down
5 changes: 4 additions & 1 deletion erpnext/templates/pages/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ def get_context(context):
)
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
if context.doc.get("supplier"):
# show Make Purchase Invoice button based on permission
Expand Down

0 comments on commit 5e71d6a

Please sign in to comment.