i have followed a tutorial and i added:
static/src/js/resource.js and static/src/xml/resoruce.xml
This is resource.js
openerp.resource = function (openerp)
{
openerp.web.form.widgets.add('test', 'openerp.resource.Mywidget');
openerp.resource.Mywidget = openerp.web.form.FieldChar.extend(
{
template : "test",
init: function (view, code) {
this._super(view, code);
console.log('loading...');
}
});
}
resource.xml
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="test">
<html>
<body>
<div id="fb-root"></div>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like" data-send="true" data-layout="box_count" data-width="600" data-show-faces="false" data-font="arial"></div>
</body>
</html>
</t>
</templates>
__openerp__.py
{
"name" : "Destin",
"version" : "0.1",
"author" : "",
"category" : "Routes",
"depends" : ["sale", "fleet", "account"],
"data" : ['routes_view.xml'],
"init_xml" : [],
"js" : ['static/src/js/resource.js'],
"qweb" : ['static/src/xml/resource.xml'],
"demo_xml" : [],
"update_xml" : [],
"installable": True,
"active": True
}
But when i try to use it like this in xml view, does not show. It's like doesn't exist:
<record id="view_best_rutas_form" model="ir.ui.view">
<field name="name">best.route</field>
<field name="model">best.route</field>
<field name="priority">1</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Mejores Rutas" version="7.0">
<header>
<button name="show_best_route" type="object" string="Calcular orden de entrega" class="oe_highlight"/>
</header>
<field name="origen" string="Coordenadas de origen:" widget= "test"/>
<field name="invoices" string="Facturas para Enviar" widget="one2many" colspan="4" nolabel="1">
<tree editable="bottom">
<field name="inv_id" domain="[('has_route','=',False), ('has_destination','=',True)]"/>
<field name="order"/>
</tree>
</field>
<field name="fleets" string="Flotas" widget="one2many" colspan="4" nolabel="1">
<tree editable="bottom">
<field name="fleet_id"/>
</tree>
</field>
</form>
</field>
</record>
Does anybody have a clue of why isn't it working?