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
| File | Holds |
|---|---|
parity/baseline.txt | The committed gap count |
parity/exceptions.yaml | Approved gaps the checker ignores |
parity/README.md | Which 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| Flag | Effect |
|---|---|
--erpnext PATH | The Frappe package to compare against. Default: $ERPNEXT_SRC |
--erp PATH | The Cardinal app. Default: ERP's checkout |
--exceptions FILE, --baseline FILE | Default: the app's parity/ files |
--check | Exit 1 when the count is above the baseline |
--count | Print only the total |
--summary | Print 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_submittableandis_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'spages.
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.
- 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.