Odoo Help
Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM
|
e-Commerce
|
Accounting
|
Inventory
|
PoS
|
Project management
|
MRP
|
etc.
How do I call a client action in return of a model function ?
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 !
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!
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 !
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.
RegisterOdoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.
Test it nowQuestion tools
Stats
Asked: 3/28/14, 8:03 AM |
Seen: 4120 times |
Last updated: 3/16/15, 8:10 AM |
Any success with this yet? I'm running across the same problem.