upgrade-util icon indicating copy to clipboard operation
upgrade-util copied to clipboard

Validate model in remove model

Open niboo-ave opened this issue 5 months ago • 1 comments

Hello,

I don't understand the need to validate a model before it removal. ( https://github.com/odoo/upgrade-util/blob/6c9a30c2e0125194154de24b0a1380b4db836652/src/util/models.py#L73 )

I have the case where an other partner did a poor job at naming model (_name is "file_wizard") and I can't properly use the remove model ( I actually remove the full module but doesn't change much).

Currently i just commented the validate line on my local, but would be nice if we could use this in production.

Any explanation of the why this validation is required at removal is welkom, any other solution/work around is more than welkom.

Best Regards,

niboo-ave avatar Jul 25 '25 12:07 niboo-ave

any other solution/work around is more than welkom.

Just use the environment variable UPG_VALID_MODELS, example: UPG_VALID_MODELS='my_model1;my_model2;other_model' Ref: https://github.com/odoo/upgrade-util/blob/6c9a30c2e0125194154de24b0a1380b4db836652/src/util/helpers.py#L26

Any explanation of the why this validation is required at removal is welkom

It's a very common error to use a table name instead of the model name. Since this util won't fail if the model is not found the author may never notice their mistake until it's too late.

aj-fuentes avatar Jul 25 '25 12:07 aj-fuentes