mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
support reference fields in many2one_clickable widget
This commit is contained in:
committed by
Pedro M. Baeza
parent
c6a7f600bc
commit
834b5adb54
@@ -59,11 +59,22 @@ openerp.web_tree_many2one_clickable = function(instance, local)
|
||||
|
||||
_format: function (row_data, options)
|
||||
{
|
||||
if (this.use_many2one_clickable) {
|
||||
return _.str.sprintf('<a class="oe_form_uri" data-many2one-clickable-model="%s" data-many2one-clickable-id="%s">%s</a>',
|
||||
this.relation,
|
||||
row_data[this.id].value[0],
|
||||
_.escape(row_data[this.id].value[1] || options.value_if_empty));
|
||||
if (this.use_many2one_clickable && !!row_data[this.id]) {
|
||||
var values = {
|
||||
model: this.relation,
|
||||
id: row_data[this.id].value[0],
|
||||
name: _.escape(row_data[this.id].value[1] || options.value_if_empty),
|
||||
}
|
||||
if(this.type == 'reference' && !!row_data[this.id + '__display'])
|
||||
{
|
||||
values.model = row_data[this.id].value.split(',', 1)[0];
|
||||
values.id = row_data[this.id].value.split(',', 2)[1];
|
||||
values.name = _.escape(row_data[this.id + '__display'].value || options.value_if_empty);
|
||||
}
|
||||
return _.str.sprintf(
|
||||
'<a class="oe_form_uri" data-many2one-clickable-model="%(model)s" data-many2one-clickable-id="%(id)s">%(name)s</a>',
|
||||
values
|
||||
);
|
||||
}
|
||||
else {
|
||||
return this._super(row_data, options);
|
||||
|
||||
Reference in New Issue
Block a user