[fix] Payment Reconciliation: use the date and amount filters only for Invoice
diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js
index eb84cb0..5075f15 100644
--- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js
+++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js
@@ -47,6 +47,11 @@
refresh: function() {
this.frm.disable_save();
+ this.toggle_primary_action();
+ },
+
+ onload_post_render: function() {
+ this.toggle_primary_action();
},
party: function() {
@@ -75,6 +80,7 @@
method: 'get_unreconciled_entries',
callback: function(r, rt) {
me.set_invoice_options();
+ me.toggle_primary_action();
}
});
@@ -87,10 +93,11 @@
method: 'reconcile',
callback: function(r, rt) {
me.set_invoice_options();
+ me.toggle_primary_action();
}
});
},
-
+
set_invoice_options: function() {
var invoices = [];
@@ -107,6 +114,20 @@
});
refresh_field("payments");
+ },
+
+ toggle_primary_action: function() {
+ if ((this.frm.doc.payments || []).length) {
+ this.frm.fields_dict.reconcile.$input
+ && this.frm.fields_dict.reconcile.$input.addClass("btn-primary");
+ this.frm.fields_dict.get_unreconciled_entries.$input
+ && this.frm.fields_dict.get_unreconciled_entries.$input.removeClass("btn-primary");
+ } else {
+ this.frm.fields_dict.reconcile.$input
+ && this.frm.fields_dict.reconcile.$input.removeClass("btn-primary");
+ this.frm.fields_dict.get_unreconciled_entries.$input
+ && this.frm.fields_dict.get_unreconciled_entries.$input.addClass("btn-primary");
+ }
}
});
diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json
index c889288..ef617b0 100644
--- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json
+++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json
@@ -19,10 +19,12 @@
"in_filter": 0,
"in_list_view": 0,
"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,
@@ -41,10 +43,12 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Party Type",
+ "length": 0,
"no_copy": 0,
"options": "DocType",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -64,10 +68,12 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Party",
+ "length": 0,
"no_copy": 0,
"options": "party_type",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -86,11 +92,13 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Receivable / Payable Account",
+ "length": 0,
"no_copy": 0,
"options": "Account",
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -109,10 +117,12 @@
"in_filter": 0,
"in_list_view": 1,
"label": "Bank / Cash Account",
+ "length": 0,
"no_copy": 0,
"options": "Account",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -131,9 +141,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -151,10 +163,12 @@
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
- "label": "From Date",
+ "label": "From Invoice Date",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -172,10 +186,12 @@
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
- "label": "To Date",
+ "label": "To Invoice Date",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -193,10 +209,12 @@
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
- "label": "Minimum Amount",
+ "label": "Minimum Invoice Amount",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -214,10 +232,12 @@
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
- "label": "Maximum Amount",
+ "label": "Maximum Invoice Amount",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -236,9 +256,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Get Unreconciled Entries",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -257,9 +279,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Unreconciled Payment Details",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -278,10 +302,12 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Payments",
+ "length": 0,
"no_copy": 0,
"options": "Payment Reconciliation Payment",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -300,9 +326,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Reconcile",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -321,9 +349,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Invoice/Journal Entry Details",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -342,10 +372,12 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Invoices",
+ "length": 0,
"no_copy": 0,
"options": "Payment Reconciliation Invoice",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -357,12 +389,15 @@
"hide_heading": 0,
"hide_toolbar": 1,
"icon": "icon-resize-horizontal",
+ "idx": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 1,
"istable": 0,
- "modified": "2015-09-21 03:41:24.672227",
+ "max_attachments": 0,
+ "menu_index": 0,
+ "modified": "2016-01-04 02:26:58.807921",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Reconciliation",
diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
index 8354556..832a346 100644
--- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
+++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
@@ -18,8 +18,6 @@
dr_or_cr = "credit_in_account_currency" if self.party_type == "Customer" \
else "debit_in_account_currency"
- cond = self.check_condition()
-
bank_account_condition = "t2.against_account like %(bank_cash_account)s" \
if self.bank_cash_account else "1=1"
@@ -34,7 +32,6 @@
and t2.party_type = %(party_type)s and t2.party = %(party)s
and t2.account = %(account)s and {dr_or_cr} > 0
and (t2.reference_type is null or t2.reference_type in ('', 'Sales Order', 'Purchase Order'))
- {cond}
and (CASE
WHEN t1.voucher_type in ('Debit Note', 'Credit Note')
THEN 1=1
@@ -42,7 +39,6 @@
END)
""".format(**{
"dr_or_cr": dr_or_cr,
- "cond": cond,
"bank_account_condition": bank_account_condition,
}), {
"party_type": self.party_type,
@@ -158,8 +154,8 @@
frappe.throw(_("Please select Allocated Amount, Invoice Type and Invoice Number in atleast one row"))
def check_condition(self):
- cond = " and posting_date >= {0}".format(frappe.db.escape(self.from_date)) if self.from_date else ""
- cond += " and posting_date <= {0}".format(frappe.db.escape(self.to_date)) if self.to_date else ""
+ cond = " and posting_date >= '{0}'".format(frappe.db.escape(self.from_date)) if self.from_date else ""
+ cond += " and posting_date <= '{0}'".format(frappe.db.escape(self.to_date)) if self.to_date else ""
if self.party_type == "Customer":
dr_or_cr = "debit_in_account_currency"