feat(plating-migration): dry-run + Owner-approval workflow
Phase H of permissions overhaul (LAST subagent phase). New models: - fp.migration.preview (state: pending/approved/cancelled/rolled_back) - fp.migration.preview.line (one per active internal user) On -u, post_init_hook creates a preview in 'pending' state, walks all active non-share users through the 12-rule mapping predicate chain (first match wins, highest precedence first), and schedules a mail.activity on every Owner. Mapping table (per spec Section 5): uid 1/2 / Administrator -> owner CGP DO (existing) -> owner + res.company DO field set CGP Officer -> quality_manager Manager / Shop Mgr (old) -> manager Accounting -> manager Estimator-without-Manager -> sales_rep (flagged: loses confirm) Supervisor / Receiving -> shop_manager Operator -> technician catchall -> 'no' Owner clicks 'Approve & Run' on the preview form -> sudo write removes old plating groups, adds new role's group, posts Markup chatter audit. Optionally sets res.company.x_fc_cgp_designated_official_id for the DO. 30-day rollback window via JSON snapshot of groups_id per line. Daily cron (Fusion Plating: Purge Expired Role Migrations) clears snapshots + unlinks old [DEPRECATED] groups after 30 days. ACL: fp.migration.preview + .line both Owner-only (CRUD). Menu: Plating > Configuration > Role Migrations (Owner-only). Tests cover: only-Owner-can-approve, approve advances state, cancel blocks after approval, rollback restores groups_id, Estimator warning flagged, uid 2 maps to owner, rollback blocked after 30 days. Per CLAUDE.md: ir.cron uses only Odoo-19-valid fields (no numbercall, no doall). Post-init hook is idempotent — won't double-create previews or re-fire if all users already migrated. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
{
|
||||
'name': 'Fusion Plating',
|
||||
'version': '19.0.21.0.5',
|
||||
'version': '19.0.21.0.6',
|
||||
'category': 'Manufacturing/Plating',
|
||||
'summary': 'Core plating / metal finishing ERP: facilities, processes, tanks, baths, jobs, operators.',
|
||||
'description': """
|
||||
@@ -140,6 +140,12 @@ Copyright (c) 2026 Nexa Systems Inc. All rights reserved.
|
||||
# 'data/fp_recipe_anodize.xml',
|
||||
# 'data/fp_recipe_chem_conversion.xml',
|
||||
'data/fp_step_template_data.xml',
|
||||
# Phase H — Owner-approval migration workflow.
|
||||
# Views file declares the action + menu; cron declares the
|
||||
# daily 30-day expiry purge. Both reference model_fp_migration_preview
|
||||
# which Odoo's model autoload makes available before data load.
|
||||
'views/fp_migration_views.xml',
|
||||
'data/fp_migration_cron.xml',
|
||||
],
|
||||
'post_init_hook': 'post_init_hook',
|
||||
'assets': {
|
||||
|
||||
Reference in New Issue
Block a user