App for adding formulas for any doctype
Go to file
Ali bb1287acc2 refactor(generator): emit config, not a code-generated engine
The generator unrolled the whole engine into the Client Script: one inline block
per formula per trigger, plus an if-chain over every report field. A VAT
declaration came out at 403 KB of generated code, which then shipped inside
taxes_az's fixtures.

It now emits a CONFIG object — a copy of the storage — and one call into
taxes_az.formula. The storage format is untouched, so every existing Formula
Editor record keeps working. Generated scripts no longer reference this app, which
is what lets it be removed from production machines.

Generation moved from the browser to on_update. It used to run in before_save off
the editor's rendered DOM, so a half-drawn form could serialise empty formulas
over real ones; it now builds from the stored JSON.

Removed with it: the emitters (transform_expression, table-row handlers, universal
fields, report fields), plus dead code they hid — processFormula had no call
sites, applyAggregation was never emitted, and generate_child_table_script
referenced a variable outside its closure and would have thrown on the first
is_table_field formula.

VAT script: 403 KB -> 120 KB. Output verified identical across all 426 formulas.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 12:22:07 +00:00
formula_editor refactor(generator): emit config, not a code-generated engine 2026-07-13 12:22:07 +00:00
.editorconfig feat: Initialize App 2025-02-27 19:01:56 +04:00
.eslintrc feat: Initialize App 2025-02-27 19:01:56 +04:00
.gitignore feat: Initialize App 2025-02-27 19:01:56 +04:00
.pre-commit-config.yaml feat: Initialize App 2025-02-27 19:01:56 +04:00
README.md feat: Initialize App 2025-02-27 19:01:56 +04:00
license.txt feat: Initialize App 2025-02-27 19:01:56 +04:00
package-lock.json Formula editor parsed to small modules, also added table() function in reports 2025-07-02 13:55:25 +04:00
package.json Formula editor parsed to small modules, also added table() function in reports 2025-07-02 13:55:25 +04:00
pyproject.toml feat: Initialize App 2025-02-27 19:01:56 +04:00
yarn.lock fixed bug with async 2025-10-28 13:47:05 +04:00

README.md

Formula Editor

App for adding formulas for any doctype

Installation

You can install this app using the bench CLI:

cd $PATH_TO_YOUR_BENCH
bench get-app $URL_OF_THIS_REPO --branch develop
bench install-app formula_editor

Contributing

This app uses pre-commit for code formatting and linting. Please install pre-commit and enable it for this repository:

cd apps/formula_editor
pre-commit install

Pre-commit is configured to use the following tools for checking and formatting your code:

  • ruff
  • eslint
  • prettier
  • pyupgrade

License

unlicense