From a384996942c7cdcd19c2d74e9ba6391991018446 Mon Sep 17 00:00:00 2001 From: git_admin Date: Fri, 1 May 2026 15:01:04 +0000 Subject: [PATCH] Tower: upload laundry_management 19.0.19.0.4 (via marketplace) --- .../migrations/19.0.12.0.0/pre_migrate.py | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 addons/laundry_management/migrations/19.0.12.0.0/pre_migrate.py diff --git a/addons/laundry_management/migrations/19.0.12.0.0/pre_migrate.py b/addons/laundry_management/migrations/19.0.12.0.0/pre_migrate.py new file mode 100644 index 0000000..7619251 --- /dev/null +++ b/addons/laundry_management/migrations/19.0.12.0.0/pre_migrate.py @@ -0,0 +1,48 @@ +""" +Pre-migration for laundry_management 19.0.12.0.0 + +Changes handled: +1. Commission states: 'paid' only → now 'pending', 'confirmed', 'paid' + Existing 'paid' rows remain 'paid'. Existing 'pending' rows remain 'pending'. + 'confirmed' is a new state — no existing rows use it, so no data migration needed. + +2. New model: laundry.payment.wizard — just a new table, nothing to clean. + +3. New groups: group_laundry_operator, group_laundry_cashier added to hierarchy. + Existing users with group_laundry_user keep all their permissions (implied). + +4. Access control: new CSV entries for payment wizard and new groups. + Handled automatically by Odoo on upgrade. + +No destructive operations needed in this migration. +The pre_migrate script from 19.0.11.0.0 already cleaned the legacy tables. +""" +import logging + +_logger = logging.getLogger(__name__) + + +def migrate(cr, version): + if not version: + return # Fresh install + + _logger.info('pre_migrate laundry_management 19.0.12.0.0: checking commission states') + + # Ensure commission state column allows new 'confirmed' value. + # In Odoo, Selection fields are stored as VARCHAR — no schema change needed. + # Just verify the column exists and log the existing state distribution. + cr.execute(""" + SELECT state, COUNT(*) FROM laundry_commission + GROUP BY state + ORDER BY state + """) + rows = cr.fetchall() + if rows: + _logger.info( + 'pre_migrate: commission state distribution: %s', + {state: count for state, count in rows} + ) + else: + _logger.info('pre_migrate: laundry_commission table is empty — fresh data') + + _logger.info('pre_migrate laundry_management 19.0.12.0.0: complete')