Merge pull request #37869 from ruthra-kumar/reconcile_only_on_voucher
refactor: 'group only by voucher' flag in AR/AP report
This commit is contained in:
commit
a9372c42cd
@ -143,7 +143,13 @@ frappe.query_reports["Accounts Payable"] = {
|
|||||||
"fieldname": "show_future_payments",
|
"fieldname": "show_future_payments",
|
||||||
"label": __("Show Future Payments"),
|
"label": __("Show Future Payments"),
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "ignore_accounts",
|
||||||
|
"label": __("Group by Voucher"),
|
||||||
|
"fieldtype": "Check",
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
"formatter": function(value, row, column, data, default_formatter) {
|
"formatter": function(value, row, column, data, default_formatter) {
|
||||||
@ -175,4 +181,4 @@ function get_party_type_options() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,13 @@ frappe.query_reports["Accounts Receivable"] = {
|
|||||||
"fieldname": "show_remarks",
|
"fieldname": "show_remarks",
|
||||||
"label": __("Show Remarks"),
|
"label": __("Show Remarks"),
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "ignore_accounts",
|
||||||
|
"label": __("Group by Voucher"),
|
||||||
|
"fieldtype": "Check",
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
"formatter": function(value, row, column, data, default_formatter) {
|
"formatter": function(value, row, column, data, default_formatter) {
|
||||||
@ -205,4 +211,4 @@ function get_party_type_options() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,12 @@ class ReceivablePayableReport(object):
|
|||||||
# build all keys, since we want to exclude vouchers beyond the report date
|
# build all keys, since we want to exclude vouchers beyond the report date
|
||||||
for ple in self.ple_entries:
|
for ple in self.ple_entries:
|
||||||
# get the balance object for voucher_type
|
# get the balance object for voucher_type
|
||||||
key = (ple.account, ple.voucher_type, ple.voucher_no, ple.party)
|
|
||||||
|
if self.filters.get("ingore_accounts"):
|
||||||
|
key = (ple.voucher_type, ple.voucher_no, ple.party)
|
||||||
|
else:
|
||||||
|
key = (ple.account, ple.voucher_type, ple.voucher_no, ple.party)
|
||||||
|
|
||||||
if not key in self.voucher_balance:
|
if not key in self.voucher_balance:
|
||||||
self.voucher_balance[key] = frappe._dict(
|
self.voucher_balance[key] = frappe._dict(
|
||||||
voucher_type=ple.voucher_type,
|
voucher_type=ple.voucher_type,
|
||||||
@ -183,7 +188,10 @@ class ReceivablePayableReport(object):
|
|||||||
):
|
):
|
||||||
return
|
return
|
||||||
|
|
||||||
key = (ple.account, ple.against_voucher_type, ple.against_voucher_no, ple.party)
|
if self.filters.get("ingore_accounts"):
|
||||||
|
key = (ple.against_voucher_type, ple.against_voucher_no, ple.party)
|
||||||
|
else:
|
||||||
|
key = (ple.account, ple.against_voucher_type, ple.against_voucher_no, ple.party)
|
||||||
|
|
||||||
# If payment is made against credit note
|
# If payment is made against credit note
|
||||||
# and credit note is made against a Sales Invoice
|
# and credit note is made against a Sales Invoice
|
||||||
@ -192,13 +200,19 @@ class ReceivablePayableReport(object):
|
|||||||
if ple.against_voucher_no in self.return_entries:
|
if ple.against_voucher_no in self.return_entries:
|
||||||
return_against = self.return_entries.get(ple.against_voucher_no)
|
return_against = self.return_entries.get(ple.against_voucher_no)
|
||||||
if return_against:
|
if return_against:
|
||||||
key = (ple.account, ple.against_voucher_type, return_against, ple.party)
|
if self.filters.get("ingore_accounts"):
|
||||||
|
key = (ple.against_voucher_type, return_against, ple.party)
|
||||||
|
else:
|
||||||
|
key = (ple.account, ple.against_voucher_type, return_against, ple.party)
|
||||||
|
|
||||||
row = self.voucher_balance.get(key)
|
row = self.voucher_balance.get(key)
|
||||||
|
|
||||||
if not row:
|
if not row:
|
||||||
# no invoice, this is an invoice / stand-alone payment / credit note
|
# no invoice, this is an invoice / stand-alone payment / credit note
|
||||||
row = self.voucher_balance.get((ple.account, ple.voucher_type, ple.voucher_no, ple.party))
|
if self.filters.get("ingore_accounts"):
|
||||||
|
row = self.voucher_balance.get((ple.voucher_type, ple.voucher_no, ple.party))
|
||||||
|
else:
|
||||||
|
row = self.voucher_balance.get((ple.account, ple.voucher_type, ple.voucher_no, ple.party))
|
||||||
|
|
||||||
row.party_type = ple.party_type
|
row.party_type = ple.party_type
|
||||||
return row
|
return row
|
||||||
|
Loading…
x
Reference in New Issue
Block a user