summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2019-05-03 11:56:10 +0000
committerAaron Bohy <aab@odoo.com>2019-05-03 12:00:34 +0000
commitea1b3254bb58b762c4398dbd8a823a7a41fff6e1 (patch)
tree095acd989350dd4b8e05be2f6cb382c32a3b37f8 /addons/web/static/src/js/fields
parente335d235f6465bcf6869254049d73237f5c6b290 (diff)
[IMP] web: multi-line many2one: only highlight first line
Rev. a3489be33 removed this feature to fix a bug (when the single line many2one, e.g. a product, is too long and displayed over several lines). However, we (fp) still want this for res_partner many2ones with show_adress. This rev. re-introduced the feature without re-introducing the bug. closes odoo/odoo#33139 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
Diffstat (limited to 'addons/web/static/src/js/fields')
-rw-r--r--addons/web/static/src/js/fields/relational_fields.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js
index 751c16b3a23..325e0ceb8e8 100644
--- a/addons/web/static/src/js/fields/relational_fields.js
+++ b/addons/web/static/src/js/fields/relational_fields.js
@@ -465,7 +465,10 @@ var FieldMany2One = AbstractField.extend({
* @private
*/
_renderReadonly: function () {
- var value = _.escape((this.m2o_value || "").trim()).split("\n").join("<br/>");
+ var escapedValue = _.escape((this.m2o_value || "").trim());
+ var value = escapedValue.split('\n').map(function (line) {
+ return '<span>' + line + '</span>';
+ }).join('<br/>');
this.$el.html(value);
if (!this.noOpen && this.value) {
this.$el.attr('href', _.str.sprintf('#id=%s&model=%s', this.value.res_id, this.field.relation));