mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-12 17:51:20 +00:00
feat: 'Name in Description' added to rank and match reason
- misc: avoid null party value matches - misc: unset hidden filter fields
This commit is contained in:
@@ -16,23 +16,23 @@ repos:
|
|||||||
- id: check-merge-conflict
|
- id: check-merge-conflict
|
||||||
- id: check-ast
|
- id: check-ast
|
||||||
|
|
||||||
# - repo: https://github.com/pre-commit/mirrors-eslint
|
- repo: https://github.com/pre-commit/mirrors-eslint
|
||||||
# rev: v8.44.0
|
rev: v8.44.0
|
||||||
# hooks:
|
hooks:
|
||||||
# - id: eslint
|
- id: eslint
|
||||||
# types_or: [javascript]
|
types_or: [javascript]
|
||||||
# args: ['--quiet']
|
args: ['--quiet']
|
||||||
# # Ignore any files that might contain jinja / bundles
|
# Ignore any files that might contain jinja / bundles
|
||||||
# exclude: |
|
exclude: |
|
||||||
# (?x)^(
|
(?x)^(
|
||||||
# erpnext/public/dist/.*|
|
erpnext/public/dist/.*|
|
||||||
# cypress/.*|
|
cypress/.*|
|
||||||
# .*node_modules.*|
|
.*node_modules.*|
|
||||||
# .*boilerplate.*|
|
.*boilerplate.*|
|
||||||
# erpnext/public/js/controllers/.*|
|
erpnext/public/js/controllers/.*|
|
||||||
# erpnext/templates/pages/order.js|
|
erpnext/templates/pages/order.js|
|
||||||
# erpnext/templates/includes/.*
|
erpnext/templates/includes/.*
|
||||||
# )$
|
)$
|
||||||
|
|
||||||
- repo: https://github.com/PyCQA/flake8
|
- repo: https://github.com/PyCQA/flake8
|
||||||
rev: 6.0.0
|
rev: 6.0.0
|
||||||
|
|||||||
@@ -311,9 +311,17 @@ def check_matching(
|
|||||||
as_dict=1,
|
as_dict=1,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return (
|
|
||||||
sorted(matching_vouchers, key=lambda x: x["rank"], reverse=True) if matching_vouchers else []
|
if not matching_vouchers:
|
||||||
)
|
return []
|
||||||
|
|
||||||
|
for voucher in matching_vouchers:
|
||||||
|
# higher rank if voucher name is in bank transaction
|
||||||
|
if voucher["name"] in transaction.description:
|
||||||
|
voucher["rank"] += 1
|
||||||
|
voucher["name_in_desc_match"] = 1
|
||||||
|
|
||||||
|
return sorted(matching_vouchers, key=lambda x: x["rank"], reverse=True)
|
||||||
|
|
||||||
|
|
||||||
def get_queries(
|
def get_queries(
|
||||||
@@ -439,7 +447,9 @@ def get_bt_matching_query(exact_match, transaction, exact_party_match):
|
|||||||
# same bank account must have same company and currency
|
# same bank account must have same company and currency
|
||||||
field = "deposit" if transaction.withdrawal > 0.0 else "withdrawal"
|
field = "deposit" if transaction.withdrawal > 0.0 else "withdrawal"
|
||||||
filter_by_party = (
|
filter_by_party = (
|
||||||
"AND party_type = %(party_type)s AND party = %(party)s" if exact_party_match else ""
|
"AND party_type = %(party_type)s AND party = %(party)s AND party IS NOT NULL"
|
||||||
|
if exact_party_match
|
||||||
|
else ""
|
||||||
)
|
)
|
||||||
|
|
||||||
return f"""
|
return f"""
|
||||||
@@ -447,7 +457,7 @@ def get_bt_matching_query(exact_match, transaction, exact_party_match):
|
|||||||
(
|
(
|
||||||
CASE WHEN reference_number = %(reference_no)s THEN 1 ELSE 0 END
|
CASE WHEN reference_number = %(reference_no)s THEN 1 ELSE 0 END
|
||||||
+ CASE WHEN {field} = %(amount)s THEN 1 ELSE 0 END
|
+ CASE WHEN {field} = %(amount)s THEN 1 ELSE 0 END
|
||||||
+ CASE WHEN ( party_type = %(party_type)s AND party = %(party)s ) THEN 1 ELSE 0 END
|
+ CASE WHEN ( party_type = %(party_type)s AND party = %(party)s AND party IS NOT NULL) THEN 1 ELSE 0 END
|
||||||
+ CASE WHEN unallocated_amount = %(amount)s THEN 1 ELSE 0 END
|
+ CASE WHEN unallocated_amount = %(amount)s THEN 1 ELSE 0 END
|
||||||
+ 1
|
+ 1
|
||||||
) AS rank,
|
) AS rank,
|
||||||
@@ -467,7 +477,7 @@ def get_bt_matching_query(exact_match, transaction, exact_party_match):
|
|||||||
CASE WHEN {field} = %(amount)s THEN 1 ELSE 0 END
|
CASE WHEN {field} = %(amount)s THEN 1 ELSE 0 END
|
||||||
) as amount_match,
|
) as amount_match,
|
||||||
(
|
(
|
||||||
CASE WHEN ( party_type = %(party_type)s AND party = %(party)s ) THEN 1 ELSE 0 END
|
CASE WHEN ( party_type = %(party_type)s AND party = %(party)s AND party IS NOT NULL) THEN 1 ELSE 0 END
|
||||||
) as party_match,
|
) as party_match,
|
||||||
(
|
(
|
||||||
CASE WHEN unallocated_amount = %(amount)s THEN 1 ELSE 0 END
|
CASE WHEN unallocated_amount = %(amount)s THEN 1 ELSE 0 END
|
||||||
@@ -596,13 +606,15 @@ def get_pe_matching_query(
|
|||||||
filter_by_reference_no = f"AND reference_no = '{transaction.reference_number}'"
|
filter_by_reference_no = f"AND reference_no = '{transaction.reference_number}'"
|
||||||
|
|
||||||
filter_by_party = (
|
filter_by_party = (
|
||||||
"AND (party_type = %(party_type)s AND party = %(party)s )" if exact_party_match else ""
|
"AND (party_type = %(party_type)s AND party = %(party)s AND party IS NOT NULL)"
|
||||||
|
if exact_party_match
|
||||||
|
else ""
|
||||||
)
|
)
|
||||||
|
|
||||||
return f"""
|
return f"""
|
||||||
SELECT
|
SELECT
|
||||||
(CASE WHEN reference_no=%(reference_no)s THEN 1 ELSE 0 END
|
(CASE WHEN reference_no=%(reference_no)s THEN 1 ELSE 0 END
|
||||||
+ CASE WHEN (party_type = %(party_type)s AND party = %(party)s ) THEN 1 ELSE 0 END
|
+ CASE WHEN (party_type = %(party_type)s AND party = %(party)s AND party IS NOT NULL) THEN 1 ELSE 0 END
|
||||||
+ CASE WHEN paid_amount = %(amount)s THEN 1 ELSE 0 END
|
+ CASE WHEN paid_amount = %(amount)s THEN 1 ELSE 0 END
|
||||||
+ 1 ) AS rank,
|
+ 1 ) AS rank,
|
||||||
'Payment Entry' as doctype,
|
'Payment Entry' as doctype,
|
||||||
@@ -615,7 +627,7 @@ def get_pe_matching_query(
|
|||||||
posting_date,
|
posting_date,
|
||||||
{currency_field},
|
{currency_field},
|
||||||
(CASE WHEN reference_no=%(reference_no)s THEN 1 ELSE 0 END) AS reference_number_match,
|
(CASE WHEN reference_no=%(reference_no)s THEN 1 ELSE 0 END) AS reference_number_match,
|
||||||
(CASE WHEN (party_type = %(party_type)s AND party = %(party)s ) THEN 1 ELSE 0 END) AS party_match,
|
(CASE WHEN (party_type = %(party_type)s AND party = %(party)s AND party IS NOT NULL) THEN 1 ELSE 0 END) AS party_match,
|
||||||
(CASE WHEN paid_amount = %(amount)s THEN 1 ELSE 0 END) AS amount_match
|
(CASE WHEN paid_amount = %(amount)s THEN 1 ELSE 0 END) AS amount_match
|
||||||
FROM
|
FROM
|
||||||
`tabPayment Entry`
|
`tabPayment Entry`
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ erpnext.accounts.bank_reconciliation.ActionsPanel = class ActionsPanel {
|
|||||||
"Party": row.party_match || 0,
|
"Party": row.party_match || 0,
|
||||||
"Transaction Amount": row.amount_match || 0,
|
"Transaction Amount": row.amount_match || 0,
|
||||||
"Unallocated Amount": row.unallocated_amount_match || 0,
|
"Unallocated Amount": row.unallocated_amount_match || 0,
|
||||||
|
"Name in Description": row.name_in_desc_match || 0,
|
||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
this.help_button(row.name),
|
this.help_button(row.name),
|
||||||
|
|||||||
Reference in New Issue
Block a user