diff --git a/erpnext/buying/doctype/buying_settings/buying_settings.json b/erpnext/buying/doctype/buying_settings/buying_settings.json index f7da64918ced4fba3e9f7055962a10cf40ec637d..7b7619aaeca124bb396edd4d65227ae3050d46b2 100644 --- a/erpnext/buying/doctype/buying_settings/buying_settings.json +++ b/erpnext/buying/doctype/buying_settings/buying_settings.json @@ -149,6 +149,13 @@ "fieldtype": "Check", "label": "Disable Last Purchase Rate" }, + { + "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" + }, { "default": "0", "depends_on": "eval: !doc.maintain_same_rate", @@ -207,7 +214,7 @@ "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2024-01-12 16:42:01.894346", + "modified": "2024-01-31 13:34:18.101256", "modified_by": "Administrator", "module": "Buying", "name": "Buying Settings", diff --git a/erpnext/templates/pages/order.html b/erpnext/templates/pages/order.html index 038a72f271191441583d531ab3aab803ae762ee9..398dacc6f51fe322fa1ab2dd355deafac3825b51 100644 --- a/erpnext/templates/pages/order.html +++ b/erpnext/templates/pages/order.html @@ -34,6 +34,18 @@ + {% if show_pay_button %} +
+
+

+ + {{ _("Pay") }} {{doc.get_formatted("grand_total") }} + +

+
+
+ {% endif %} {% endblock %} diff --git a/erpnext/templates/pages/order.py b/erpnext/templates/pages/order.py index eb8fcc96b50889371a042144105f3843f681fd50..21d4b860d1fa891c1431821fae3f40efbb986aa8 100644 --- a/erpnext/templates/pages/order.py +++ b/erpnext/templates/pages/order.py @@ -48,6 +48,10 @@ def get_context(context): ) context.available_loyalty_points = int(loyalty_program_details.get("loyalty_points")) + 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