[fixes] compare attributes in lower case

This commit is contained in:
Saurabh 2016-01-21 15:43:07 +05:30
parent da297dcfc5
commit 883cc04701
8 changed files with 119 additions and 73 deletions

View File

@ -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;
}
}

View File

@ -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",

View File

@ -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) {

View File

@ -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",

View File

@ -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:

View File

@ -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"
}

View File

@ -82,14 +82,16 @@
<div class="cart-taxes row small">
<div class="col-sm-8"><!-- empty --></div>
<div class="col-sm-4">
{% if (doc.doctype=="Sales Order" and doc.per_billed <= 0)
or (doc.doctype=="Sales Invoice" and doc.outstanding_amount > 0) %}
<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&mute_email=1&cart=1"
class="btn btn-primary btn-sm">Pay {{ doc.get_formatted("grand_total") }} </a>
</p>
{% if enabled_checkout %}
{% if (doc.doctype=="Sales Order" and doc.per_billed <= 0)
or (doc.doctype=="Sales Invoice" and doc.outstanding_amount > 0) %}
<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&mute_email=1&cart=1"
class="btn btn-primary btn-sm">Pay {{ doc.get_formatted("grand_total") }} </a>
</p>
</div>
{% endif %}
{% endif %}
</div>
</div>

View File

@ -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)