I need to create a button in js file and i want access openerp method by using this button...
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
This question has been flagged
To create a button in js you should create a qweb module.
Here i give you an example.
you create a directory called static in which you put a directory named src in which you put three directory called js, xml, css with .css , .js and .wml extansion of files.
Call the module web_example.
So in your:
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({
template: 'web_example.action',
events: {
'click .oe_web_example_file button': 'Upload',
},
});
instance.web.form.custom_widgets.add('momo2', 'instance.web_example.Action');
};
XML:
<templates>
<div t-name="web_example.action" class="oe_web_example oe_web_example_stopped">
<p class="oe_web_example_file">
<input type="file" id="fileUpload" name="file" />
<button>entire file</button>
</p>
</div>
</templates>
CSS:
.openerp .oe_web_example {
color: black;
background-color: white;
height: 100%;
}
In your __openerp__.py:
'js': ['static/src/js/xxxx.js'],
'css': ['static/src/css/xxxx.css'],
'qweb': ['static/src/xml/xxxx.xml'],
Here is also a useful link:
http://openerp-web-v7.readthedocs.org/en/latest/module.html
Here is an other link https://www.odoo.com/documentation/8.0/howtos/web.html Vote please :)