Hi, I'm trying to execute some javascript code.
Javascript file :
openerp.web_quotation = function (instance) {
instance.web.client_actions.add('edit.action', 'instance.web_quotation.action');
instance.web_quotation.action = function (parent, action) {
console.log("Executed the action", action);
};
};
Thanks to this xml file, i can run my javascript fonction when I click on the menuitem, but it doesn't work with the button.
XML file :
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data><!-- Action to perform -->
<record id="view_order_form_button_action" model="ir.actions.client">
<field name="name">Button Action</field>
<field name="tag">edit.action</field>
</record><!-- Button linked to the action-->
<record id="view_order_form_button" model="ir.ui.view">
<field name="name">view.order.form.button</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<data>
<field name="name" position="after">
<button string="Edit" name="view_order_from_button_action" type="action"/>
</field>
</data>
</field>
</record>
<!-- Menuitem linked to the action--><menuitem action="view_order_form_button_action" id="view_order_form_menu" parent="base.menu_sales"/>
</data>
</openerp>
It doesn't give any error, and the javascript isn't executed.
What is wrong with this code ?