feat(fusion_accounting): add check_odoo_diff.sh for cross-version upgrade ritual

Made-with: Cursor
This commit is contained in:
gsinghpal
2026-04-19 00:56:49 -04:00
parent de71a61a8b
commit 6731260cde
2 changed files with 120 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
# Fusion Accounting Tooling
## check_odoo_diff.sh
Diff a single Odoo Enterprise accounting module across two pinned snapshots
in `RePackaged-Odoo/` and produce a categorized change report (markdown).
### Usage
tools/check_odoo_diff.sh <module> <from_version> <to_version> [<output_md>]
### Example
# When Odoo 20 ships, get a full report on what changed in account_accountant
tools/check_odoo_diff.sh account_accountant v19 v20 > reports/v20_accountant.md
### Classification tags
- `[MIRROR]` — mechanical port required (view XML, OWL component, PDF template, wizard view)
- `[ABSTRACT]` — verify our adapter still aligns; update if Odoo's public API surface changed
- `[MANIFEST]` — manifest changes (deps, asset bundles, version, hooks)
- `[TEST]` — Odoo's tests changed; check if our equivalents need updates
- `[REVIEW]` — uncategorized; manual review needed
### Snapshot conventions
Snapshots live at `$REPACKAGED_ODOO_ROOT/accounting-<version>/<module>` (default
root: `/Users/gurpreet/Github/RePackaged-Odoo`). Override the root with the
`REPACKAGED_ODOO_ROOT` env var.
The current workspace has only the V19 snapshot at
`/Users/gurpreet/Github/RePackaged-Odoo/accounting/` (unversioned). When
Odoo 20 ships:
1. Rename the current snapshot: `mv accounting accounting-v19`
2. Drop the new V20 source at `accounting-v20/`
3. Run `tools/check_odoo_diff.sh account_accountant v19 v20` per sub-module

View File

@@ -0,0 +1,83 @@
#!/usr/bin/env bash
# check_odoo_diff.sh
#
# Diff a single Odoo Enterprise accounting module across two pinned snapshots
# and produce a categorized change report.
#
# Usage:
# tools/check_odoo_diff.sh <module> <from_version> <to_version> [<output_md>]
#
# Example:
# tools/check_odoo_diff.sh account_accountant v19 v20 reports/v20_accountant_diff.md
set -euo pipefail
MODULE="${1:?Usage: check_odoo_diff.sh <module> <from_version> <to_version> [<output_md>]}"
FROM="${2:?from_version required (e.g. v19)}"
TO="${3:?to_version required (e.g. v20)}"
OUT="${4:-/dev/stdout}"
ROOT="${REPACKAGED_ODOO_ROOT:-/Users/gurpreet/Github/RePackaged-Odoo}"
FROM_DIR="$ROOT/accounting-$FROM/$MODULE"
TO_DIR="$ROOT/accounting-$TO/$MODULE"
if [ ! -d "$FROM_DIR" ]; then
echo "ERROR: $FROM_DIR does not exist. Snapshot $FROM not yet present?" >&2
exit 1
fi
if [ ! -d "$TO_DIR" ]; then
echo "ERROR: $TO_DIR does not exist. Snapshot $TO not yet present?" >&2
exit 1
fi
classify() {
local f="$1"
case "$f" in
*/views/*|*/static/src/components/*|*/report/*|*/wizard/*_views.xml|*/wizards/*_views.xml)
echo "[MIRROR]" ;;
*/models/*_engine.py|*/services/*)
echo "[ABSTRACT]" ;;
*/__manifest__.py)
echo "[MANIFEST]" ;;
*/tests/*)
echo "[TEST]" ;;
*)
echo "[REVIEW]" ;;
esac
}
{
echo "# Diff Report: $MODULE ($FROM -> $TO)"
echo ""
echo "Generated: $(date '+%Y-%m-%d %H:%M:%S')"
echo ""
echo "## Changed Files (with classification suggestion)"
echo ""
diff -ruN --brief "$FROM_DIR" "$TO_DIR" | while read -r line; do
case "$line" in
"Files "*" and "*" differ")
file=$(echo "$line" | sed -E 's/^Files (.+) and .+ differ$/\1/' | sed "s|$FROM_DIR/||")
tag=$(classify "$file")
echo "- $tag \`$file\`"
;;
"Only in $TO_DIR"*)
file=$(echo "$line" | sed -E "s|Only in $TO_DIR(.*): (.+)|\1/\2|" | sed "s|^/||")
tag=$(classify "$file")
echo "- $tag NEW: \`$file\`"
;;
"Only in $FROM_DIR"*)
file=$(echo "$line" | sed -E "s|Only in $FROM_DIR(.*): (.+)|\1/\2|" | sed "s|^/||")
tag=$(classify "$file")
echo "- $tag REMOVED: \`$file\`"
;;
esac
done
echo ""
echo "## Full Diff (truncated to first 2000 lines)"
echo ""
echo '```diff'
diff -ruN "$FROM_DIR" "$TO_DIR" | head -2000
echo '```'
} > "$OUT"
echo "Diff report written to: $OUT" >&2