[IMP] Prevent duplicate module issues when renaming modules.#434
[IMP] Prevent duplicate module issues when renaming modules.#434ddejong-therp wants to merge 1 commit intoOCA:masterfrom
Conversation
2bc981d to
6eb7c32
Compare
|
Wasn't the argument merge_modules=True handling that? |
|
Well, |
|
But you have to use that argument when the module already exists, so I don't get the sense of the patch. |
|
The thing is, the method is being used in migration script of the base module, which uses apriori.py from the OpenUpgrade repo to determine for which modules that flag needs to be given as However, I think it is not always as simple as that. Think of this scenario: |
|
Doesn't |
|
Well I guess it would, but why have people rely on such a tool, if it doesn't need to happen in the first place? |
This PR changes the
update_module_namesmethod, to also remove a module when its state is "uninstalled".Sometimes a module from the 'rename' list of apriory.py, gets renamed to a given name, but a record with that name already exists in the ir_module_module table, with its state being "unistalled".
So that will cause duplicate key voilation error to happen.
If the module was previously uninstalled, but it needs to be installed because of a rename, why not allow that by removing the records related to the target/uninstalled module?
EDIT: Here someone else experienced the same thing: OCA/OpenUpgrade#4673