support 'open' on many2many_tags

[ADD] support 'no_open_edit' on many2one
[FIX] typos
This commit is contained in:
Holger Brunn
2015-07-10 15:39:06 +02:00
committed by Germana
parent 2f939bbb03
commit 4ac8c3945c
5 changed files with 111 additions and 22 deletions

View File

@@ -336,6 +336,30 @@ openerp.web_m2x_options = function (instance) {
return values;
})
},
render_value: function()
{
var self = this;
return jQuery.when(this._super.apply(this, arguments))
.then(function()
{
if(self.options.open)
{
self.$el.find('.oe_tag')
.css('cursor', 'pointer')
.click(function(e)
{
var id = parseInt(jQuery(this).attr('data-id'));
self.do_action({
type: 'ir.actions.act_window',
res_model: self.field.relation,
views: [[false, 'form']],
res_id: id,
});
});
}
});
},
});
};

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-extend="FieldMany2One">
<t t-jquery="a.oe_m2o_cm_button">
jQuery(this).attr('t-if', '!(widget.options.no_open || widget.options.no_open_edit)');
</t>
</t>
<t t-extend="FieldMany2ManyTag">
<t t-jquery="span.oe_tag">
jQuery(this).attr('t-att-data-id', 'el[0]');
</t>
</t>
</templates>