[FIX] utm: avoid issue '"utm_stage" does not exist'#2372
[FIX] utm: avoid issue '"utm_stage" does not exist'#2372OCA-git-bot merged 1 commit intoOCA:13.0from
Conversation
|
As talked privately, I don't think this is the ideal solution, and other thing should be on the background. Anyway, your patch is declaring 2 times the same model with |
AaronHForgeFlow
left a comment
There was a problem hiding this comment.
Functionally speaking, it works :)
3e3e72f to
01e37a2
Compare
|
Hi. Thanks for the patch. As pedro said, I don't think it's a good idea to add code in modules. The second option you mention is more in the spirit of Openupgrade. (Create table in premigration script, if not exist) and not more complex. |
|
See my comment in #2392 (comment) |
|
@pedrobaeza that's true, triggering the default will be avoided if the column is precreated. Probably the best solution. |
|
@pedrobaeza @StefanRijnhart another solution could be moving |
|
@pedrobaeza @StefanRijnhart I think |
|
@dennybiasiolli what you are saying is what this PR already is doing. @pedrobaeza the column cannot be pre-created because the table doesn't exist. |
|
Something like this does not solve the problem: I've already made a PR to odoo repo (odoo/odoo#55795) in order to fix this at the source, but I can provide a PR here too, what do you think? |
|
@MiquelRForgeFlow I was thinking about something like this: #2393 |
|
@MiquelRForgeFlow if the problem is the table, pre-create the table as well. It's one SQL... |
Only affected databases without mass_mailing.
01e37a2 to
6968020
Compare
|
@dennybiasiolli you are not taken into account that this repo is getting updated from upstream from time to time, and we like to do the minimum changes in odoo code to avoid conflicts. @pedrobaeza ok, done. I just didn't want to create tables this way to avoid unexpected issues. |
|
Let me share with you why I'm so insistent with not modifying core source code: we are doing experiments with new features with migration addons path for avoiding to maintain full Odoo source code, and let OpenUpgrade only for pure migration scripts. There are still challenges like the changes in loading modules code, but it would be great to avoid to do upstream merges. |
|
/ocabot merge nobump |
|
On my way to merge this fine PR! |
|
Congratulations, your PR was merged at bf0d65e. Thanks a lot for contributing to OCA. ❤️ |
|
I'm trying right now the repo with the updated code, but it's not working. The newly created After adding that column in pre-migration script everything works fine. |
Only affected databases without mass_mailing, because those cannot obtain "utm_stage" table from "mail_mass_mailing_stage".
Description of the issue/feature this PR addresses:
utm.stage model is created after utm.campaign model, but stage_id field of utm.campaign relates to utm.stage. When installing the module, it doesn't break. But for unkown reason, when migrating, it breaks.
Thus, as an easy solution, we define the utm.stage model before utm.campaign model.
Another solution could be create the utm_stage table manually in pre-migration.
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr