Odoo 11 Enterprise question.
How do I programmatically trigger a client-side JavaScript Odoo Widget event from within a Model onchange handler Python function executing on the server side?
I have a specific need to generate or tweak some dynamic front-end DOM content responsively on demand from code executing on the back end, specified by a string passed from the back end to the front end, presumably implementing this on the front end as a custom Odoo Widget that extends an AbstractField. In general, there are other circumstances I can foresee where I would need this capability in the future as well, and am flummoxed that it's so hard to accomplish this in Odoo.
Despite the abyssmally out-of-date and incomplete javaScript interface online documentation, I have managed to create custom field Widgets, and trigger handlers from human-generated events (keystrokes, mouse clicks, etc.) within a custom module, just not programmatically from the back end. JavaScript onchange and oninput handlers bound to fields are only triggered by real user events, not by synthetic modifications to these fields caused from program control.
As an alternative, I've also tried using the custom_event signaling mechanism, but in that approach can't cause the inter-widget signals to "bubble up" unless the sender and receiver widgets are in the same Widget lineage, which is not really possible in my scenario.
I suppose I could resort to creating a custom Widget that issues an unresolved AJAX request in its start() function, binding a promise function as the "callback" invoked when the request gets fulfilled on the back end, but that seems brittle, not very much in keeping with the intended Odoo event-triggering architecture, and I have a lingering suspicion that there's a more organic way to achieve this.
Before I waste time going down that (possibly unfruitful) path, I thought I'd solicit opinions from the community on how to do this simply, and what I may be overlooking.
**********************
This message may contain privileged or confidential information for the sole use of the intended recipient. Any review or distribution by others is strictly prohibited. If you are not the intended recipient of this message, you may not make use of, or rely in any way on this information. You should immediately notify the sender by reply email and destroy this message. Please advise us immediately if you or your employer do not consent to Internet email for messages of this kind.
**********************