Skip to content

[18.0][OU-ADD] fleet: Migration to 18.0#5310

Merged
pedrobaeza merged 1 commit into
OCA:18.0from
jguenat:18.0-mig-fleet
Aug 21, 2025
Merged

[18.0][OU-ADD] fleet: Migration to 18.0#5310
pedrobaeza merged 1 commit into
OCA:18.0from
jguenat:18.0-mig-fleet

Conversation

@jguenat

@jguenat jguenat commented Aug 14, 2025

Copy link
Copy Markdown
Member

No description provided.

@jguenat jguenat changed the title [OU-ADD] fleet: Migration to 18.0 [18.0][OU-ADD] fleet: Migration to 18.0 Aug 14, 2025

@carlos-lopez-tecnativa carlos-lopez-tecnativa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a minor change for a more detailed explanation of the work done.

Comment thread openupgrade_scripts/scripts/fleet/18.0.0.1/upgrade_analysis_work.txt Outdated
@jguenat jguenat force-pushed the 18.0-mig-fleet branch 2 times, most recently from 7abe774 to f4cc436 Compare August 19, 2025 12:22
Comment thread openupgrade_scripts/scripts/fleet/18.0.0.1/post-migration.py Outdated
Comment thread openupgrade_scripts/scripts/fleet/18.0.0.1/post-migration.py Outdated
@MiquelRForgeFlow MiquelRForgeFlow added this to the 18.0 milestone Aug 19, 2025
@MiquelRForgeFlow

Copy link
Copy Markdown
Contributor

/ocabot migration fleet

@carlos-lopez-tecnativa carlos-lopez-tecnativa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to be sure it also covers cases where the value is NULL or 0, you could use COALESCE, but LGTM.

TT54429

@pedrobaeza @MiquelRForgeFlow could you please review this?

Comment thread openupgrade_scripts/scripts/fleet/18.0.0.1/post-migration.py Outdated
Comment thread openupgrade_scripts/scripts/fleet/18.0.0.1/post-migration.py Outdated

@MiquelRForgeFlow MiquelRForgeFlow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to save the fleet models than to delete them.

Comment thread openupgrade_scripts/scripts/fleet/18.0.0.1/post-migration.py Outdated
Comment thread openupgrade_scripts/scripts/fleet/18.0.0.1/post-migration.py Outdated
Comment thread openupgrade_scripts/scripts/fleet/18.0.0.1/post-migration.py Outdated
),
]
)
data.unlink()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you use delete_records_safely_by_xml_id that tries to remove data if not used, or the XML-ID if not able to remove?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it like that first but then @MiquelRForgeFlow thought that it was better to keep the models even if not used. I tend to agree it should be the decision of the user not the migration script to remove or keep models.

@jguenat jguenat Aug 21, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also side technical question : delete_records_safely_by_xml_id does not remove the XML-ID but change it to no-update if unable to unlink the record. Why not delete the XML-ID ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was better to keep the models

In fact, Odoo didn't delete them. They moved them to demo data.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but in a practical side, they are not there on non demo databases, so trying to removing them is the logical way to handle it. Users may not remove them because they don't know they can.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suppose that from those vehicle models, you used 3. Thus, following you rationale, the other vehicle models would be deleted except those 3. It doesn't make much sense. Or you have them all, or you remove them all.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I see it as the correct behavior

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a personal point of view, not necessary the "correct" behavior, right? In this case, I believe there doesn't exist a "true correct one" behavior, and thus, I believe we should respect the option the author of this PR chooses.

Also side technical question : delete_records_safely_by_xml_id does not remove the XML-ID but change it to no-update if unable to unlink the record. Why not delete the XML-ID ?

BTW, the use of delete_records_safely_by_xml_id in this case would be incorrect, as it doesn't delete the model data:
Selection_4902

🤔 Maybe we should create another method where the exception is:

imd.unlink() instead of imd.noupdate = true.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we look it in a positive way meaning user are well enough savy with Odoo to archive/delete model they don't use then they can do the cleaning themself if they want/need to.
Also there is a menu entry (not in technical) to open models (tree, form, search view and all) so we might imagine someone is using this natively without linking models to vehicles but just do do statistics or something. We can also thing about customizations that might use models do do other things that might lead to bad outcome if we "safely" delete them.
I know this is far stretched and it was certainly a mistake made by odoo to have these models in module data and not in demo data.
My opinion is to keep them :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I think the usage of this module is niche, so it won't affect too much. Let's continue!

@pedrobaeza pedrobaeza merged commit 425bdcf into OCA:18.0 Aug 21, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants