[IMP] added possibility to only highlight the first line in read only m2o

bzr revid: nicolas.vanhoren@openerp.com-20120718101729-k1rxexdzozy5cx5i
This commit is contained in:
niv-openerp 2012-07-18 12:17:29 +02:00
parent 98a26898c8
commit aad9ce6416
2 changed files with 17 additions and 3 deletions

View File

@ -2739,10 +2739,20 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
this.$input.val(str.split("\n")[0]);
this.current_display = this.$input.val();
} else {
str = _.escape(str).split("\n").join("<br />");
var lines = _.escape(str).split("\n");
var link = "";
var follow = "";
if (! this.get_definition_options().highlight_first_line) {
link = lines.join("<br />");
} else {
link = lines[0];
follow = _.rest(lines).join("<br />");
if (follow)
link += "<br />";
}
this.$element.find('a')
.unbind('click')
.html(str)
.html(link)
.click(function () {
self.do_action({
type: 'ir.actions.act_window',
@ -2754,6 +2764,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
});
return false;
});
$(".oe_form_m2o_follow").html(follow);
}
},
set_value: function(value_) {

View File

@ -943,7 +943,10 @@
</t>
<t t-name="FieldMany2One">
<span class="oe_form_field oe_form_field_many2one oe_form_field_with_button" t-att-style="widget.node.attrs.style">
<a t-if="widget.get('effective_readonly')" href="#" class="oe_form_uri"/>
<t t-if="widget.get('effective_readonly')">
<a href="#" class="oe_form_uri"/>
<span class="oe_form_m2o_follow"/>
</t>
<t t-if="!widget.get('effective_readonly')">
<button class="oe_button oe_m2o_cm_button" title="Open Resource">
<img t-att-src='_s + "/web/static/src/img/icons/terp-folder-yellow.png"'/>