Odoo Aide

0

1
1 Answer
0
Avatar

Prakash

--Prakash--

3556
| 6 6 9
Bikaner, Inde
--Prakash--

OpenERP Developer at SunARC Technology

Prakash
06/05/2014 06:08

Following doc.openerp.com/trunk/web/module/ the below Code will works:-

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>

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 = instance.web.Widget.extend({
    className: 'oe_web_example',
    start: function () {
         this.$el.text("Hello, world!");
        //console.log("Executed the action", action); Action is not defined
        return this._super();
    }
});
};
2 Comments
anonymous 2183
06/05/2014 06:26

Thanks man. you known I just change one line of code which you comment it out, that because this.$el.text("Hello, world!") got same error. and if I change the instance.web_example.Action = function(...... , it works. BTW, I restart the server and refresh browser.

anonymous 2183
06/05/2014 12:28

Finally sort it out, there is a inconsistent typing in the tutorial, previous one is instance.web.client_actions.add('example.action', 'instance.web_example.action', next step is instance.web.client_actions.add('example.action', 'instance.web_example.Action', thanks for the help anyway.

Poser une question
Étiquettes
Keep Informed
0 Abonné(e)s
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.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now