Merge pull request #24613 from marination/shopping-cart

fix: Shopping cart breaks without Payment Gateway Account
This commit is contained in:
Marica
2021-02-16 23:05:19 +05:30
committed by GitHub
2 changed files with 11 additions and 4 deletions

View File

@@ -462,6 +462,9 @@ def get_party(user=None):
return customer return customer
def get_debtors_account(cart_settings): def get_debtors_account(cart_settings):
if not cart_settings.payment_gateway_account:
frappe.throw(_("Payment Gateway Account not set"), _("Mandatory"))
payment_gateway_account_currency = \ payment_gateway_account_currency = \
frappe.get_doc("Payment Gateway Account", cart_settings.payment_gateway_account).currency frappe.get_doc("Payment Gateway Account", cart_settings.payment_gateway_account).currency

View File

@@ -26,10 +26,10 @@
"quotation_series", "quotation_series",
"section_break_8", "section_break_8",
"enable_checkout", "enable_checkout",
"payment_success_url",
"column_break_11",
"save_quotations_as_draft", "save_quotations_as_draft",
"payment_gateway_account" "column_break_11",
"payment_gateway_account",
"payment_success_url"
], ],
"fields": [ "fields": [
{ {
@@ -143,10 +143,12 @@
}, },
{ {
"default": "Orders", "default": "Orders",
"depends_on": "enable_checkout",
"description": "After payment completion redirect user to selected page.", "description": "After payment completion redirect user to selected page.",
"fieldname": "payment_success_url", "fieldname": "payment_success_url",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Payment Success Url", "label": "Payment Success Url",
"mandatory_depends_on": "enable_checkout",
"options": "\nOrders\nInvoices\nMy Account" "options": "\nOrders\nInvoices\nMy Account"
}, },
{ {
@@ -154,9 +156,11 @@
"fieldtype": "Column Break" "fieldtype": "Column Break"
}, },
{ {
"depends_on": "enable_checkout",
"fieldname": "payment_gateway_account", "fieldname": "payment_gateway_account",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Payment Gateway Account", "label": "Payment Gateway Account",
"mandatory_depends_on": "enable_checkout",
"options": "Payment Gateway Account" "options": "Payment Gateway Account"
}, },
{ {
@@ -186,7 +190,7 @@
"idx": 1, "idx": 1,
"issingle": 1, "issingle": 1,
"links": [], "links": [],
"modified": "2021-02-01 18:18:54.606535", "modified": "2021-02-11 18:48:30.433058",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Shopping Cart", "module": "Shopping Cart",
"name": "Shopping Cart Settings", "name": "Shopping Cart Settings",