Skip to content

fix: make propms run on Frappe and ERPNext version 16 - #75

Merged
aakvatech merged 21 commits into
Aakvatech-Limited:version-16-hotfixfrom
av-dev2:fix/v16-compat
Sep 3, 2026
Merged

fix: make propms run on Frappe and ERPNext version 16#75
aakvatech merged 21 commits into
Aakvatech-Limited:version-16-hotfixfrom
av-dev2:fix/v16-compat

Conversation

@av-dev2

@av-dev2 av-dev2 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Makes propms run on Frappe 16 / ERPNext 16. Every change here was reproduced as
a failing check on a version-16 bench (propms-test.localhost, Frappe 16.31,
ERPNext 16.30, Python 3.14) before it was fixed.

What version 16 broke

Area Symptom on v16 Fix
Issue validate hook Cannot commit database transaction from document hooks dropped the two frappe.db.commit() calls; the row writes already belong to the caller's transaction
Property tree view Filter fields have invalid backtick notation: ifnull(\parent_property`, '')` rebuilt the filter with ["parent_property", "is", "not set"]
Self Consumption in Maintenance Job Card Unknown column 'jc.resolution_date' ERPNext renamed the column to sla_resolution_date
Point of Sale POSCart is not defined — the page script targeted the ERPNext 11 offline POS rewritten against erpnext.PointOfSale.ItemCart / .Controller, loaded through frappe.require("point-of-sale.bundle.js")
page_js pos is not a page any more only point-of-sale is registered
Desk links /app was rerouted to /desk lease renewal links and the renewal banner now use /desk/lease/<name>
Custom Error Log MyISAM cannot roll back, so its rows leaked out of every test transaction moved to InnoDB

propms/pos.js is deleted. It was 2116 lines of the ERPNext 11 offline POS
controller (erpnext.taxes_and_totals.extend({...}), cur_pos, a Jinja
{% include %}), unreferenced by hooks.py or by any other file since the
offline POS was removed from ERPNext.

The Lease messages that were written as _(f"...") now translate the template
and interpolate afterwards, so the strings are extractable again. The scheduler's
own frappe.db.commit() is kept and annotated — it is a batch entry point, not a
document hook.

Verification

All 27 propms desk surfaces (forms, list views, the Property tree, the Point of
Sale page, all query reports and the workspace) were loaded in Chrome against
the v16 site and report zero console errors.

Merge order: this PR first, then #lease-invoicing, then #report-sql, then the
test suite.

av-dev2 and others added 20 commits August 26, 2026 18:02
chore: align ruff config and add erpnext frappe dependency for version-16
Install hooks at three stages. pre-commit checks staged files only so
commits stay fast, commit-msg runs commitlint against the conventional
commit rules, and pre-push re-enters pre-commit over the whole
repository so a push cannot carry unchecked commits.

Anchor the exclude regex. The old "node_modules|.git" pattern was
unanchored, so ".git" also matched ".github" and no workflow YAML was
ever validated, and it hid COMMIT_EDITMSG from the commit-msg stage.

Add the frappe-semgrep-rules hook as language: python with semgrep in
additional_dependencies, so it installs its own semgrep and clones the
rules into the repo on first run instead of depending on a path that
only exists on one machine. Ignore the clone target.

Add no-commit-to-branch for main, master, production, and the version
branches. Working branches such as version-15-hotfix stay open.

Own the ruff config in this app. line-length moves from 120 to 110,
target stays py310, and the missing [tool.ruff.format] section is
added with double quotes and tab indentation. E101 and W191 join the
ignore list because W is selected and the app indents with tabs.
An explicit [tool.ruff.lint] section stops ruff resolving upward to a
config outside the app.

Add the dev extra and scripts/setup-git-hooks.sh so a fresh clone can
install the hooks in one command.
Remove ci.yml and ci-tests.yml. Both build a full bench on the runner
(bench init, get-app, new-site, install-app, migrate) with MariaDB and
two Redis services. Frappe tests run locally on the bench terminal, not
in GitHub Actions, so these only added five to eight minutes per pull
request and went red for upstream breakage unrelated to the diff.

Remove release.yml and .releaserc.json. Tagging, releasing, and
promotion belong to tag-and-promote-from-pr-label.yml. Running
semantic-release alongside it tags a separate release commit, after
which tag-and-promote finds the tag on a different commit and fails.

Add pre-commit.yml so pre-commit runs over all files on every pull
request, and semantic-commits.yml so commitlint re-checks the whole PR
commit range. Both gates are server side and hold for contributors who
never installed the local hooks.

Rescope linter.yml to a full semgrep scan plus pip-audit. The blocking
step now uses r/python.lang.security at ERROR severity, with a
non-blocking WARNING pass for information. The duplicate pre-commit
step is gone, since pre-commit.yml covers it over all files.
Use frappe.db.get_single_value for the four reads of Property
Management Settings in issue_hook. That doctype is a single, and
frappe.db.get_value is not type safe against a single. The rest of the
file already reads singles this way.

Initialise invoice_item in leaseInvoiceAutoCreate. The flush branch
reads the previous iteration's row, which the row_num guard makes safe
at runtime, but the name had no binding at the top of the loop and
ruff reported it undefined.

Drop three dead locals: foreign_currency in both rent invoice reports,
which nothing reads after the branch assigns it, and name_in_json in
create_property_setter.

Replace explicit positional format indices and rename an unused loop
variable.
Apply ruff at line-length 110 with tab indentation and double quotes
across the app, together with the safe lint autofixes and the
whitespace and end-of-file hooks. No behaviour changes.
ci: adopt the standard pre-commit, ruff, and semgrep toolchain
Without the [tool.ruff.lint] header ruff read select and ignore as
formatter keys and refused to parse pyproject.toml, so both ruff hooks
exited 2 in CI. Widen the bench dependency range to cover v15 and v16
now that this branch carries the toolchain for both.
fix(ci): restore the tool.ruff.lint section and widen frappe deps
# Conflicts:
#	.gitignore
#	propms/__init__.py
#	propms/hooks.py
#	propms/issue_hook.py
#	propms/lease_invoice.py
#	propms/pos.js
#	propms/property_management_solution/doctype/lease/lease.py
#	propms/property_management_solution/doctype/property/property.py
#	pyproject.toml
@aakvatech
aakvatech merged commit cad3a01 into Aakvatech-Limited:version-16-hotfix Sep 3, 2026
4 checks passed
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.

3 participants