How to Add custom Widget in your open ERP module ..
Here are steps :
By : Pinakin Nayi
Trainee OpenERP,
Gandhinagar.
E-mail : nayi_pinakin@yahoo.in
Step 1 :
create a folder
--> static
--> src
-->js
->lib.js
--> xml
-> lib.xml
--> css
-> .css
Step 2 :
Register your xml file in __openerp__.py
Like this
'css': [ 'static/src/css/resource.css' ],
'js': [ 'static/src/js/lib.js' ],
'qweb' : [ 'static/src/xml/lib.xml', ],
Step 3 :
In "lib.xml" create your template
like ,
<templates id="template" xml:space="preserve">
<t t-name="link">
<div>manage your template </div>
</t>
</templates>
Step 4 :
In "lib.js" create your template
like ,
openerp.lib = function(instance)
{
console.log('tTTT',instance)
instance.web.form.widgets.add('link', 'openerp.lib.Mywidget');
instance.lib.Mywidget = instance.web.form.Widget.extend( {
template : 'link',
init : function(arg)
{
console.log('initi....my custome widget');
}
})
}
Step 5 :
In this test i have only write "manage your template" instread of that you can
write your own template to implement ..
Step 6 :
Now , your Widget is ready ,
you have to implement this in your tag.
<field name="description" colspan="4" widget="link" />
Here are steps :
By : Pinakin Nayi
Trainee OpenERP,
Gandhinagar.
E-mail : nayi_pinakin@yahoo.in
Step 1 :
create a folder
--> static
--> src
-->js
->lib.js
--> xml
-> lib.xml
--> css
-> .css
Step 2 :
Register your xml file in __openerp__.py
Like this
'css': [ 'static/src/css/resource.css' ],
'js': [ 'static/src/js/lib.js' ],
'qweb' : [ 'static/src/xml/lib.xml', ],
Step 3 :
In "lib.xml" create your template
like ,
<templates id="template" xml:space="preserve">
<t t-name="link">
<div>manage your template </div>
</t>
</templates>
Step 4 :
In "lib.js" create your template
like ,
openerp.lib = function(instance)
{
console.log('tTTT',instance)
instance.web.form.widgets.add('link', 'openerp.lib.Mywidget');
instance.lib.Mywidget = instance.web.form.Widget.extend( {
template : 'link',
init : function(arg)
{
console.log('initi....my custome widget');
}
})
}
Step 5 :
In this test i have only write "manage your template" instread of that you can
write your own template to implement ..
Step 6 :
Now , your Widget is ready ,
you have to implement this in your tag.
<field name="description" colspan="4" widget="link" />