Skip to content

feat: Bank Reconciliation Rule Preview & Filter Preset#366

Merged
barredterra merged 15 commits into
alyf-de:version-15-hotfixfrom
0xD0M1M0:bank-rule-filter-preview
Jul 18, 2026
Merged

feat: Bank Reconciliation Rule Preview & Filter Preset#366
barredterra merged 15 commits into
alyf-de:version-15-hotfixfrom
0xD0M1M0:bank-rule-filter-preview

Conversation

@0xD0M1M0

Copy link
Copy Markdown
Contributor

Proposed solution for #359

@greptile-apps

greptile-apps Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge. The new stats endpoint, filter preview, and rule-creation dialog are all well-guarded and the previous review concerns have been addressed.

The endpoint correctly caps counts matching Frappe list-view pattern, validates doctype membership before query execution, and handles stale async responses through a request-id counter. The pluck parameter is supported in the Frappe v15 DatabaseQuery context. The only finding is a minor double-normalization of filter rows that does not affect correctness.

No files require special attention.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant BT as Bank Transaction Form
    participant RCD as rule_creation_dialog.bundle.js
    participant BRR as Bank Reconciliation Rule Form
    participant SM as BankReconciliationRuleStatsManager
    participant PY as bank_reconciliation_rule.py

    BT->>RCD: frappe.require → show_rule_creation_dialog(doc)
    RCD->>RCD: get_visible_field_rows(doc)
    RCD->>RCD: Dialog: user selects fields
    RCD->>BRR: "frappe.route_options = {bank_account, filters}"

    BRR->>SM: refresh → new BankReconciliationRuleStatsManager(frm)
    BRR->>SM: stats.needs_filter_rerender() → true
    BRR->>BRR: frm.trigger(render_bt_filters)
    BRR->>SM: stats.teardown()
    BRR->>BRR: Build FilterGroup from frm.doc.filters
    BRR->>SM: stats.mount(parent)

    SM->>PY: frappe.call(get_bank_transaction_match_stats)
    PY->>PY: frappe.has_permission(Bank Transaction)
    PY->>PY: _normalize_filter_rows(user_filters)
    PY->>PY: _approx_bank_transaction_count (30d)
    PY->>PY: _approx_bank_transaction_count (12m)
    PY-->>SM: "{last_30_days, last_12_months, count_upper_bound}"
    SM->>BRR: Render match counts

    BRR->>SM: Open Matches → open_bank_transaction_list()
    SM->>SM: filters_to_route_options(merged)
    SM->>BT: frappe.set_route(List, Bank Transaction)
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant BT as Bank Transaction Form
    participant RCD as rule_creation_dialog.bundle.js
    participant BRR as Bank Reconciliation Rule Form
    participant SM as BankReconciliationRuleStatsManager
    participant PY as bank_reconciliation_rule.py

    BT->>RCD: frappe.require → show_rule_creation_dialog(doc)
    RCD->>RCD: get_visible_field_rows(doc)
    RCD->>RCD: Dialog: user selects fields
    RCD->>BRR: "frappe.route_options = {bank_account, filters}"

    BRR->>SM: refresh → new BankReconciliationRuleStatsManager(frm)
    BRR->>SM: stats.needs_filter_rerender() → true
    BRR->>BRR: frm.trigger(render_bt_filters)
    BRR->>SM: stats.teardown()
    BRR->>BRR: Build FilterGroup from frm.doc.filters
    BRR->>SM: stats.mount(parent)

    SM->>PY: frappe.call(get_bank_transaction_match_stats)
    PY->>PY: frappe.has_permission(Bank Transaction)
    PY->>PY: _normalize_filter_rows(user_filters)
    PY->>PY: _approx_bank_transaction_count (30d)
    PY->>PY: _approx_bank_transaction_count (12m)
    PY-->>SM: "{last_30_days, last_12_months, count_upper_bound}"
    SM->>BRR: Render match counts

    BRR->>SM: Open Matches → open_bank_transaction_list()
    SM->>SM: filters_to_route_options(merged)
    SM->>BT: frappe.set_route(List, Bank Transaction)
Loading

Reviews (9): Last reviewed commit: "perf(bank reconciliation rule): use capp..." | Re-trigger Greptile

@0xD0M1M0 0xD0M1M0 changed the title Bank Reconciliation Rule Filter Preview Bank Reconciliation Rule Preview & Filter Preset May 15, 2026
Comment thread banking/custom/bank_transaction.js Outdated
Comment thread banking/custom/bank_transaction.js
@barredterra barredterra changed the title Bank Reconciliation Rule Preview & Filter Preset feat: Bank Reconciliation Rule Preview & Filter Preset Jul 17, 2026
@barredterra
barredterra merged commit 1eea476 into alyf-de:version-15-hotfix Jul 18, 2026
4 checks passed
@barredterra

Copy link
Copy Markdown
Member

@Mergifyio backport version-16-hotfix

@mergify

mergify Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

backport version-16-hotfix

✅ Backports have been created

Details

Cherry-pick of 1eea476 has failed:

On branch mergify/bp/version-16-hotfix/pr-366
Your branch is up to date with 'origin/version-16-hotfix'.

You are currently cherry-picking commit 1eea476.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   banking/custom/bank_transaction.js
	modified:   banking/klarna_kosma_integration/doctype/bank_reconciliation_rule/bank_reconciliation_rule.js
	modified:   banking/klarna_kosma_integration/doctype/bank_reconciliation_rule/bank_reconciliation_rule.py
	new file:   banking/public/js/bank_reconciliation_rule_stats.bundle.js
	new file:   banking/public/js/rule_creation_dialog.bundle.js

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   banking/klarna_kosma_integration/doctype/bank_reconciliation_rule/test_bank_reconciliation_rule.py

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

barredterra added a commit that referenced this pull request Jul 18, 2026
#402)

Co-authored-by: barredterra <14891507+barredterra@users.noreply.github.com>
Co-authored-by: 0xD0M1M0 <76812428+0xD0M1M0@users.noreply.github.com>
@barredterra

Copy link
Copy Markdown
Member

🎉 This PR is included in version 15.36.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants