[FIX] web: image in worksheets not streched for safari
Steps to reproduce: - Get Field Service app and the module for cutom worksheets. - Create a new worksheet template that contains images. - Create a new task with this template and go to the worksheet. - Add any image. Forcing the width to 100% breaks the view in safari since it's not going to respect the proportions, removing this will have good behavior in both safari and other browsers (chrome, firefox), also this will have the same behavior it used to have in 15.0. Be careful with adding this back in the future since when a user adds inside his worksheet an image field, studio set the default size to "small" value. (It's added an inline style with a widthset as "auto" and a height set as "90px") but the image_field API was broken with the w-100 added here[1]. It's seems not needed so we remove it to fix the api. [1]: https://github.com/odoo/odoo/commit/d1de396f2aa91a03732f0447d59a7306acae3129#diff-a9fcda7725e1ce88ca6deed7aff792476b26e264edc757b889e9dd3b94ea1dbfR33 opw-3415267 closes odoo/odoo#131808 X-original-commit: 740b560284e5c0987854f173437d7e4b3454caf5 Signed-off-by: Romain Estievenart (res) <res@odoo.com>
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
</div>
|
||||
<img
|
||||
loading="lazy"
|
||||
class="img img-fluid w-100"
|
||||
class="img img-fluid"
|
||||
alt="Binary file"
|
||||
t-att-src="this.getUrl(props.previewImage or props.name)"
|
||||
t-att-name="props.name"
|
||||
|
||||
@@ -82,7 +82,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
QUnit.module("ImageField");
|
||||
|
||||
QUnit.test("ImageField is correctly rendered", async function (assert) {
|
||||
assert.expect(10);
|
||||
assert.expect(12);
|
||||
|
||||
serverData.models.partner.records[0].write_date = "2017-02-08 10:00:00";
|
||||
serverData.models.partner.records[0].document = MY_IMAGE;
|
||||
@@ -143,6 +143,19 @@ QUnit.module("Fields", (hooks) => {
|
||||
"the image should correctly set its attributes"
|
||||
);
|
||||
|
||||
const computedStyle = window.getComputedStyle(
|
||||
target.querySelector(".o_field_widget[name='document'] img")
|
||||
);
|
||||
assert.strictEqual(
|
||||
computedStyle.width,
|
||||
"90px",
|
||||
"the image should correctly set its attributes"
|
||||
);
|
||||
assert.strictEqual(
|
||||
computedStyle.height,
|
||||
"90px",
|
||||
"the image should correctly set its attributes"
|
||||
);
|
||||
assert.containsOnce(
|
||||
target,
|
||||
".o_field_image .o_select_file_button",
|
||||
|
||||
Reference in New Issue
Block a user