Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
8197 Visualizzazioni

On javascript side, how its possible to trigger ir.action.client outside of the widget? Is it possible to use do_action function which is defined in AbstractWebClient outside of this class definition?

Consider this ... I am rendering static template - where I am rendering top menu (which will be shared across multiple widgets). I would like to bind actions in that menu and to be able to trigger ir.action.client function to switch left and right with something like:

$(document).on("click", ".o_dashboard", function(e) {
    var action = {
        type: "ir.actions.client",
        tag: "mymodule.tag_name"
    };

    // TRIGGER ACTION SOMEHOW HERE!
});

where, declaration above is outside of widget definition in separate module. Is this possible. Is there alternative way to do something like this?

Additionally, is it possible to define the button in static xml, which is going to behave as a trigger for ir.action.client when we provide properties like type="object", or static xmls do not have any kind of this behaviour (they are just static as word says) ?

Avatar
Abbandona
Autore Risposta migliore

Based on my research within the odoo core, without  writting your own functionality for this (which would take some time for sure - due to the fact that you need to update brows history and similar - and trigger proper events which odoo is triggering by defailt) - seems that this is not possible.

There is one thing which theoretically you can try (which I did not - due to the lack of time)
- You could create one general wiget, which will need to be extended by ANY other widgets you create and for which you want them to share this functionality. And then, within that widget, you could try using parent functions (from which you extended things)

I think that would work - but at this moment its just a suggestion for implementation and testing. If someone have time to test this and check - please post results here :)

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
lug 25
313
1
lug 25
5107
0
lug 25
669
0
giu 25
728
1
giu 25
900