diff --git a/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.js b/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.js index c9bdc9b80a..e1fe5a16a3 100644 --- a/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.js +++ b/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.js @@ -1,6 +1,6 @@ cur_frm.cscript.refresh = function(doc, dt, dn){ if(!doc.__islocal){ - var df = frappe.meta.get_docfield(doc.doctype, "gateway", doc.name); + var df = frappe.meta.get_docfield(doc.doctype, "payment_gateway", doc.name); df.read_only = 1; } } \ No newline at end of file diff --git a/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.json b/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.json index 579c2c29b3..df8eaebed5 100644 --- a/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.json +++ b/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.json @@ -12,7 +12,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "fieldname": "gateway", + "fieldname": "payment_gateway", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, @@ -203,30 +203,6 @@ "search_index": 0, "set_only_once": 0, "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "payment_success_url", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Payment Success URL", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 } ], "hide_heading": 0, @@ -238,7 +214,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-01-18 03:53:50.534673", + "modified": "2016-01-21 11:32:10.311015", "modified_by": "Administrator", "module": "Accounts", "name": "Payment Gateway Account", diff --git a/erpnext/accounts/doctype/payment_request/payment_request.js b/erpnext/accounts/doctype/payment_request/payment_request.js index b519dee734..51ff50bb03 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.js +++ b/erpnext/accounts/doctype/payment_request/payment_request.js @@ -1,8 +1,7 @@ cur_frm.add_fetch("payment_gateway", "payment_account", "payment_account") -cur_frm.add_fetch("payment_gateway", "gateway", "gateway") +cur_frm.add_fetch("payment_gateway", "payment_gateway", "payment_gateway") cur_frm.add_fetch("payment_gateway", "message", "message") cur_frm.add_fetch("payment_gateway", "payment_url_message", "payment_url_message") -cur_frm.add_fetch("payment_gateway", "payment_success_url", "payment_success_url") frappe.ui.form.on("Payment Request", "onload", function(frm, dt, dn){ if (frm.doc.reference_doctype) { diff --git a/erpnext/accounts/doctype/payment_request/payment_request.json b/erpnext/accounts/doctype/payment_request/payment_request.json index 7655b5872e..bfd6442edf 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.json +++ b/erpnext/accounts/doctype/payment_request/payment_request.json @@ -183,13 +183,13 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "fieldname": "payment_gateway", + "fieldname": "payment_gateway_account", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "in_filter": 0, "in_list_view": 0, - "label": "Payment Gateway", + "label": "Payment Gateway Account", "length": 0, "no_copy": 0, "options": "Payment Gateway Account", @@ -204,30 +204,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "payment_success_url", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Payment Success URL", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_on_submit": 0, "bold": 0, @@ -255,16 +231,16 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "fieldname": "gateway", + "fieldname": "payment_gateway", "fieldtype": "Read Only", "hidden": 0, "ignore_user_permissions": 0, "in_filter": 0, "in_list_view": 0, - "label": "Gateway", + "label": "Payment Gateway", "length": 0, "no_copy": 0, - "options": "payment_gateway.gateway", + "options": "payment_gateway_account.payment_gateway", "permlevel": 0, "precision": "", "print_hide": 0, @@ -289,7 +265,7 @@ "label": "Payment Account", "length": 0, "no_copy": 0, - "options": "payment_gateway.payment_account", + "options": "payment_gateway_account.payment_account", "permlevel": 0, "precision": "", "print_hide": 0, @@ -603,7 +579,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-01-11 05:49:28.342786", + "modified": "2016-01-21 11:44:04.920584", "modified_by": "Administrator", "module": "Accounts", "name": "Payment Request", diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py index ba7413d886..b1af6cc02f 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.py +++ b/erpnext/accounts/doctype/payment_request/payment_request.py @@ -12,8 +12,6 @@ from erpnext.accounts.utils import get_account_currency, get_balance_on from erpnext.accounts.doctype.journal_entry.journal_entry import (get_payment_entry_against_invoice, get_payment_entry_against_order) -from itertools import chain - class PaymentRequest(Document): def validate(self): self.validate_payment_gateway_account() @@ -207,11 +205,11 @@ def get_gateway_details(args): """return gateway and payment account of default payment gateway""" if args.payemnt_gateway: gateway_account = frappe.db.get_value("Payment Gateway Account", args.payemnt_gateway, - ["name", "gateway", "payment_account", "message", "payment_url_message", "payment_success_url"], + ["name", "payment_gateway", "payment_account", "message", "payment_url_message"], as_dict=1) gateway_account = frappe.db.get_value("Payment Gateway Account", {"is_default": 1}, - ["name", "gateway", "payment_account", "message", "payment_url_message", "payment_success_url"], + ["name", "payment_gateway", "payment_account", "message", "payment_url_message"], as_dict=1) if not gateway_account: diff --git a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json index fbc9ba0220..5b9dc32a2e 100644 --- a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json +++ b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json @@ -19,9 +19,11 @@ "in_filter": 0, "in_list_view": 1, "label": "Enable Shopping Cart", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -39,9 +41,11 @@ "ignore_user_permissions": 0, "in_filter": 0, "in_list_view": 0, + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -60,10 +64,12 @@ "in_filter": 0, "in_list_view": 1, "label": "Company", + "length": 0, "no_copy": 0, "options": "Company", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -82,11 +88,13 @@ "in_filter": 0, "in_list_view": 0, "label": "Price List", + "length": 0, "no_copy": 0, "options": "Price List", "permlevel": 0, "precision": "", "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -104,9 +112,11 @@ "ignore_user_permissions": 0, "in_filter": 0, "in_list_view": 0, + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -126,10 +136,12 @@ "in_filter": 0, "in_list_view": 0, "label": "Default Customer Group", + "length": 0, "no_copy": 0, "options": "Customer Group", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -148,15 +160,92 @@ "in_filter": 0, "in_list_view": 0, "label": "Quotation Series", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, "search_index": 0, "set_only_once": 0, "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "collapsible_depends_on": "eval:doc.enable_checkout", + "fieldname": "section_break_8", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Checkout Settings", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "enable_checkout", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Enable Checkout", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "default": "Orders", + "fieldname": "payment_success_url", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Payment Success Url", + "length": 0, + "no_copy": 0, + "options": "\nOrders\nInvoices\nMy Account", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], "hide_heading": 0, @@ -168,7 +257,8 @@ "is_submittable": 0, "issingle": 1, "istable": 0, - "modified": "2015-09-17 07:56:09.176098", + "max_attachments": 0, + "modified": "2016-02-01 11:58:39.741582", "modified_by": "Administrator", "module": "Shopping Cart", "name": "Shopping Cart Settings", @@ -196,5 +286,6 @@ } ], "read_only": 0, - "read_only_onload": 0 + "read_only_onload": 0, + "sort_order": "ASC" } \ No newline at end of file diff --git a/erpnext/templates/pages/order.html b/erpnext/templates/pages/order.html index fae55f3264..3252eb9eb5 100644 --- a/erpnext/templates/pages/order.html +++ b/erpnext/templates/pages/order.html @@ -82,14 +82,16 @@
- {% if (doc.doctype=="Sales Order" and doc.per_billed <= 0) - or (doc.doctype=="Sales Invoice" and doc.outstanding_amount > 0) %} -
-

- Pay {{ doc.get_formatted("grand_total") }} -

+ {% if enabled_checkout %} + {% if (doc.doctype=="Sales Order" and doc.per_billed <= 0) + or (doc.doctype=="Sales Invoice" and doc.outstanding_amount > 0) %} + + {% endif %} {% endif %}
diff --git a/erpnext/templates/pages/order.py b/erpnext/templates/pages/order.py index 4824d4403f..5cb3ff23dd 100644 --- a/erpnext/templates/pages/order.py +++ b/erpnext/templates/pages/order.py @@ -15,6 +15,10 @@ def get_context(context): context.parents = frappe.form_dict.parents context.payment_ref = frappe.db.get_value("Payment Request", {"reference_name": frappe.form_dict.name}, "name") + + context.enabled_checkout = frappe.get_doc("Shopping Cart Settings").enable_checkout + + print context.enabled_checkout if not context.doc.has_website_permission("read"): frappe.throw(_("Not Permitted"), frappe.PermissionError)