fix: Remove get_matching_vouchers_for_bank_reconciliation
- There should only be one hook to add queries to `get_linked_payments` - `get_matching_queries` will be the only hook just like before
This commit is contained in:
parent
480903e3f4
commit
b9750f324b
@ -412,6 +412,18 @@ def check_matching(
|
|||||||
to_reference_date,
|
to_reference_date,
|
||||||
):
|
):
|
||||||
exact_match = True if "exact_match" in document_types else False
|
exact_match = True if "exact_match" in document_types else False
|
||||||
|
queries = get_queries(
|
||||||
|
bank_account,
|
||||||
|
company,
|
||||||
|
transaction,
|
||||||
|
document_types,
|
||||||
|
from_date,
|
||||||
|
to_date,
|
||||||
|
filter_by_reference_date,
|
||||||
|
from_reference_date,
|
||||||
|
to_reference_date,
|
||||||
|
exact_match,
|
||||||
|
)
|
||||||
|
|
||||||
filters = {
|
filters = {
|
||||||
"amount": transaction.unallocated_amount,
|
"amount": transaction.unallocated_amount,
|
||||||
@ -423,32 +435,15 @@ def check_matching(
|
|||||||
}
|
}
|
||||||
|
|
||||||
matching_vouchers = []
|
matching_vouchers = []
|
||||||
|
for query in queries:
|
||||||
# get matching vouchers from all the apps
|
matching_vouchers.extend(frappe.db.sql(query, filters, as_dict=True))
|
||||||
for method_name in frappe.get_hooks("get_matching_vouchers_for_bank_reconciliation"):
|
|
||||||
matching_vouchers.extend(
|
|
||||||
frappe.get_attr(method_name)(
|
|
||||||
bank_account,
|
|
||||||
company,
|
|
||||||
transaction,
|
|
||||||
document_types,
|
|
||||||
from_date,
|
|
||||||
to_date,
|
|
||||||
filter_by_reference_date,
|
|
||||||
from_reference_date,
|
|
||||||
to_reference_date,
|
|
||||||
exact_match,
|
|
||||||
filters,
|
|
||||||
)
|
|
||||||
or []
|
|
||||||
)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
sorted(matching_vouchers, key=lambda x: x["rank"], reverse=True) if matching_vouchers else []
|
sorted(matching_vouchers, key=lambda x: x["rank"], reverse=True) if matching_vouchers else []
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_matching_vouchers_for_bank_reconciliation(
|
def get_queries(
|
||||||
bank_account,
|
bank_account,
|
||||||
company,
|
company,
|
||||||
transaction,
|
transaction,
|
||||||
@ -459,7 +454,6 @@ def get_matching_vouchers_for_bank_reconciliation(
|
|||||||
from_reference_date,
|
from_reference_date,
|
||||||
to_reference_date,
|
to_reference_date,
|
||||||
exact_match,
|
exact_match,
|
||||||
filters,
|
|
||||||
):
|
):
|
||||||
# get queries to get matching vouchers
|
# get queries to get matching vouchers
|
||||||
account_from_to = "paid_to" if transaction.deposit > 0.0 else "paid_from"
|
account_from_to = "paid_to" if transaction.deposit > 0.0 else "paid_from"
|
||||||
@ -484,17 +478,7 @@ def get_matching_vouchers_for_bank_reconciliation(
|
|||||||
or []
|
or []
|
||||||
)
|
)
|
||||||
|
|
||||||
vouchers = []
|
return queries
|
||||||
for query in queries:
|
|
||||||
vouchers.extend(
|
|
||||||
frappe.db.sql(
|
|
||||||
query,
|
|
||||||
filters,
|
|
||||||
as_dict=True,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
return vouchers
|
|
||||||
|
|
||||||
|
|
||||||
def get_matching_queries(
|
def get_matching_queries(
|
||||||
|
@ -558,8 +558,6 @@ get_matching_queries = (
|
|||||||
"erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.get_matching_queries"
|
"erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.get_matching_queries"
|
||||||
)
|
)
|
||||||
|
|
||||||
get_matching_vouchers_for_bank_reconciliation = "erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.get_matching_vouchers_for_bank_reconciliation"
|
|
||||||
|
|
||||||
get_amounts_not_reflected_in_system_for_bank_reconciliation_statement = "erpnext.accounts.report.bank_reconciliation_statement.bank_reconciliation_statement.get_amounts_not_reflected_in_system_for_bank_reconciliation_statement"
|
get_amounts_not_reflected_in_system_for_bank_reconciliation_statement = "erpnext.accounts.report.bank_reconciliation_statement.bank_reconciliation_statement.get_amounts_not_reflected_in_system_for_bank_reconciliation_statement"
|
||||||
|
|
||||||
get_payment_entries_for_bank_clearance = (
|
get_payment_entries_for_bank_clearance = (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user