Skip to content

Add priority reordering function for BRR#367

Open
0xD0M1M0 wants to merge 4 commits into
alyf-de:version-15-hotfixfrom
0xD0M1M0:brr-reordering
Open

Add priority reordering function for BRR#367
0xD0M1M0 wants to merge 4 commits into
alyf-de:version-15-hotfixfrom
0xD0M1M0:brr-reordering

Conversation

@0xD0M1M0

@0xD0M1M0 0xD0M1M0 commented May 17, 2026

Copy link
Copy Markdown
Contributor
  • Enhanced the bank reconciliation rule list view to include a "Reorder by Priority" button.
  • Implemented backend methods to retrieve bank accounts with rules and reorder rules based on user-defined priorities.
  • Updated the bank reconciliation rule model to support priority management.
  • Added tests for the new reordering feature to ensure correct functionality.

…nality

- Enhanced the bank reconciliation rule list view to include a "Reorder by Priority" button.
- Implemented backend methods to retrieve bank accounts with rules and reorder rules based on user-defined priorities.
- Updated the bank reconciliation rule model to support priority management.
- Added tests for the new reordering feature to ensure correct functionality.
@greptile-apps

greptile-apps Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Reviews (4): Last reviewed commit: "Merge branch 'version-15-hotfix' into br..." | Re-trigger Greptile

@barredterra

Copy link
Copy Markdown
Member

@greptileai

Comment on lines +57 to +68
def get_bank_accounts_with_rules() -> list[str]:
"""Bank accounts that have at least one non-cancelled reconciliation rule."""
if not frappe.has_permission("Bank Reconciliation Rule", "read"):
frappe.throw(_("Not permitted to read the bank reconciliation rules"), frappe.PermissionError)

return frappe.get_all(
"Bank Reconciliation Rule",
filters={"docstatus": ("!=", 2)},
pluck="bank_account",
group_by="bank_account",
order_by="bank_account asc",
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
def get_bank_accounts_with_rules() -> list[str]:
"""Bank accounts that have at least one non-cancelled reconciliation rule."""
if not frappe.has_permission("Bank Reconciliation Rule", "read"):
frappe.throw(_("Not permitted to read the bank reconciliation rules"), frappe.PermissionError)
return frappe.get_all(
"Bank Reconciliation Rule",
filters={"docstatus": ("!=", 2)},
pluck="bank_account",
group_by="bank_account",
order_by="bank_account asc",
)
def get_bank_accounts_with_rules() -> list[str]:
"""Bank accounts that have at least one non-cancelled reconciliation rule."""
return frappe.get_list(
"Bank Reconciliation Rule",
filters={"docstatus": ("!=", 2)},
pluck="bank_account",
group_by="bank_account",
order_by="bank_account asc",
)

Any particular reason you chose this permission structure? get_list seems more suitable at first glance.

-> Applies to the other whitelisted methods as well.

)


@frappe.whitelist()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
@frappe.whitelist()
@frappe.whitelist(methods=["GET"])
@frappe.read_only()

Security: whitelisted methods should specify allowed HTTP verbs (GET for read-requests, POST for write requests).
Performance: read_only methods can read from a database replica, if configured.

-> Applies to the other whitelisted methods as well.


@frappe.whitelist()
def reorder_bank_reconciliation_rule_priorities(
bank_account: str | None = None, ordered_names: str | list | None = None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
bank_account: str | None = None, ordered_names: str | list | None = None
bank_account: str, ordered_names: str | list

Why are these parameters advertised as optional in the signature but required in the function body?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Consider moving the reorder popup into a dedicated JavaScript bundle that's only loaded and initialized here. Because bundles are built, you can then keep html and css in separate (template) files and import them. That makes the whole code a lot cleaner.

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