Files
Odoo-Modules/fusion_plating/fusion_plating_configurator/migrations/19.0.22.1.0/pre-migrate.py
gsinghpal 8c76a16366 chore(plating): de-dash shipped code + intake-neutral customer emails
Replace em-dashes and en-dashes with hyphens across 789 shipped source
files (py/xml/js/scss) so the delivered module reads as human-written;
em-dashes had become a recognizable AI-generated tell. Internal .md dev
notes are excluded. The WO-sticker mojibake strippers keep their dash
search targets (now written — / –). No logic changes: comments
and display strings only; validated with py_compile + lxml parse.

Rewrite the 7 customer notification emails to be intake-neutral
(ship-in / drop-off / pickup) and repair-aware, and fix the Shipped
email documents line (packing slip vs bill of lading; certificate only
when issued). Subjects use a hyphen separator.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 00:16:19 -04:00

38 lines
1.4 KiB
Python

# -*- coding: utf-8 -*-
"""Pre-migration for 19.0.22.1.0 - material_process Char → Many2One.
The material_process field on fp.direct.order.wizard was originally a
free-text Char tag for shop-level metadata (e.g. "ENP-STEEL-HP-ADVANCED").
Per 2026-05-27 customer feedback, it should instead link directly to a
recipe (fusion.plating.process.node, node_type='recipe') so that picking
a tag auto-applies the recipe to every order line.
Drop the old VARCHAR column so Odoo can recreate it as an INTEGER FK
when the new field declaration loads. Per the Express Orders spec
section 12 (dev-stage, ignore past orders), losing the old Char values
is acceptable.
Idempotent - IF EXISTS guards mean a re-run is safe.
"""
def migrate(cr, version):
# Same model needs the same pre-migration on sale.order too
for table, column in (
('fp_direct_order_wizard', 'material_process'),
('sale_order', 'x_fc_material_process'),
):
cr.execute("""
SELECT data_type FROM information_schema.columns
WHERE table_name = %s AND column_name = %s
""", (table, column))
row = cr.fetchone()
if not row:
continue
data_type = row[0]
# Only drop if the existing column is the old Char shape
if data_type in ('character varying', 'text'):
cr.execute(
f"ALTER TABLE {table} DROP COLUMN IF EXISTS {column}"
)