Payment Entry minor improvements
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.json b/erpnext/accounts/doctype/payment_entry/payment_entry.json
index d40ba9d..d816eb8 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.json
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.json
@@ -852,32 +852,6 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
- "depends_on": "difference_amount",
- "fieldname": "write_off_difference_amount",
- "fieldtype": "Button",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_list_view": 0,
- "label": "Write Off Difference Amount",
- "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": "set_exchange_gain_loss",
"fieldtype": "Button",
"hidden": 0,
@@ -979,6 +953,32 @@
{
"allow_on_submit": 0,
"bold": 0,
+ "collapsible": 0,
+ "depends_on": "difference_amount",
+ "fieldname": "write_off_difference_amount",
+ "fieldtype": "Button",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Write Off Difference Amount",
+ "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": 1,
"collapsible_depends_on": "deductions",
"depends_on": "eval:(doc.paid_amount && doc.received_amount)",
@@ -1372,7 +1372,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-07-01 17:14:17.562924",
+ "modified": "2016-07-04 15:00:53.731584",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Entry",
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index d4d93a7..6e441e4 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -194,7 +194,7 @@
""", (self.party_account, self.party, d.reference_name), as_dict=True)
if not je_accounts:
- frappe.throw(_("Row #{0}: Journal Entry {0} does not have account {1} or already matched against another voucher")
+ frappe.throw(_("Row #{0}: Journal Entry {1} does not have account {2} or already matched against another voucher")
.format(d.idx, d.reference_name, self.party_account))
else:
dr_or_cr = "debit" if self.payment_type == "Receive" else "credit"
@@ -270,6 +270,7 @@
def validate_payment_against_negative_invoice(self):
if ((self.payment_type=="Pay" and self.party_type=="Customer")
or (self.payment_type=="Receive" and self.party_type=="Supplier")):
+
total_negative_outstanding = sum([abs(flt(d.outstanding_amount))
for d in self.get("references") if flt(d.outstanding_amount) < 0])
@@ -535,6 +536,7 @@
@frappe.whitelist()
def get_account_details(account, date):
+ frappe.has_permission('Payment Entry', throw=True)
return frappe._dict({
"account_currency": get_account_currency(account),
"account_balance": get_balance_on(account, date),
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 6bd5eb1..2d1b2db 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -434,15 +434,13 @@
dr_or_cr = "credit_in_account_currency - debit_in_account_currency"
payment_dr_or_cr = "payment_gl_entry.debit_in_account_currency - payment_gl_entry.credit_in_account_currency"
- invoice_list = frappe.db.sql("""select
- voucher_no, voucher_type, posting_date,
- ifnull(sum({dr_or_cr}), 0) as invoice_amount,
+ invoice_list = frappe.db.sql("""
+ select
+ voucher_no, voucher_type, posting_date, ifnull(sum({dr_or_cr}), 0) as invoice_amount,
(
- select
- ifnull(sum({payment_dr_or_cr}), 0)
+ select ifnull(sum({payment_dr_or_cr}), 0)
from `tabGL Entry` payment_gl_entry
- where
- payment_gl_entry.against_voucher_type = invoice_gl_entry.voucher_type
+ where payment_gl_entry.against_voucher_type = invoice_gl_entry.voucher_type
and payment_gl_entry.against_voucher = invoice_gl_entry.voucher_no
and payment_gl_entry.party_type = invoice_gl_entry.party_type
and payment_gl_entry.party = invoice_gl_entry.party
@@ -452,10 +450,8 @@
from
`tabGL Entry` invoice_gl_entry
where
- party_type = %(party_type)s
- and party = %(party)s
- and account = %(account)s
- and {dr_or_cr} > 0
+ party_type = %(party_type)s and party = %(party)s
+ and account = %(account)s and {dr_or_cr} > 0
{condition}
and ((voucher_type = 'Journal Entry'
and (against_voucher = '' or against_voucher is null))
diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py
index 9dd50f8..e93f017 100644
--- a/erpnext/config/accounts.py
+++ b/erpnext/config/accounts.py
@@ -22,9 +22,14 @@
"description": _("Payment Request")
},
{
+ "type": "doctype",
+ "name": "Payment Entry",
+ "description": _("Bank/Cash transactions against party or for internal transfer")
+ },
+ {
"type": "report",
"name": "Accounts Receivable",
- "doctype": "Sales Invoice",
+ "doctype": "Sales Invoice",
"is_query_report": True
},
{
@@ -46,11 +51,6 @@
},
{
"type": "doctype",
- "name": "Payment Entry",
- "description": _("Payment entries against party or for internal transfer")
- },
- {
- "type": "doctype",
"name": "Journal Entry",
"description": _("Accounting journal entries.")
},