Skip to content

feat(Bank Reconcilitation Beta): prioritize ranking parameters#331

Open
PatrickDEissler wants to merge 2 commits intoversion-15-hotfixfrom
matching-priority
Open

feat(Bank Reconcilitation Beta): prioritize ranking parameters#331
PatrickDEissler wants to merge 2 commits intoversion-15-hotfixfrom
matching-priority

Conversation

@PatrickDEissler
Copy link
Collaborator

Problem

All parameters (like date, name, amount) etc. had the same strength in for the ranking in "Match Voucher" tab.
Example: Purchase Invoices are rarely paid on the Posting Date, but they are often paid with the exact Grand Total. Currently both parameters have the same effect on the ranking.

Assumption of this PR

In practice a prioritization of the parameters increase the chances of having the correct vouchers further up in the list of vouchers.

Solution

Add hardcoded weights to prioritize the ranking in the Bank Reconciliation Beta (Match Voucher).

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces weighted ranking parameters for the Bank Reconciliation Beta feature to prioritize matching criteria. The change addresses the issue where all parameters (date, name, amount, reference) had equal weight in voucher matching, which was suboptimal for real-world scenarios where exact amounts are more reliable indicators than posting dates (especially for Purchase Invoices).

Changes:

  • Added six weight constants (REF_RANK_WEIGHT=3, PARTY_RANK_WEIGHT=2, AMOUNT_RANK_WEIGHT=2, DATE_RANK_WEIGHT=1, NAME_MATCH_WEIGHT=3, REF_MATCH_WEIGHT=3) to prioritize ranking parameters
  • Updated all rank_expression calculations across 10 matching query functions to apply these weights
  • Removed the post-processing rank increment for reference number matches found in transaction descriptions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

reference_no = voucher["reference_no"]
if reference_no and (reference_no.strip() in transaction.description):
voucher["rank"] += 1
voucher["name_in_desc_match"] = 1
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rank increment for reference number matches found in transaction description was removed but should have been updated to use the weight. For voucher types that don't compute name_match in their SQL queries (Bank Transaction, Loan Disbursement, Loan Repayment, Payment Entry, Journal Entry), this post-processing step needs to apply the weighted rank increment. The line should be: voucher["rank"] += REF_MATCH_WEIGHT

Suggested change
voucher["name_in_desc_match"] = 1
voucher["rank"] += REF_MATCH_WEIGHT

Copilot uses AI. Check for mistakes.
Comment on lines +32 to +37
REF_RANK_WEIGHT = 3 # Reference number match
PARTY_RANK_WEIGHT = 2 # Party match
AMOUNT_RANK_WEIGHT = 2 # Amount match
DATE_RANK_WEIGHT = 1 # Date match
NAME_MATCH_WEIGHT = 3 # Name (Paid From) match
REF_MATCH_WEIGHT = 3 # Reference number match in description
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment for REF_MATCH_WEIGHT says "Reference number match in description" but REF_RANK_WEIGHT also says "Reference number match". These should be more clearly differentiated. REF_RANK_WEIGHT should say "Reference field equality match" and REF_MATCH_WEIGHT should say "Reference number found in transaction description".

Suggested change
REF_RANK_WEIGHT = 3 # Reference number match
PARTY_RANK_WEIGHT = 2 # Party match
AMOUNT_RANK_WEIGHT = 2 # Amount match
DATE_RANK_WEIGHT = 1 # Date match
NAME_MATCH_WEIGHT = 3 # Name (Paid From) match
REF_MATCH_WEIGHT = 3 # Reference number match in description
REF_RANK_WEIGHT = 3 # Reference field equality match
PARTY_RANK_WEIGHT = 2 # Party match
AMOUNT_RANK_WEIGHT = 2 # Amount match
DATE_RANK_WEIGHT = 1 # Date match
NAME_MATCH_WEIGHT = 3 # Name (Paid From) match
REF_MATCH_WEIGHT = 3 # Reference number found in transaction description

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants