Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
22774 Vistas

Hello everyone,

In my project, I had to create a web module (initally following the openerp tutorial) to show some specific information, from several different models (like a kanban view with trees inside).

For now, I display this "web view" using a menu, which calls the client action I created for my module, like this :

<menuitem id="main_results_menu" name="Results" />

<menuitem id="result_menu" name="Results"
    parent="main_results_menu" />

<record id="action_results_show" model="ir.actions.client">
    <field name="name">Results</field>
    <field name="tag">results.result</field>
</record>

<menuitem id="result_menu_show" name="Show results" parent="result_menu"
    action="action_results_show"/>

In my client code, I add the client action like this :

instance.web.client_actions.add('results.result', 'instance.rip.ResultsView');

Everything works fine, but the final goal is to present my "web view" after I execute some python code from a button in a classic form view.

The button executes some searches, then should show my view. I tried this, but I get an error ("Action manager can't handle action of type ir.action.client")

res = {
    'type': 'ir.action.client',
    'name':'Résultats',
    'tag':'results.result',
}
return res

Is there any way to achieve this ?

Thank you !

Avatar
Descartar

Any success with this yet? I'm running across the same problem.

Mejor respuesta

I was having the same issue as you, and I just figured it out. There is no such type as "ir.action.client". It's "ir.actions.client".

So your code should be:

res = {
    'type': 'ir.actions.client',
    'name':'Résultats',
    'tag':'results.result',
}
return res

And this illustrates why using class properties and constants instead of "magic strings" is generally a good thing to do.

Hope this helps you!

Avatar
Descartar
Autor

Thank you for this answer. Finally, I changed my web module for a form widget, and I don't have any issues now,, Hope this answer can help anyone else !

Publicaciones relacionadas Respuestas Vistas Actividad
1
ene 17
5752
1
mar 15
5848
1
mar 15
9116
1
mar 15
8110
1
feb 21
5670