forked from Techsystech/web
support 'open' on many2many_tags
[ADD] support 'no_open_edit' on many2one [FIX] typos9.0
parent
9ba65a535d
commit
53e964cfa8
|
@ -61,7 +61,13 @@ New options
|
|||
A dictionary to link field value with a HTML color.
|
||||
This option has to be used with field_color.
|
||||
|
||||
``no_open_edit`` *boolean* (Default: value of ``no_open`` which is ``False`` if not set)
|
||||
|
||||
Causes a many2one not to offer to click through in edit mode, but well in read mode
|
||||
|
||||
``open`` *boolean* (Default: ``False``)
|
||||
|
||||
Makes many2many_tags buttons that open the linked resource
|
||||
|
||||
ir.config_parameter options
|
||||
---------------------------
|
||||
|
@ -110,6 +116,6 @@ Your XML form view definition could contain::
|
|||
Note
|
||||
----
|
||||
|
||||
Double check that you have no inherited view that remote ``options`` you set on a field !
|
||||
If nothing work, add a debugger in the first ligne of ``get_search_result method`` and enable debug mode in OpenERP. When you write something in a many2one field, javascript debugger should pause. If not verify your installation.
|
||||
Double check that you have no inherited view that remove ``options`` you set on a field !
|
||||
If nothing works, add a debugger in the first line of ``get_search_result method`` and enable debug mode in OpenERP. When you write something in a many2one field, javascript debugger should pause. If not verify your installation.
|
||||
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
'base',
|
||||
'web',
|
||||
],
|
||||
'qweb': [
|
||||
'static/src/xml/base.xml',
|
||||
],
|
||||
'data': ['views/view.xml'],
|
||||
"author": "0k.io,Odoo Community Association (OCA)",
|
||||
'installable': False,
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue