[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>
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -81,10 +81,12 @@
|
||||
|
||||
.o_form_uri {
|
||||
display: inline-block;
|
||||
color: $link-color;
|
||||
|
||||
&:hover {
|
||||
color: darken($link-color, 15%);
|
||||
color: $o-main-text-color;
|
||||
> span:first-child {
|
||||
color: $link-color;
|
||||
&:hover {
|
||||
color: darken($link-color, 15%);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -356,7 +356,7 @@ QUnit.module('fields', {}, function () {
|
||||
res_id: 1,
|
||||
});
|
||||
|
||||
assert.strictEqual($('a.o_form_uri').html(), 'aaa<br>Street<br>City ZIP',
|
||||
assert.strictEqual(form.$('a.o_form_uri').html(), '<span>aaa</span><br><span>Street</span><br><span>City ZIP</span>',
|
||||
"input should have a multi-line content in readonly due to show_address");
|
||||
await testUtils.form.clickEdit(form);
|
||||
assert.containsOnce(form, 'button.o_external_button:visible',
|
||||
|
||||
Reference in New Issue
Block a user