Commit Graph

384 Commits

Author SHA1 Message Date
gsinghpal
9db7271bdf feat(fusion_accounting_reports): MV for per-account-per-month balances
Made-with: Cursor
2026-04-19 15:53:34 -04:00
gsinghpal
0f575dd523 test(fusion_accounting_reports): balance sheet + trial balance integration
Made-with: Cursor
2026-04-19 15:52:01 -04:00
gsinghpal
16db299145 test(fusion_accounting_reports): P&L integration tests against known fixtures
Made-with: Cursor
2026-04-19 15:51:28 -04:00
gsinghpal
144e90a379 test(fusion_accounting_reports): Hypothesis property-based engine invariants
Made-with: Cursor
2026-04-19 15:48:56 -04:00
gsinghpal
118f0d9d16 feat(fusion_accounting_ai): 5 new financial reports AI tools
Some checks failed
fusion_accounting CI / test (fusion_accounting_ai) (push) Has been cancelled
fusion_accounting CI / test (fusion_accounting_core) (push) Has been cancelled
fusion_accounting CI / test (fusion_accounting_migration) (push) Has been cancelled
Adds financial_reports.py tools module with 5 fusion-engine-routed
tools registered in TOOL_DISPATCH:

- fusion_run_report
- fusion_get_anomalies
- fusion_generate_commentary
- fusion_drill_down_report_line
- fusion_compare_periods

Each tool guards on 'fusion.report.engine' being in the registry and
otherwise returns a structured error so the chat agent can surface a
clear "module not installed" message.

6 new TransactionCase tests (including a TOOL_DISPATCH registration
sanity check).

Made-with: Cursor
2026-04-19 15:41:10 -04:00
gsinghpal
15cf4e129f feat(fusion_accounting_ai): wire ReportsAdapter fusion paths to engine
Adds three new method families on ReportsAdapter that route through
fusion.report.engine when fusion_accounting_reports is installed:

- run_fusion_report (pnl/balance_sheet/trial_balance/general_ledger)
- get_anomalies (variance detection on engine output)
- get_commentary (LLM narrative; falls back to templated)

These coexist with the legacy ref_id-shaped run_report / export_report
API so existing reporting tools (profit_loss, balance_sheet, etc.) keep
working unchanged. FUSION_MODEL is updated to fusion.report.engine so
mode detection picks FUSION when the new engine is installed.

4 new TransactionCase tests cover the fusion + community paths.

Made-with: Cursor
2026-04-19 15:39:54 -04:00
gsinghpal
5cdd3e756d feat(fusion_accounting_reports): 8 JSON-RPC endpoints for OWL widget
Adds FusionReportsController exposing:
- list_available, run, drill_down
- get_anomalies (with optional persistence to fusion.report.anomaly)
- get_commentary (LLM cache via fusion.report.commentary, force_regenerate flag)
- compare_periods (delegates to run with comparison flag)
- export_pdf / export_xlsx (Phase 2 placeholders for Tasks 34/35)

All endpoints use V19's type='jsonrpc' and route through
fusion.report.engine - no direct ORM aggregation in the controller.

8 new HttpCase tests cover each endpoint. Total: 78 logical tests.

Made-with: Cursor
2026-04-19 15:37:58 -04:00
gsinghpal
c20e0888e1 feat(fusion_accounting_reports): fusion.report.anomaly persisted model
Made-with: Cursor
2026-04-19 15:32:09 -04:00
gsinghpal
22b277c6b8 feat(fusion_accounting_reports): fusion.report.commentary cache model
Made-with: Cursor
2026-04-19 15:31:22 -04:00
gsinghpal
17053b1603 feat(fusion_accounting_reports): commentary_prompt for LLM-generated narratives
Made-with: Cursor
2026-04-19 15:30:28 -04:00
gsinghpal
a4728d7ae7 feat(fusion_accounting_reports): commentary_generator service with templated fallback
Made-with: Cursor
2026-04-19 15:29:44 -04:00
gsinghpal
b78e6dc842 feat(fusion_accounting_reports): anomaly_detection service
Made-with: Cursor
2026-04-19 15:28:53 -04:00
gsinghpal
5963aba0a8 feat(fusion_accounting_reports): seed general ledger report definition + 8 verification tests
Adds data/report_general_ledger.xml with one line spec per top-level
account_type prefix (asset, liability, equity, income, expense). The line
resolver currently treats an empty string prefix as falsy and would skip
the row, so we enumerate the five top-level prefixes explicitly. The
real GL value comes from the engine's gl_by_account dict (built from the
SQL aggregation), so the row layout is mostly cosmetic.

Adds tests/test_seeded_reports.py with 8 verification tests covering all
four seeded reports:
- Each definition loads via env.ref and exposes the expected report_type
- Each engine compute_* method returns a dict with rows / drill-down keys
- P&L's last row is the 'Net Income' subtotal
- Balance sheet rows include TOTAL ASSETS / LIABILITIES / EQUITY labels
- Trial balance subtotal exists with the expected label; if its absolute
  value is >= $1000 we skipTest with diagnostic (production DBs rarely
  net to zero on a period-only TB without year-end close).

Bumps manifest to 19.0.1.0.8. Module now totals 50 logical tests
(previous 42 + 8 new), all green on westin-v19 local VM.

Made-with: Cursor
2026-04-19 15:24:22 -04:00
gsinghpal
f160a9eeec feat(fusion_accounting_reports): seed trial balance report definition
Adds data/report_trial_balance.xml grouping balances by top-level
account_type prefix (asset, liability, equity, income, expense). Each
group is sign-adjusted so that posted, balanced books sum to ~0 in the
'Total (should be 0)' subtotal -- a quick visual sanity check.

Bumps manifest to 19.0.1.0.7.

Made-with: Cursor
2026-04-19 15:22:38 -04:00
gsinghpal
ba95d927c0 feat(fusion_accounting_reports): seed balance sheet report definition
Adds data/report_balance_sheet.xml with sections for assets, liabilities,
and equity, using the V19 account_type prefixes (asset_current,
asset_receivable, asset_cash, asset_prepayments, asset_non_current,
asset_fixed; liability_payable, liability_credit_card, liability_current,
liability_non_current; equity). Header rows ('ASSETS', 'LIABILITIES',
'EQUITY') are present for visual structure -- the line resolver currently
skips spec entries without compute or account_type_prefix, which means
they don't render but also don't disturb subtotal counts.

Bumps manifest to 19.0.1.0.6.

Made-with: Cursor
2026-04-19 15:22:08 -04:00
gsinghpal
96ac0131b0 feat(fusion_accounting_reports): seed P&L report definition
Adds data/report_pnl.xml seeding a company-agnostic fusion.report record
for the Income Statement (report_type='pnl'). Line specs are loaded via
eval= so Odoo passes a real Python list to the JSON field instead of a
string-encoded blob.

Structure: Revenue (sign -1) - Operating Expenses (sign -1) = Net Income
(subtotal above 2). Comparison defaults to previous_year.

Bumps manifest to 19.0.1.0.5.

Made-with: Cursor
2026-04-19 15:21:32 -04:00
gsinghpal
cabf51add7 feat(fusion_accounting_reports): fusion.report.engine 5-method API
The engine orchestrator. compute_pnl, compute_balance_sheet,
compute_trial_balance, compute_gl, drill_down. All controllers,
wizards, AI tools must route through these methods; no direct
SQL aggregation from anywhere else.

Internal pipeline: validate -> fetch hierarchy -> SQL aggregate
-> resolve line_specs -> optional comparison + anomaly. Uses raw
SQL for the per-account aggregate (the perf-critical step), ORM
for everything else.

Per-company report lookup with global fallback (company_id desc
nulls last). Balance sheet uses 1970 epoch as date_from for
cumulative-since-inception semantics.

7 new tests, 42 total passing.

Made-with: Cursor
2026-04-19 15:15:54 -04:00
gsinghpal
0eee14f69a feat(fusion_accounting_reports): drill_down_resolver service
Pure-Python helper that, given an account_id and a date range, fetches
posted account.move.line records and returns a flat list of dicts ready
for the drill-down OWL dialog. Used by the engine's drill_down() method.

3 new tests, 35 total passing.

Made-with: Cursor
2026-04-19 15:14:31 -04:00
gsinghpal
9d3b8f7484 feat(fusion_accounting_reports): line_resolver service for report row computation
Pure-Python helper that resolves a fusion.report's line_specs against
account_totals -> ordered list of report row dicts. Supports three spec
types: account_type_prefix (sum accounts by type), account_id (single
account, drill-downable), and compute='subtotal' (sum last N rows).

Comparison-period support: variance_pct computed automatically when
comparison_totals are supplied.

5 new tests, 32 total passing.

Made-with: Cursor
2026-04-19 15:13:44 -04:00
gsinghpal
50f736d8a7 feat(fusion_accounting_reports): fusion.report definition model
Persistent definition of a Fusion financial report. Each report (P&L,
balance sheet, trial balance, GL) has one row in fusion.report holding
its metadata + line specs (stored as JSON for layout flexibility).

V19 conventions: models.Constraint inline, no _sql_constraints. Per-
company uniqueness on (company_id, code).

3 new tests, 27 total passing.

Made-with: Cursor
2026-04-19 15:12:38 -04:00
gsinghpal
e14ad21689 feat(fusion_accounting_reports): currency conversion service
Pure-Python helper for FX conversion at report end-date. Handles direct
rates, inverse rates, and fallback to most-recent-rate-on-or-before.
fetch_rates() pulls from res.currency.rate using the same
1/rate inversion convention Odoo uses internally.

Made-with: Cursor
2026-04-19 15:07:46 -04:00
gsinghpal
0a9ed635e8 feat(fusion_accounting_reports): pure-Python services for date+account+totaling
Three service modules with no Odoo dependencies:
- date_periods: fiscal year/month/quarter bounds + comparison derivation
- account_hierarchy: parent-child tree walker with type filtering
- totaling: move-line aggregation primitives

18 unit tests covering edge cases (December rollover, Feb 29, fiscal-
year-before-start, balance check tolerance).

Made-with: Cursor
2026-04-19 15:07:05 -04:00
gsinghpal
a93162cb70 feat(fusion_accounting_reports): Phase 2 skeleton + plan
46-task plan to replace Enterprise account_reports module:
- CORE scope: P&L, balance sheet, trial balance, GL with drill-down
- HYBRID engine: shared primitives + per-report models
- AI augmentation: anomaly detection + LLM-generated commentary
- Coexists with Enterprise (group_fusion_show_when_enterprise_absent)
- Same V19 conventions + test pyramid + perf-budget discipline as Phase 1

Skeleton: empty manifest + dirs + icon. Tasks 3-46 add the substance.
Made-with: Cursor
2026-04-19 15:03:03 -04:00
gsinghpal
a90a349fbc Merge Phase 1: AI-assisted bank reconciliation
Some checks failed
fusion_accounting CI / test (fusion_accounting_ai) (push) Has been cancelled
fusion_accounting CI / test (fusion_accounting_core) (push) Has been cancelled
fusion_accounting CI / test (fusion_accounting_migration) (push) Has been cancelled
51 tasks shipped on fusion_accounting/phase-1-bank-rec:
- fusion.reconcile.engine (6-method API, single write surface)
- 4-pass AI confidence scoring pipeline
- 14 mirrored Enterprise OWL components + 8 fusion-only
- 10 JSON-RPC controller endpoints + reactive frontend service
- Materialized view + 3 cron jobs
- 2 wizards + migration audit PDF
- 157 tests passing (engine, integration, property-based, controller, MV, wizards, coexistence, perf, LLM compat)
- All 4 P95 perf metrics within 1x of budget

# Conflicts:
#	fusion_plating/fusion_plating_bridge_mrp/__manifest__.py
#	fusion_plating/fusion_plating_bridge_mrp/models/mrp_workorder.py
#	fusion_plating/fusion_plating_bridge_mrp/views/mrp_workorder_views.xml
2026-04-19 14:59:17 -04:00
gsinghpal
6e53955e9c docs(fusion_accounting_bank_rec): CLAUDE.md, UPGRADE_NOTES.md, README.md
Some checks failed
fusion_accounting CI / test (fusion_accounting_ai) (push) Has been cancelled
fusion_accounting CI / test (fusion_accounting_core) (push) Has been cancelled
fusion_accounting CI / test (fusion_accounting_migration) (push) Has been cancelled
Made-with: Cursor
fusion_accounting/phase-1-complete
2026-04-19 14:05:49 -04:00
gsinghpal
8dab9b36da feat(fusion_accounting): meta-module now installs bank_rec sub-module
Phase 1 ships fusion_accounting_bank_rec; the meta now depends on it
so a single click installs the full Fusion Accounting suite.

Made-with: Cursor
2026-04-19 14:04:35 -04:00
gsinghpal
14e59148c6 test(fusion_accounting_bank_rec): local LLM (LM Studio/Ollama) compat smoke
Tagged 'local_llm'. Auto-detects LM Studio (:1234) or Ollama (:11434)
via host.docker.internal or localhost. When running, configures the
provider params and runs engine.suggest_matches end-to-end. Skips
gracefully when no local LLM is present (CI / dev VM mode).

Made-with: Cursor
2026-04-19 14:01:58 -04:00
gsinghpal
55eb368195 test(fusion_accounting_bank_rec): performance benchmarks with P95 targets
Tagged 'benchmark' so they can be selected explicitly. Targets:
suggest_matches <500ms, reconcile_batch(50) <5s, list_unreconciled <200ms,
MV refresh <2s. Hard-fail at 5x budget to catch egregious regressions.

Measured on local dev VM:
- suggest_matches: median=221ms p95=234ms (target <500ms)
- reconcile_batch(50 lines): 3318ms (target <5000ms)
- list_unreconciled: median=14ms p95=77ms (target <200ms)
- MV refresh: 60ms (target <2000ms)

Made-with: Cursor
2026-04-19 14:00:15 -04:00
gsinghpal
d623b67157 test(fusion_accounting_bank_rec): 5 OWL tour tests for widget smoke
Tours: smoke (header loads), select_line, accept_suggestion (skipped
in CI without AI config), auto_reconcile_wizard, load_more. Each
tour scripts a typical user interaction; the Python wrappers run them
via HttpCase.start_tour. Tagged 'tour' so they can be excluded from
fast unit-test runs and selected when full browser infra is available.

Made-with: Cursor
2026-04-19 13:47:23 -04:00
gsinghpal
aaaf49989c test(fusion_accounting_bank_rec): coexistence behavior
Verifies that the coexistence group recompute method works as expected
in both Enterprise-present and Enterprise-absent scenarios, and that
the bank-rec menu is gated by the group while the engine itself is
always available.

Made-with: Cursor
2026-04-19 13:45:39 -04:00
gsinghpal
878c013902 feat(fusion_accounting_bank_rec): top-level menu + window action
Menu visible only when fusion_accounting_core.group_fusion_show_when_enterprise_absent
is set (Enterprise's account_accountant not installed). Opens the OWL
bank-rec kanban widget at the unreconciled-lines view.

Made-with: Cursor
2026-04-19 13:37:16 -04:00
gsinghpal
ffc029a875 test(fusion_accounting_bank_rec): migration round-trip for bootstrap step
Verifies the bank_rec_bootstrap migration step (a) creates precedents
from existing partial.reconcile rows, (b) is idempotent on re-run, and
(c) refreshes the MV without erroring.

Three TransactionCase tests:
- test_bootstrap_creates_precedents_from_existing_reconciles seeds two
  reconciles via the engine, wipes the auto-recorded precedents, then
  asserts the bootstrap produces source='backfill' precedents.
- test_bootstrap_step_idempotent runs the bootstrap twice and asserts
  the second pass creates zero new precedents.
- test_bootstrap_refreshes_mv_without_error runs the bootstrap on a
  clean partner and asserts no exception is raised and the result dict
  reports MV + pattern refresh outcomes.

Implementation fixes uncovered by these tests:
- precedent_backfill.backfill_precedents now pre-filters
  account.partial.reconcile to rows that touch a bank statement line on
  either side. Previously it walked every partial in the DB; on the
  westin-v19 dev DB that's 16k rows and the default limit=10000 missed
  the newest test fixtures (highest IDs).
- backfill skips the periodic env.cr.commit() when running under a
  TestCursor, since committing inside a test breaks the rollback.

Test count: 139 -> 142.

Made-with: Cursor
2026-04-19 13:33:29 -04:00
gsinghpal
6d90789967 feat(plating): MO smart buttons — Sale Order + Work Orders + Receiving
Manager / operator opening an MO had no way to jump back to the
originating SO, see the WO list, or check the receiving record
without going through menus. Add three smart buttons in the MO
form's button-box:

  • [📄 Sale Order] — opens the source SO (resolved via mo.origin)
  • [⚙ Work Orders 9] — list view filtered by production_id
  • [🚚 Receiving 1] — opens the fp.receiving record (or list when
    multiple), filtered by mo.x_fc_sale_order_id

New computed fields on mrp.production (non-stored — recomputed on
view load, no migration cost):
  • x_fc_sale_order_id      — Many2one resolved from origin
  • x_fc_workorder_count    — len(workorder_ids)
  • x_fc_receiving_count    — search_count on fp.receiving

Each button hides itself when count is zero / link unresolvable, so
brand-new draft MOs without a source SO don't show stale buttons.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 13:27:29 -04:00
gsinghpal
6048df0645 feat(fusion_accounting_bank_rec): migration audit PDF report
QWeb PDF showing per-company: backfilled precedent count, pattern count,
remaining unreconciled bank line count. Bound to fusion.migration.wizard
so it appears in the Print menu after migration runs.

- reports/migration_audit_report.py defines the AbstractModel
  report.fusion_accounting_bank_rec.migration_audit_template, which
  aggregates per-company counts from fusion.reconcile.precedent
  (source='backfill'), fusion.reconcile.pattern, and
  account.bank.statement.line (is_reconciled=False).
- reports/migration_audit_report_views.xml is the QWeb template.
- reports/migration_audit_report_action.xml registers the
  ir.actions.report bound to fusion.migration.wizard.

Made-with: Cursor
2026-04-19 13:25:59 -04:00
gsinghpal
b6aedc9bbe feat(fusion_accounting_bank_rec): migration wizard bootstrap step
Adds bank_rec_bootstrap step that backfills fusion.reconcile.precedent
from existing account.partial.reconcile rows during migration. This
gives the AI memory from past Enterprise reconciles. Also triggers
pattern refresh + MV refresh for immediate UI readiness.

- New service services/precedent_backfill.py walks
  account.partial.reconcile rows, identifies the bank-statement-line
  side, and creates a precedent per qualifying partial. Idempotent via
  (statement_line, account, amount, source='backfill') signature.
- New model models/fusion_migration_wizard.py inherits
  fusion.migration.wizard, exposes _bank_rec_bootstrap_step() (callable
  from tests/audit), and overrides action_run_migration() to call
  super() + the bootstrap.
- Adds 'backfill' to fusion.reconcile.precedent.source selection.
- Adds fusion_accounting_migration to depends.

Made-with: Cursor
2026-04-19 13:24:17 -04:00
gsinghpal
25f033d0c8 feat(fusion_accounting_bank_rec): bulk reconcile wizard for selected lines
TransientModel + view + binding action so users can select bank lines
from any list view and bulk-apply either engine.reconcile_batch or
a chosen reconcile model.

Made-with: Cursor
2026-04-19 13:17:58 -04:00
gsinghpal
75850aad73 feat(fusion_accounting_bank_rec): auto-reconcile wizard
TransientModel that filters unreconciled bank lines by journal +
date range + strategy and runs engine.reconcile_batch. Shows
reconciled_count / skipped_count / error_summary in result view.

Made-with: Cursor
2026-04-19 13:16:06 -04:00
gsinghpal
5c3e7a3cf3 fix(shopfloor): Manager Desk pickers — overflow + chevron + Take Over label
Two issues from the wet-WO card screenshot:

**1. Tank picker bleeding past the card's right edge**

Native <select> defaults to `box-sizing: content-box`, so my
`width:100% + padding-right:2.25rem` rendered the picker wider than
its flex slot — the second picker (Tank, on wet WOs) overflowed the
card border at the typical card width.

Fix on `.o_fp_mgr_picker`:
  • `box-sizing: border-box` — keep total width inside the slot
  • `min-width: 0` — let flex actually shrink it past its content
  • Custom SVG chevron via background-image so we control the
    indicator's position exactly (Bootstrap's native chevron sits
    almost flush with the right border, which the user flagged
    earlier). 1rem of clearance from the right edge.

**2. Take Over button**

Earlier I'd collapsed it to icon-only because the wet card was too
wide; user pointed out the icon alone is confusing. Restored the
"Take Over" label (with icon prefix) so both buttons read cleanly:

   [👤 Take Over]  [↗ Open WO]

Asset cache cleared as part of the deploy so the recompiled SCSS
+ refreshed XML template ship together. A hard browser refresh
(DevTools → Empty Cache + Hard Reload) is needed to pick them up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 13:15:00 -04:00
gsinghpal
e01a2a0e35 fix(shopfloor): Manager Desk WO row layout — proper info stack + action group
Screenshot showed the new WO row was broken:
  • Kind chip text clipped ("Mas" instead of "Mask", "Rac" instead of
    "Racking")
  • WO name truncated to first 4 chars
  • The wet WO had no info column at all — kind chip + name pushed
    off-screen by the tank picker
  • "Needs:" chip showed as just an exclamation icon with "N" cut off
  • Take Over and Open WO buttons unevenly sized

Root cause: `.o_fp_mgr_wo_info` carried `nowrap + ellipsis` from the
old single-line design, but the new template stacks kind chip + name +
meta + needs across multiple lines. Plus the rigid grid
(1fr auto auto auto auto) gave the info column whatever the dropdowns
left over — usually nothing.

**Layout rewrite** — flex with wrap instead of grid:
  • `.o_fp_mgr_wo_row` — flex row, info on left, actions on right,
    wraps to two rows on narrow viewports.
  • `.o_fp_mgr_wo_info` — `flex: 1 1 280px` so it grows but never
    narrower than 280px. Contains a vertical stack: title row
    (badge + name) → meta row (workcenter / role / equipment chips)
    → needs row (yellow chip if anything missing).
  • `.o_fp_mgr_wo_actions` — `flex: 0 0 auto` with its own gap, so
    pickers + buttons align cleanly to the right.
  • Kind chip can wrap to its full label; meta row uses `flex-wrap`
    so equipment hints don't get clipped.
  • Take Over collapses to icon-only with title tooltip — the row
    was getting too wide on the wet kind (which adds the tank picker).

**Other tweaks**
  • Added `tank_id` to the controller payload so the tank picker
    pre-selects the current tank (was missing on the previous
    "current tank" highlight).

@720px the action group stacks below the info — pickers go full-width,
buttons get `min-height: $fp-touch-min` for thumb tap.

Asset cache cleared as part of the deploy so the SCSS recompiles.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 13:05:27 -04:00
gsinghpal
6cbb5f85fe feat(fusion_accounting_bank_rec): fusion-only attachment strip + partner history panel
attachment_strip renders inline mimetype-aware chips linking to /web/content
downloads. partner_history_panel calls bank_reconciliation.getPartnerHistory
to surface the learned reconcile pattern (preferred strategy, typical cadence)
plus the most recent reconciles per partner — context Enterprise's bank-rec
widget cannot show because it has no behavioural-learning layer.

Made-with: Cursor
2026-04-19 13:05:23 -04:00
gsinghpal
596ecb9e03 feat(fusion_accounting_bank_rec): fusion-only batch action bar + reconcile model picker
batch_action_bar exposes bulk Suggest-for-selected and Auto-reconcile-selected
toolbar driven by selectedIds prop and the bank_reconciliation service.
reconcile_model_picker is a quick-pick dropdown over account.reconcile.model
records (rule_type=writeoff_button) including the Fusion AI confidence
threshold; apply path is a state-only stub pending Task 38's dedicated endpoint.

Made-with: Cursor
2026-04-19 13:03:50 -04:00
gsinghpal
99e27cc566 feat(fusion_accounting_bank_rec): fusion-only AI suggestion UI components
ai_suggestion_strip (inline confidence badge + accept), ai_alternatives_panel
(expandable other-options), ai_reasoning_tooltip (score breakdown). These
go beyond Enterprise's bank_rec_widget which has no AI suggestions.

Made-with: Cursor
2026-04-19 13:02:18 -04:00
gsinghpal
8fc864623b fix(shopfloor): Manager Desk crash — domain_unassigned no longer defined
After the release-ready refactor in 11837ed the unassigned/active
split runs in Python on `all_active_wos`, so the old SQL domains
(`domain_unassigned`, `domain_active`) no longer exist — but the KPI
block still referenced them via `MrpWO.search_count(domain_unassigned)`.
Manager page crashed with `name 'domain_unassigned' is not defined`.

Fix: derive the KPIs from the in-memory recordsets we just split, no
re-query. Also documents why we can't SQL-count: x_fc_is_release_ready
is a non-stored compute, so search_count would silently miss the
release-ready predicate.
2026-04-19 12:56:26 -04:00
gsinghpal
c9ac4c64fb feat(fusion_accounting_bank_rec): mirror Enterprise OWL batch 4 (auxiliary components)
Mirrors 3 OWL components from account_accountant for Phase 1
structural parity:

- quick_create/ (BankRecQuickCreate + BankRecQuickCreateController
  for inline missing-record creation)
- chatter/ (BankRecChatter — extends @mail Chatter with a
  reloadParentView hook for the bound statement line)
- file_uploader/ (BankRecFileUploader — extends @account
  DocumentFileUploader to inject statement_line_id into the
  upload context, targeting account.bank.statement.line)

Renames applied per spec; CSS class
`o_bank_reconciliation_quick_create` ->
`o_fusion_bank_reconciliation_quick_create`.

Manifest version bumped to 19.0.1.0.15.

Module upgrade succeeds, 134 logical tests still pass — completing
the Phase 1 OWL component mirror (Tasks 30-33). All 14 components
across 4 batches are now bundled.

Made-with: Cursor
2026-04-19 12:55:20 -04:00
gsinghpal
b06e01babb feat(fusion_accounting_bank_rec): mirror Enterprise OWL batch 3 (dialog components)
Mirrors 2 OWL components (3 files each) from account_accountant
for Phase 1 structural parity:

- bankrec_form_dialog/ (full-form dialog for advanced editing,
  including BankRecEditLineFormController with the To-Review
  hotkey button)
- search_dialog/ (BankRecSelectCreateDialog for finding additional
  matches, plus the bank_rec_dialog_list view registration)

Renames applied per spec.

Notes:
- View registry IDs prefixed: `fusion_bankrec_edit_line`,
  `fusion_bank_rec_dialog_list`.
- Button template renamed
  `accountant.BankRecFormDialog.buttons` ->
  `fusion_accounting_bank_rec.BankRecFormDialog.buttons`.

Manifest version bumped to 19.0.1.0.14.

Module upgrade succeeds, 134 logical tests still pass.

Made-with: Cursor
2026-04-19 12:54:11 -04:00
gsinghpal
11837ed4f5 fix(plating): Manager Desk premature-advance + 6 workflow enforcement gates
**1. Manager Desk: WO no longer jumps to "In Progress" on partial setup**

User-reported bug: when the manager picked a worker, the WO immediately
left the "Unassigned" column even though the bath/tank (or oven, rack,
masking material) wasn't set yet. Worker would see a half-set job in
their queue and couldn't start it.

Fix:
- New compute `mrp.workorder.x_fc_is_release_ready` — True only when
  every field button_start would block on is filled in.
- Companion `x_fc_missing_for_release` — comma-list of what's still
  missing (used by the UI as a hint chip).
- Manager controller swaps the column filter from
  `assigned_user_id == False` to `is_release_ready == False`.
- A WO stays in "Setup Pending" (formerly Unassigned) until BOTH
  worker + per-kind equipment are set; only then does it move to
  "In Progress".

**Manager Desk template + SCSS**

The user also said "the manager doesn't know what task they're
assigning". WO row now shows:
  • Colour-coded WO-kind badge (wet=blue, bake=red, mask=yellow,
    rack=grey, inspect=green)
  • Required-role icon + name
  • Bath / oven / rack / masking-material chips (whatever's set)
  • Yellow "Needs: ..." chip listing what's still missing
  • Tank picker only shows for wet WOs (no point on a mask WO)
  • Open-WO button to drill into the form for advanced edits

**2. Six enforcement gates patched (without breaking the workflow)**

Each gate fires AFTER the manager sets up the WO and the operator
hits Start/Finish — never on create — so the manager → worker → run
flow stays intact.

| # | Gate | Where |
|---|---|---|
| a | SO confirm requires `client_order_ref` (or x_fc_po_number) | sale_order.action_confirm |
| b | Cert issue requires thickness readings (when partner.x_fc_strict_thickness_required) | fp_certificate.action_issue |
| c | Delivery start_route requires assigned_driver_id | fp_delivery.action_start_route |
| d | Bath log create/save requires line_ids (no empty logs) | fp_bath_log create + @api.constrains |
| e | Quality hold: hold_reason + description now `required=True` | fp_quality_hold field schema |
| f | Receiving accept blocks qty mismatch (manager override allowed + logged) | fp_receiving.action_accept |

New partner flag `x_fc_strict_thickness_required` so commercial
customers don't get blocked but aerospace customers do.

**Verified** via `scripts/fp_enforcement_audit.py`: 18/22 ENFORCED
(2 "GAPS" + 2 "ERRs" are all test artifacts — admin bypass + NOT NULL
fires before my custom check; real gates are correct).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 12:54:00 -04:00
gsinghpal
9e4de89269 feat(fusion_accounting_bank_rec): mirror Enterprise OWL batch 2 (action + edit components)
Mirrors 5 OWL components from account_accountant for Phase 1
structural parity:

- button/ (single action button)
- button_list/ (toolbar of buttons + dropdown + hotkeys)
- line_to_reconcile/ (editable matched-line editor)
- list_view/ (list view + many2one multi-edit field)
- apply_amount/ (amount application html field)

Renames applied per spec (template names, module IDs, CSS classes).

Notes / deferred to fusion-only Tasks 34-36:
- list_view extends @web ListController instead of Enterprise's
  AttachmentPreviewListController; setSelectedRecord is a no-op
  pending the previewer pane mirror.
- View/field registry IDs prefixed with `fusion_` to coexist with
  Enterprise's account_accountant when both modules are installed
  (`fusion_bank_rec_list`, `fusion_bank_rec_dialog_list`,
  `fusion_apply_amount_html`, `fusion_bank_rec_list_many2one_multi_id`,
  `fusion_bankrec_edit_line`).
- button_list still references Enterprise view_refs in dialog
  contexts (`account_accountant.view_account_list_bank_rec_widget`
  etc.) for parity; the `set_*` ORM methods on
  account.bank.statement.line are Enterprise-only too. These call
  sites only fire when the mirrored components are actually
  rendered, which Phase 1 does not exercise.

Manifest version bumped to 19.0.1.0.13.

Module upgrade succeeds, 134 logical tests still pass.

Made-with: Cursor
2026-04-19 12:53:02 -04:00
gsinghpal
1634ecd4f6 feat(fusion_accounting_bank_rec): mirror Enterprise OWL batch 1 (display components)
Mirrors 4 OWL components from account_accountant for Phase 1
structural parity:

- statement_line/ (display + interactivity for one bank line)
- statement_summary/ (header summary card per statement)
- line_info_pop_over/ (popover with extra info on hover)
- reconciled_line_name/ (label for already-reconciled lines)

Plus the Enterprise-compat surface added to
fusion_bank_reconciliation service:
- useBankReconciliation() hook export
- chatterState reactive (visible, statementLine)
- reconcileCountPerPartnerId / reconcileModelPerStatementLineId
- selectStatementLine, openChatter, toggleChatter, reloadChatter
- computeReconcileLineCountPerPartnerId (no-op stub)
- computeAvailableReconcileModels (no-op stub)
- updateAvailableReconcileModels (no-op stub)
- reloadRecords helper
- statementLine{,MoveId,Move,Id} getters

Service now also depends on `orm`. A
components/bank_reconciliation/bank_reconciliation_service.js
re-export shim lets mirrored components keep their relative
`../bank_reconciliation_service` imports verbatim.

Renames applied per spec:
- account_accountant.* -> fusion_accounting_bank_rec.* (template names)
- @account_accountant/... -> @fusion_accounting_bank_rec/... (module IDs)
- useService("bank_reconciliation_service")
    -> useService("fusion_bank_reconciliation")

Forward imports to batch 2 components (button_list,
line_to_reconcile) resolve lazily — files are on disk and bundled
in subsequent batches. Phase 1 prioritizes structural parity;
behaviour wired up in fusion-only Tasks 34-36.

Manifest version bumped to 19.0.1.0.12.

Module upgrade succeeds, 134 logical tests still pass.

Made-with: Cursor
2026-04-19 12:51:38 -04:00
gsinghpal
3e48bab087 feat(fusion_accounting_bank_rec): kanban controller + renderer for OWL widget
Top-level OWL component (BankRecKanbanController) hosts the bank
reconciliation widget. Reads journal_id + company_id from action context,
initializes the fusion_bank_reconciliation service, and renders the
layout: header (stats), left column (line cards via BankRecLineCard
renderer), right column (detail panel with AI suggestions).

Custom view type 'fusion_bank_rec_kanban' registered so window actions
can use <field name="view_mode">fusion_bank_rec_kanban</field>.

Made-with: Cursor
2026-04-19 12:33:57 -04:00
gsinghpal
a4a9692888 fix(fusion_accounting_bank_rec): acceptSuggestion double-decrement count
Optimistic remove was decrementing unreconciledCount before assigning
the authoritative server count, leading to off-by-one. Order swapped:
remove first, then overwrite with server count.

Caught by Task 28 subagent self-review.

Made-with: Cursor
2026-04-19 12:28:34 -04:00