Skip to content

[18.0][FIX] base_comment_template: fix tests#1142

Open
AungKoKoLin1997 wants to merge 1 commit intoOCA:18.0from
qrtl:18.0-fix-tests-base_comment_template
Open

[18.0][FIX] base_comment_template: fix tests#1142
AungKoKoLin1997 wants to merge 1 commit intoOCA:18.0from
qrtl:18.0-fix-tests-base_comment_template

Conversation

@AungKoKoLin1997
Copy link
Contributor

Odoo 18 introduced stricter test validation (odoo/odoo@de056cc#diff-80aef099e5fb41cc09e699d35b749152aca50caf5b0bc16c400081c29023fbec) that checks for unexpected attributes added to models during tests. Our tests extend the existing res.users model with the comment.template mixin, which adds comment_template_ids and causes AssertionError: Found unexpected attributes on res.users: comment_template_ids.

I fixed by registering the mixin attribute using classPatch(). If anyone has a cleaner solution, suggestions are welcome!

@qrtl QT6451

Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

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

Confirmed locally that the patch fixes the test error.

super().setUpClass()
setup_test_model(cls.env, ResUsers)
res_users_model = cls.env.registry["res.users"]
# Register the comment_template_ids field added by comment.template mixin
Copy link
Member

Choose a reason for hiding this comment

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

We may add a reference to odoo/odoo#247151 to provide more context.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants