Repository navigation
Conversation
20.0 gives a service a span instead of a point: date is dropped, date_from and date_to added. date_from carries 19.0's date help text unchanged -- "Date when the cost has been executed" -- and the same default of today. That default is what makes the loss invisible. The column is created full, not empty, so nothing looks wrong: all six of the seed's service logs came out on the day the upgrade ran, having held six different dates. A vehicle's whole service history moves to today. After the rename: 6 distinct dates, none of them today. Assisted-by: Claude Opus 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
post-migration.py
19.0 recorded that a request was finished on its STAGE; 20.0 on the request.
19.0 had no lifecycle field. A request was finished when it sat in a stage
whose
maintenance.stage.donewas set -- "Repaired" and "Scrap" in thestandard data -- and
writereadstage_id.doneto decide whether to spawnthe next occurrence of a recurring request.
20.0 adds
maintenance.request.state, required, defaulting to 'normal'("In Progress"), and moves every consumer onto it:
maintenance_open_countcounts
state not in ('done', 'cancelled'), the equipment's effective date-- and so its MTBF -- counts corrective requests with
state == 'done', andwritemaintainsclose_datefrom it.The column is new, required and defaulted, so the ORM fills every existing
row with 'normal' and nothing raises: every request ever completed comes out
reading as still in progress, and the equipment statistics computed from
them read as though no maintenance had ever been finished.
The seed shows the contradiction directly -- two of its five requests carry
a
close_datewhile reading "In Progress", a combination 20.0's owncreateexists to prevent::Only rows still on the ORM's default are touched, so nothing another script
has already decided is overwritten.
post-migration.py
user_id (many2one) becomes user_ids (many2many), and nothing carries it.
19.0 assigned a request to one technician through
user_id. 20.0 drops thatfield for
user_ids, a many2many whose compute only ever adds theequipment's technician::
So a request assigned to anyone else -- a stand-in, a second-line engineer,
whoever took it over -- comes out assigned to nobody, or to the wrong person.
This seed cannot show it. All five of its requests are assigned to
exactly the technician their equipment carries, so the many2many comes out
right by coincidence and every after-the-fact comparison agrees. The evidence
is the pair of field definitions, and the migration test builds the row the
seed lacks: a request assigned to someone who is not the equipment's
technician.
user_idis read straight rather than through a legacy name: 20.0 declaresno field of that name on this model, so the upgrade leaves the column alone
and nothing can have overwritten it.
20.0's own company filter is applied rather than ignored.
_compute_user_idsdrops a user who does not belong to the request's company, so inserting one
here would put a name on the request that the next recompute takes off again.
The ones that excludes are reported rather than dropped in silence.
post-migration.py
19.0's kanban_state is gone and no 20.0 value certainly means the same.
19.0 carried a review indicator beside the stage: 'normal' (In Progress),
'blocked' (Blocked) and 'done' (Ready for next stage). 20.0 has no separate
indicator;
statecovers that axis with 'changes_requested' and 'approved'.The shapes line up loosely and the meanings do not. "Blocked" says the work
cannot proceed -- a missing part, a machine in use -- where "Changes
Requested" says a reviewer asked for something, so a request blocked on a
delivery would come out claiming a review that never happened. Nothing is
written, the count is reported, and the 19.0 answer stays in its column where
an administrator can act on it.
Every request in this seed is on 'normal', which is what
statedefaults toanyway, so on a standard database this reports nothing at all.
tests
openupgrade_scripts/scripts/maintenance/tests/data_maintenance_migration.pyopenupgrade_scripts/scripts/maintenance/tests/test_maintenance_migration.pyCI: red until #118 lands
The
testjob fails onduplicate key value violates unique constraint "res_country_state_name_code_uniq"(Ladakh / Odisha). Not this branch:base's pre-migration, which renames those two external ids, lives in #118 andis not on
20.0yet, so every branch cut from20.0alone hits it. Per thefork's model the per-PR check is the lean one; the real migration gate is the
integration branch (#120), where all of this runs green over the full
585-module seed.
AI-assisted (Claude Code); every change reviewed, tested, and owned by the author.