Odoo Help

Welcome!

This community 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.

1

Could not find client action

By
Samea
on 6/2/14, 8:23 AM 3,792 views

I was trying to follow this guide of building a web-module: https://doc.openerp.com/trunk/web/module/

I created the following files according to guide:

// static/src/js/first_module.js
openerp.web_example = function (instance) {
    instance.web.client_actions.add('example.action', 'instance.web_example.action');
    instance.web_example.action = function (parent, action) {
        console.log("Executed the action", action);
    };
};

__openerp__.py

# __openerp__.py
{
    'name': "Web Example",
    'description': "Basic example of a (future) web module",
    'category': 'Hidden',
    'depends': ['web'],
    'data': ['web_example.xml'],
    'js': ['static/src/js/first_module.js'],
}

web_example.xml

<!-- web_example/web_example.xml -->
<openerp>
    <data>
        <record model="ir.actions.client" id="action_client_example">
            <field name="name">Example Client Action</field>
            <field name="tag">example.action</field>
        </record>
        <menuitem action="action_client_example"
                  id="menu_client_example"/>
    </data>
</openerp>

__init__.py is empty.

Now the "Example Client Action" link appears to the topbar of the admin-panel like it should but when I click it I get a notification saying "Could not find client action example.action"

I have checked my code few times to ensure it's similar to guide's. Am I just blind to some minor error, is there a misconception or what could be the problem?  Should there be something in the __init__.py file? If yes, then what? 

same problem here! but in v7 the module works fine.

Peter Nietz
on 9/29/14, 9:12 AM

I had the same problem and I figured it out. I updated my old answer. I hope you find it helpful. If you like I can send you completed code.

Analystik, Hamid Darabi
on 11/10/14, 12:09 PM
2
Wayan Sumitra
On 10/20/14, 5:58 AM

After a couple of hours I found out the right solution:

Simple Solution:
Just download another example file from here: https://github.com/odoo/petstore (its for Odoo v8)
Documentation: http://odoo-80.readthedocs.org/en/latest/tutorials.html

Advanced Solution:
Remove from file __openerp__.py the following line:

'js': ['static/src/js/first_module.js']

And add the follwing lines in your web_example.xml file: (after <openerp><data> and before <record ...>

 <template id="assets_backend" name="web_example_assets" inherit_id="web.assets_backend">
            <xpath expr="." position="inside">
                <script type="text/javascript" src="/web_example/static/src/js/first_module.js"/>
            </xpath>
   </template>

So your link to js or css has to be linked in your xml file!

0
Hamid Darabi
On 10/17/14, 1:12 PM

I have the same problem and I think it's because I'm using odoo 8 but the tutorial is for previous versions. Is there any documentation/tutorial on 8th version?

---

Update:

I had the exact same problem and finally I found out the problem is indentations. I was using notepad++ and sometimes I've copied lines of code from tutorial, sometimes I wrote code using keyboard, etc. aparantly I had the same indentation everywhere but in some lines of code I hade a couple of spaces and in some others I had tabs. Finaly I solved the problem with using the same indentation for the same groups of code.

I recently realized that notepad++ has helper lines for groups of code with same indentation and +/- signs to collapse/expand the code.

0
Peter Nietz
On 10/9/14, 10:55 AM

ok, if you develop for Odoo, I think the problem is that the js files in the tutorial are included via the __openerp__py, but odoo needs them to include a

< script > tag 

with the js in your view xml file

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 6/2/14, 8:23 AM
Seen: 3792 times
Last updated: 3/23/15, 11:53 AM