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
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
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 :)
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký