Qcmc Logic

Install Qcmc Logic

bench get-app https://github.com/qcstyrogit-main/qcmc_logic

Add the Frappe Gems badge to your README

Maintain Qcmc Logic? Paste this into your README:

[![Listed on Frappe Gems](https://frappegems.com/api/method/frappe_gems.seo.badge?app=qcstyrogit-main%2Fqcmc_logic)](https://frappegems.com/gems/apps/qcstyrogit-main/qcmc_logic)

About Qcmc Logic

QCMC Logics

Company Business Rules and Logics

Fixture Workflow

For normal code-reviewed changes, prefer the patch-first workflow:

bench --site erp.qcstyro.local migrate
python3 apps/qcmc_logic/scripts/clean_fixtures.py
git diff

Use this when changes were made in the repository through code, fixtures, and patches. migrate applies patches and imports fixtures into the site; clean_fixtures.py normalizes and validates the repo fixtures without running bench export-fixtures.

You only need bench export-fixtures when you intentionally changed metadata inside the Frappe UI, such as Customize Form, Property Setter, Print Format, Report, Workflow, or another fixture-backed record, and need to bring that database change back into the repository.

See docs/developer_fixture_workflow.md for the full team workflow and the rules for when patches, direct fixture edits, and export-fixtures should be used.

Use the wrapper instead of running bench export-fixtures directly:

python3 apps/qcmc_logic/scripts/export_fixtures_clean.py --site erp.qcstyro.local
git diff

This runs bench export-fixtures, normalizes exported JSON, fixes safe validation issues, and validates the result.

To export only this app's fixtures, add --app qcmc_logic:

python3 apps/qcmc_logic/scripts/export_fixtures_clean.py --site erp.qcstyro.local --app qcmc_logic

If you already ran bench export-fixtures manually, use:

python3 apps/qcmc_logic/scripts/export_fixtures_clean.py --skip-export
git diff

The manual order is:

bench export-fixtures
python3 apps/qcmc_logic/scripts/normalize_fixtures.py
python3 apps/qcmc_logic/scripts/fix_fixture_validation_errors.py
python3 apps/qcmc_logic/scripts/validate_fixtures.py
python3 apps/qcmc_logic/scripts/audit_doctype_fixtures.py
python3 apps/qcmc_logic/scripts/audit_property_setters.py
git diff

normalize_fixtures.py removes volatile metadata such as timestamps, owners, assignment tags, and DocType migration hashes, then sorts top-level fixture records by stable identity so timestamp-only, migration-hash-only, and order-only fixture exports do not create noisy diffs. After normalization, it prints a warning when meaningful fixture changes remain.

fix_fixture_validation_errors.py fixes safe validation errors, currently Custom Field records whose name does not match {dt}-{fieldname}.

validate_fixtures.py catches import-breaking Custom Field mistakes, including records whose name does not match {dt}-{fieldname}.

audit_doctype_fixtures.py catches custom DocTypes from unexpected app modules and duplicate DocField names inside exported DocType fixtures. This prevents cross-app fixture ownership problems, such as LMS or ZKTeco DocTypes being exported by qcmc_logic, and catches child-table field mix-ups before migration.

audit_property_setters.py catches Property Setter records whose name points to one DocType or field while doc_type, field_name, or property points to another. This prevents merge drift like Address-main-search_fields being attached to a different DocType.

When reviewing qcmc_logic/fixtures/doctype.json, stop if an unrelated module appears. One app should own each custom DocType fixture.

Install the local pre-commit hook once per clone:

python3 apps/qcmc_logic/scripts/install_git_hooks.py

The hook runs validate_fixtures.py, audit_doctype_fixtures.py, and audit_property_setters.py before each commit.

Fixture Merge Conflicts

When git pull --rebase or merge reports conflicts in qcmc_logic/fixtures/*.json, preview what the safe fixture resolver can fix:

python3 apps/qcmc_logic/scripts/resolve_fixture_conflicts.py --dry-run

Then resolve and stage the fixture JSON conflicts:

python3 apps/qcmc_logic/scripts/resolve_fixture_conflicts.py
python3 apps/qcmc_logic/scripts/validate_fixtures.py
git diff

If you are already inside apps/qcmc_logic, use the shorter paths:

python3 scripts/resolve_fixture_conflicts.py --dry-run
python3 scripts/resolve_fixture_conflicts.py

The resolver auto-merges safe JSON fixture cases, such as both branches changing different fixture records or different fields on the same record. If both branches changed the same field differently, it stops and prints the exact record and field that needs human review. Non-fixture conflicts still need manual resolution.

See docs/fixture_conflict_commands.md for the full command runbook and what each command is for.

License

mit

For faster export fixtures

alias export-fixtures='python3 apps/qcmc_logic/scripts/export_fixtures_clean.py'
alias clean-fixtures='python3 apps/qcmc_logic/scripts/clean_fixtures.py'
alias clean-fixtures='python3 scripts/clean_fixtures.py'

usage: exportfixturesclean.py [-h] [--skip-export] [--site SITE] [--app APP]

export-fixtures --site erp.qcstyro.local 
clean-fixtures

config test Git PUSH

Related Developer Tools apps for Frappe & ERPNext

  • Frappe — Low code web framework for real world applications, in Python and Javascript
  • Frappe Docker — Docker environment for developing, deploying, and running Frappe applications (ERPNext and custom apps) in production and development
  • Builder — Craft beautiful websites effortlessly with an intuitive visual builder and publish them instantly
  • Bench — CLI to manage Multi-tenant deployments for Frappe apps
  • Frappe Ui — A set of components and utilities for rapid UI development
  • Press — Full service cloud hosting for the Frappe stack - powers Frappe Cloud
  • Gameplan — Open Source Discussions Platform for Remote Teams
  • Doppio — A Frappe app (CLI) to magically setup single page applications and Vue/React powered desk pages on your custom Frappe apps.