cardinal

Porting a Frappe app

Track how far a Cardinal app is from the Frappe app it copies, with a parity folder and a checker.

ERP, CRM and HRMS copy ERPNext, Frappe CRM and Frappe HRMS. Each keeps a parity/ folder and a checker that counts the gaps against the Frappe source. Use the same pattern when you port a Frappe app.

The folder

FileHolds
parity/baseline.txtThe committed gap count
parity/exceptions.yamlApproved gaps the checker ignores
parity/README.mdWhich Frappe version the app copies, and how to run the check

Run the check

The checker is scripts/parity_check.py in ERP's repository. It needs only Python 3. Point it at the Frappe package and the Cardinal app:

python3 apps/erp/scripts/parity_check.py --erpnext "$CRM_SRC" --erp apps/crm --check
FlagEffect
--erpnext PATHThe Frappe package to compare against. Default: $ERPNEXT_SRC
--erp PATHThe Cardinal app. Default: ERP's checkout
--exceptions FILE, --baseline FILEDefault: the app's parity/ files
--checkExit 1 when the count is above the baseline
--countPrint only the total
--summaryPrint counts per module

What it compares

  • Each DocType against a RecType of the same name, mapping Frappe's names (DocType to RecType, Markdown to Markdown Editor).
  • Fields, their types and the flags istable, issingle, is_submittable and is_tree.
  • Field order and the Tab, Section and Column Breaks. A mismatch is a layout_mismatch.
  • Reports against lib/reports/ and the fixtures, and desk pages against the manifest's pages.

The workflow

Start with an empty app. The first count is the baseline. CRM's started at 55: 54 DocTypes and one workspace.

Each change that closes gaps lowers baseline.txt in the same commit. --check fails when the count rises, and hints when it can go lower.

A gap you keep on purpose goes in exceptions.yaml with a reason.

crm/parity/exceptions.yaml
- kind: fieldtype_mismatch
  name: FCRM Settings
  field: access_key
  reason: "The exchange rate provider's key is a Password, stored as a cipher. Frappe CRM keeps it in a Data field in plain text."

Each row needs kind, name and reason. field and detail are optional.

On this page