Odoo Help

2

0
1 Answer
1
Avatar

Rihene France

--Rihene--

1283
| 5 2 9
Paris, France
--Rihene--


Rihene France
7/27/15, 8:19 AM

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

1 Comment
Rihene France
7/27/15, 8:24 AM

Here is an other link https://www.odoo.com/documentation/8.0/howtos/web.html Vote please :)

Ask a Question
Writer
Keep Informed
1 follower(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