fix(portal): payment amount for orders
(cherry picked from commit c18ff5bd25)
# Conflicts:
# erpnext/templates/pages/order.py
This commit is contained in:
@@ -4,9 +4,13 @@
|
||||
import frappe
|
||||
from frappe import _
|
||||
|
||||
<<<<<<< HEAD
|
||||
from erpnext.accounts.doctype.payment_request.payment_request import (
|
||||
ALLOWED_DOCTYPES_FOR_PAYMENT_REQUEST,
|
||||
)
|
||||
=======
|
||||
from erpnext.accounts.doctype.payment_request.payment_request import get_amount
|
||||
>>>>>>> c18ff5bd25 (fix(portal): payment amount for orders)
|
||||
|
||||
|
||||
def get_context(context):
|
||||
@@ -50,11 +54,15 @@ def get_context(context):
|
||||
)
|
||||
context.available_loyalty_points = int(loyalty_program_details.get("loyalty_points"))
|
||||
|
||||
<<<<<<< HEAD
|
||||
context.show_pay_button = (
|
||||
"payments" in frappe.get_installed_apps()
|
||||
and frappe.db.get_single_value("Buying Settings", "show_pay_button")
|
||||
and context.doc.doctype in ALLOWED_DOCTYPES_FOR_PAYMENT_REQUEST
|
||||
)
|
||||
=======
|
||||
context.show_pay_button, context.pay_amount = get_payment_details(context.doc)
|
||||
>>>>>>> c18ff5bd25 (fix(portal): payment amount for orders)
|
||||
context.show_make_pi_button = False
|
||||
if context.doc.get("supplier"):
|
||||
# show Make Purchase Invoice button based on permission
|
||||
@@ -67,3 +75,14 @@ def get_attachments(dt, dn):
|
||||
fields=["name", "file_name", "file_url", "is_private"],
|
||||
filters={"attached_to_name": dn, "attached_to_doctype": dt, "is_private": 0},
|
||||
)
|
||||
|
||||
|
||||
def get_payment_details(doc):
|
||||
show_pay_button, amount = (
|
||||
"payments" in frappe.get_installed_apps()
|
||||
and frappe.db.get_single_value("Buying Settings", "show_pay_button")
|
||||
), 0
|
||||
if not show_pay_button:
|
||||
return show_pay_button, amount
|
||||
amount = get_amount(doc)
|
||||
return bool(amount), amount
|
||||
|
||||
Reference in New Issue
Block a user