library/static/src/js/library.js : -
console.log('hi..........') // Custome message to dispaly on console
openerp.library = function(instance){
console.log('Object',instance)
instance.web.form.widgets.add('link', 'openerp.library.Mywidget');
instance.library.Mywidget = instance.web.form.Widget.extend( { //Extend the form view
template : 'link', // Template Name
init : function(arg){
console.log('initi....my custome widget');
}
})
}
library/static/src/xml/library.xml :-
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="link">
<div>
Currently Not Defined
</div>
</t>
</templates>
__openerp__.py :-
{
"name": "Library Management System",
"version": "0.1",
"author": "Hiral",
'js': ['static/src/js/library.js',], #Path of js file
'qweb': ['static/src/xml/library.xml'], #Path of XML file
}
"version": "0.1",
"author": "Hiral",
'js': ['static/src/js/library.js',], #Path of js file
'qweb': ['static/src/xml/library.xml'], #Path of XML file
}
Thanks Hiral for your post, I need to create new widget for website not web module. i tried your code nothing works. Could you post a tutorial for website module.
ReplyDelete