server-ux
server-ux copied to clipboard
[15.0][FIX] base_substate: track template on substate
Move function _track_template() on base_substate_mixin to mail_thread
Currently, Email Template on Base Substate is not working.
Step to error:
- Create base substate and add Email Template
- Change substate to substate there is email template, it will not send email template.
I can confirm the issue.
Now everybode seems to be patching it in their *_substate module.
Test on this one are failling. Unit tests on 15.0 branch are currently broken. Fix in: https://github.com/OCA/server-ux/pull/733 Can you review the fix?
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.
Just tested this locally. The error still exsists.
Traceback (most recent call last):
File "/opt/odoo/custom/src/odoo/odoo/service/server.py", line 1260, in preload_registries
registry = Registry.new(dbname, update_module=update_module)
File "/opt/odoo/custom/src/odoo/odoo/modules/registry.py", line 87, in new
odoo.modules.load_modules(registry, force_demo, status, update_module)
File "/opt/odoo/custom/src/odoo/odoo/modules/loading.py", line 470, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/opt/odoo/custom/src/odoo/odoo/modules/loading.py", line 363, in load_marked_modules
loaded, processed = load_module_graph(
File "/opt/odoo/custom/src/odoo/odoo/modules/loading.py", line 198, in load_module_graph
registry.setup_models(cr)
File "/opt/odoo/custom/src/odoo/odoo/modules/registry.py", line 279, in setup_models
model._prepare_setup()
File "/opt/odoo/custom/src/odoo/odoo/models.py", line 2975, in _prepare_setup
cls.__bases__ = cls.__base_classes
TypeError: Cannot create a consistent method resolution
order (MRO) for bases BaseModel, base, mail.thread, mail.activity.mixin, base.substate.mixin
@bosd Thank you for checked.
Error because this model base.substate.mixin use mail.thread inherit and other module such as hr_expense_substate inherit mail.thread already
So, i deleted inherit and someone must inherit mail.thread itself if model not support
@Saran440 Can you please force push again. To see if tests pass this time?
@oca/server-ux-maintainers Can we get a merge here?
Well, you could argue "my" solution is a bit more finicky because you need to make sure that inherits are in the right order, but this is something that is true in all the rest of Odoo's ORM (and arguably all of OOP).
But I think the reason this solution is worse is that this bypass the mail being sent in the post commit hook. This feature has been done to avoid a flow that would crash after it has sent an email (you can imagine the spam as the backend user will never see the message in DB). It's better to let mail.thread handle everything.
Well, you could argue "my" solution is a bit more finicky
So should we proceed with this one?
I think the usage of the post commit hook is a strong argument. We can therefore go with @len-foss's solution or refactor the solution proposed here such that the outgoing mail is only triggered in the post commit hook. That is probably best of both worlds, but it requires additional development.
What a great day to merge this nice PR. Let's do it! Prepared branch 15.0-ocabot-merge-pr-735-by-pedrobaeza-bump-patch, awaiting test results.
Congratulations, your PR was merged at 0eba1533340e144e14853a2d92fa46c38792d3a4. Thanks a lot for contributing to OCA. ❤️