server-ux
server-ux copied to clipboard
[16.0][FIX] base_substate: track template on substate
This PR cherry-pick from https://github.com/OCA/server-ux/pull/735
@pedrobaeza Can you please merge this? 🙏
@etobella We are talking about this one. It is not likely to get merged soon in this current form. Should this block the other pr?
:innocent: Why is this change negativly impacting performant?
It impacts because this is evaluated for each writing in every model in Odoo inheriting from mail thread, instead of only those inheriting from the substate mixin.
Ok, I agree with @pedrobaeza it shouldn't inherit in mail.thread
@etobella Thank you for your suggest.
If we use base.substate.mixin inherit mail.thread
and move function _track_template() back to base.substate.mixin
it will not create new abstract. what do you think?
_name = "base.substate.mixin"
_inherit = "mail.thread"
Oops, the discussion here seems to have halted. As well as the dev/merging of other substate modules.
@Saran440 Can we get things moving again? Can you rebase/force push to recreate runboat / tests?
Ping @Saran440 It has been a while since we worked on several substate modules. Things got stale over time. What do we need to do to get things moving again?
@bosd I fixed test script and some bug in function _track_template().
Can you check and test template in https://github.com/OCA/account-invoicing/pull/1568 please. Thank you.
Can you check and test template in OCA/account-invoicing#1568 please. Thank you.
Sorry to keep you waiting...
With the version of base_substate in this PR I'm getting an error:
RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
File "/opt/odoo/custom/src/odoo/odoo/http.py", line 1584, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "/opt/odoo/custom/src/odoo/odoo/service/model.py", line 133, in retrying
result = func()
File "/opt/odoo/custom/src/odoo/odoo/http.py", line 1611, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/opt/odoo/custom/src/odoo/odoo/http.py", line 1809, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "/opt/odoo/custom/src/odoo/odoo/addons/base/models/ir_http.py", line 154, in _dispatch
result = endpoint(**request.params)
File "/opt/odoo/custom/src/odoo/odoo/http.py", line 697, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/opt/odoo/auto/addons/web/controllers/dataset.py", line 46, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/opt/odoo/auto/addons/web/controllers/dataset.py", line 33, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/odoo/custom/src/odoo/odoo/api.py", line 461, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/opt/odoo/custom/src/odoo/odoo/api.py", line 448, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "<decorator-gen-69>", line 2, in button_immediate_install
File "/opt/odoo/custom/src/odoo/odoo/addons/base/models/ir_module.py", line 76, in check_and_log
return method(self, *args, **kwargs)
File "/opt/odoo/custom/src/odoo/odoo/addons/base/models/ir_module.py", line 491, in button_immediate_install
return self._button_immediate_function(type(self).button_install)
File "/opt/odoo/custom/src/odoo/odoo/addons/base/models/ir_module.py", line 615, in _button_immediate_function
registry = modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "<decorator-gen-14>", line 2, in new
File "/opt/odoo/custom/src/odoo/odoo/tools/func.py", line 87, in locked
return func(inst, *args, **kwargs)
File "/opt/odoo/custom/src/odoo/odoo/modules/registry.py", line 90, in new
odoo.modules.load_modules(registry, force_demo, status, update_module)
File "/opt/odoo/custom/src/odoo/odoo/modules/loading.py", line 488, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/opt/odoo/custom/src/odoo/odoo/modules/loading.py", line 372, in load_marked_modules
loaded, processed = load_module_graph(
File "/opt/odoo/custom/src/odoo/odoo/modules/loading.py", line 207, in load_module_graph
registry.setup_models(cr)
File "/opt/odoo/custom/src/odoo/odoo/modules/registry.py", line 285, in setup_models
model._prepare_setup()
File "/opt/odoo/custom/src/odoo/odoo/models.py", line 2703, 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, sequence.mixin, base.substate.mixin
The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
at makeErrorFromResponse (http://localhost:16069/web/assets/435-e992299/web.assets_backend.min.js:973:163)
at XMLHttpRequest.<anonymous> (http://localhost:16069/web/assets/435-e992299/web.assets_backend.min.js:981:13)
@Saran440 Can you attend to the error? It might be applicable to the backport in V15
What is the status of this one?
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.
@pedrobaeza Is this one ok for you now?
Why previous approach didn't work?
@pedrobaeza See https://github.com/OCA/sale-workflow/pull/3483 for why the previous approach did not always work, and how it can be solved without overriding write.
On my way to merge this fine PR! Prepared branch 16.0-ocabot-merge-pr-736-by-pedrobaeza-bump-patch, awaiting test results.
Congratulations, your PR was merged at 52d41cc9c3e9620d6f42dd4bcaac3bdf07ddae5a. Thanks a lot for contributing to OCA. ❤️
@pedrobaeza I take it that you didn't like the solution that depends on the inheritance order?
Well, I didn't see that alternative approach. I just saw that overwriting the write one was too much intrusive, and that they have proposed an alternative one having enough support.
@pedrobaeza Well, as you can see in https://github.com/OCA/sale-workflow/pull/3483/files it does not have the intrusive write, and is more in line with the standard Odoo tracking mechanism using the cursor commit hooks. Should we go that way for 17.0?
OK then, let's improve it in 17.0