Files
Odoo-Modules/fusion_accounting_reports/migrations/19.0.1.1.2/pre-migration.py
gsinghpal 36964d6b79 feat(fusion_accounting_reports): adopt Enterprise account_reports look
User feedback: 'i like the odoo enterprise style reports, I hate our style.'

Replaces our custom 'o_fusion_reports' visual with a faithful adaptation
of Enterprise account_reports. Same .account_report root class, same
table semantics (line_name + line_cell + line_level_N), same border
treatment (1px gray-300 borders, 0.25rem radius, sticky thead), same
button hover behavior (gray-300 -> enterprise-action-color), same dense
0.8rem font-size + padded cells.

SCSS layout:
- reports.scss in web.assets_backend bundle (eager light)
- reports.dark.scss in web.assets_web_dark bundle (lazy dark mode)
- _variables.scss reduced to spacing/typography only -- colors use
  Odoo's \$o-* SCSS vars so dark mode flips automatically via the
  separate dark bundle
- old dark_mode.scss removed (was using non-Odoo [data-color-scheme]
  selector that never matched anything)

QWeb templates rewritten to mirror Enterprise's structure:
- report_viewer.xml roots at .account_report with scroll container
- report_table.xml uses Enterprise's td.line_name + td.line_cell with
  .wrapper > .content nesting; partner-grouped reports now actually
  render their aging buckets (previously showed nothing)
- period_filter.xml is now a clean Bootstrap-styled inline filter bar

Kept Fusion-only components but restyled to fit:
- anomaly_strip uses Bootstrap alert-{danger,warning,info} colors
- ai_commentary_panel is a plain bordered panel, no gradients/emojis
- drill_down_dialog unchanged (already a Bootstrap modal)

Made-with: Cursor
2026-04-20 01:41:41 -04:00

74 lines
2.2 KiB
Python

"""Pre-migration: convert legacy act_window report actions to client actions.
In 19.0.1.1.1 we shipped 11 ``ir.actions.act_window`` records with
``view_mode='fusion_reports'``. Odoo's act_window resolver requires a
matching ``ir.ui.view`` record per view_mode, so clicking those menus
raised "View types not defined fusion_reports".
19.0.1.1.2 reissues the same xml_ids as ``ir.actions.client`` records
with ``tag='fusion_reports'``. Odoo refuses to update a record across
models, so this pre-migration drops the legacy records before the new
data file loads. Idempotent: safe to re-run.
"""
import logging
_logger = logging.getLogger(__name__)
LEGACY_XIDS = (
'action_fusion_report_pnl',
'action_fusion_report_balance_sheet',
'action_fusion_report_trial_balance',
'action_fusion_report_general_ledger',
'action_fusion_report_cash_flow',
'action_fusion_report_executive_summary',
'action_fusion_report_annual_statements',
'action_fusion_report_tax_summary',
'action_fusion_report_aged_receivable',
'action_fusion_report_aged_payable',
'action_fusion_report_partner_ledger',
)
def migrate(cr, version):
if not version:
return
deleted = 0
for name in LEGACY_XIDS:
cr.execute(
"""
SELECT id, model, res_id
FROM ir_model_data
WHERE module = 'fusion_accounting_reports' AND name = %s
""",
(name,),
)
row = cr.fetchone()
if not row:
continue
ir_md_id, model, res_id = row
if model != 'ir.actions.act_window':
continue
cr.execute(
"DELETE FROM ir_act_window WHERE id = %s",
(res_id,),
)
cr.execute(
"DELETE FROM ir_actions WHERE id = %s",
(res_id,),
)
cr.execute(
"DELETE FROM ir_model_data WHERE id = %s",
(ir_md_id,),
)
deleted += 1
_logger.info("Dropped legacy act_window for fusion_accounting_reports.%s", name)
if deleted:
_logger.info(
"fusion_accounting_reports pre-migration: dropped %d legacy "
"act_window records to make way for ir.actions.client variants.",
deleted,
)