Skip to content

[20.0][MIG] mail - #6087

Open
hbrunn wants to merge 80 commits into
OCA:20.0from
hbrunn:20.0-mail
Open

hbrunn wants to merge 80 commits into
OCA:20.0from
hbrunn:20.0-mail

Conversation

@hbrunn

@hbrunn hbrunn commented Nov 10, 2026

Copy link
Copy Markdown
Member

legalsylvain and others added 30 commits September 29, 2026 16:02
If we don't include it, /jsonrpc route doesn't work.
If you have a module in previous versions that adds data on a model,
and such model is not loaded in the registry in current version because
the module is absent in it, you can't uninstall such module, getting
this error:

  File "odoo/odoo/addons/base/models/ir_model.py", line 1945, in _module_data_uninstall
    delete(self.env[model].browse(item[1] for item in items))
  File "odoo/odoo/api.py", line 463, in __getitem__
    return self.registry[model_name]._browse(self, (), ())
  File "odoo/odoo/modules/registry.py", line 177, in __getitem__
    return self.models[model_name]
KeyError: 'model'

With this patch, data cleanup of such model is skipped and there's no crash.
…ore ; add links to the new OpenUpgrade website
If corresponding field is None, we need to avoid the "AttributeError: 'NoneType' object has no attribute error.
…e useless after the input argument validate has been removed
Because we captured the exception in _raise_view_error and archived that
view, so info is None, but it is called to info.get('select') in
NameManager.check, which will raise an exception AttributeError, so we
need to override to not raise an exception
@oca-cla-bot

oca-cla-bot Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

CLA not signed

@hbrunn

hbrunn commented Nov 10, 2026

Copy link
Copy Markdown
Member Author

/ocabot migration mail

@OCA-git-bot OCA-git-bot added mod:openupgrade_scripts Module openupgrade_scripts mod:openupgrade_framework Module openupgrade_framework series:20.0 labels Nov 10, 2026
@OCA-git-bot OCA-git-bot added this to the 20.0 milestone Nov 10, 2026
@OCA-git-bot OCA-git-bot mentioned this pull request Nov 10, 2026
3 of 7 tasks

@mauro2306 mauro2306 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Tested on a local bench at 96f34e8 (on top of #6068 at a3077e1), with openupgradelib 3.13.7 plus the change of OCA/openupgradelib#468, from a v19 database with tracked changes on partners and invoices. Same procedure as test-migration.yml, with base_setup and web kept installed.

The migration completes and the 4 tests pass. On the mail_tracking side, which I raised in #6077:

  • mail_tracking and mail_tracking_sms get installed, and all tracking values are kept (only currency_id is deleted, as in the analysis);
  • the action and the menu keep their ids, and setting message_type = 'tracking' is a nice touch I had missed;
  • moving the model's xmlids isn't needed after all: the mail.* xmlids of the model and its fields are removed at the end, and the records stay, since mail_tracking gives them its own.

Two suggestions:

  1. The two views are deleted and recreated with new ids (see the line comment).

  2. There is no test that the tracking values survive. These two pass on this branch, and they have to live in scripts/mail_tracking/tests, since mail's own tests run before mail_tracking is loaded:

    • data_mail_tracking_migration.py: creates a partner, commits, then changes its email and commits again (a change in the creating transaction isn't tracked);
    • test_mail_tracking_migration.py: checks that mail_tracking is installed and that the email change still has its tracking value, old and new.

    Happy to open a PR against your branch with them.

One question: mail_tracking is only installed when there are tracking values. On a database with none, field tracking, which worked in v19, is off after the migration. Is that intended, to match a fresh 20.0 install?

@FerDeNetlab since @hbrunn opened this one, I'm reviewing here rather than opening a second mail PR.

Comment on lines +6 to +12
_renamed_xmlids = [
(
"mail.action_view_mail_tracking_value",
"mail_tracking.action_view_mail_tracking_value",
),
("mail.menu_mail_tracking_value", "mail_tracking.menu_mail_tracking_value"),
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The two views move too. Without these, they're deleted and recreated with new ids, which breaks any custom view inheriting them.

Suggested change
_renamed_xmlids = [
(
"mail.action_view_mail_tracking_value",
"mail_tracking.action_view_mail_tracking_value",
),
("mail.menu_mail_tracking_value", "mail_tracking.menu_mail_tracking_value"),
]
_renamed_xmlids = [
(
"mail.action_view_mail_tracking_value",
"mail_tracking.action_view_mail_tracking_value",
),
("mail.menu_mail_tracking_value", "mail_tracking.menu_mail_tracking_value"),
(
"mail.view_mail_tracking_value_form",
"mail_tracking.view_mail_tracking_value_form",
),
(
"mail.view_mail_tracking_value_tree",
"mail_tracking.view_mail_tracking_value_tree",
),
]

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.

done

@hbrunn

hbrunn commented Nov 17, 2026

Copy link
Copy Markdown
Member Author

@mauro2306 please ask yourself for every paragraph you paste from your bullshit generator if it has value for others to read. I'd say no for most of them.

the tests you propose aren't really interesting, we don't test things for its own sake, but when in doubt or when it's likely future changes to migration scripts might affect desired behavior unintentionally.

if there's a database without tracking values, it's very likely there was an effort made to make it so, which seems a good indicator such databases shouldn't have mail_tracking installed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:openupgrade_framework Module openupgrade_framework mod:openupgrade_scripts Module openupgrade_scripts series:20.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.