Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
8213 Widoki

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) ?

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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 :)

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
lip 25
324
1
lip 25
5131
0
lip 25
686
0
cze 25
751
1
cze 25
920