<feed xmlns='http://www.w3.org/2005/Atom'>
<title>Odoo/addons/web_editor/controllers, branch 14.0</title>
<subtitle>The current checkout of upstream Odoo</subtitle>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/'/>
<entry>
<title>[FIX] web_editor: prevent mismatch between mimetype and content type</title>
<updated>2021-03-25T11:40:22+00:00</updated>
<author>
<name>Romain Derie</name>
<email>rde@odoo.com</email>
</author>
<published>2021-02-09T11:56:07+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=4d529ad0d1b3e448fba7fb6cf54ed7991664f5aa'/>
<id>4d529ad0d1b3e448fba7fb6cf54ed7991664f5aa</id>
<content type='text'>
Since the image util method `image_base64()` is converting BMP images to PNG
automatically[1], there would be a mismatch between the attachment content type
and the attachment mimetype.

  - Content type: retrieve with `base64_to_image(data).format` -&gt; return PNG as
                  the image data was converted from BMP to PNG
  - Mimetype: set on `write()` and `create()` with `_check_contents()` which
              call `mimetypes.guess_type(file_name)`.
              BMP image `my_file_image.bmp` would have a mimetype set to BMP

The computed field `image_src` would return `False` since the image.mimetype
would be BMP, making the dialog picker not showing the image but loading
`http://localhost:8069/false` instead.

[1] https://github.com/odoo/odoo/blame/097f29d0f6a5b295c81fd074665dbd261eaf12fb/odoo/tools/image.py#L124

task-2345082
Coming from #65828
Closes #68326

X-original-commit: ef5b108b781df73342bb99342a1116fad86d3b58</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since the image util method `image_base64()` is converting BMP images to PNG
automatically[1], there would be a mismatch between the attachment content type
and the attachment mimetype.

  - Content type: retrieve with `base64_to_image(data).format` -&gt; return PNG as
                  the image data was converted from BMP to PNG
  - Mimetype: set on `write()` and `create()` with `_check_contents()` which
              call `mimetypes.guess_type(file_name)`.
              BMP image `my_file_image.bmp` would have a mimetype set to BMP

The computed field `image_src` would return `False` since the image.mimetype
would be BMP, making the dialog picker not showing the image but loading
`http://localhost:8069/false` instead.

[1] https://github.com/odoo/odoo/blame/097f29d0f6a5b295c81fd074665dbd261eaf12fb/odoo/tools/image.py#L124

task-2345082
Coming from #65828
Closes #68326

X-original-commit: ef5b108b781df73342bb99342a1116fad86d3b58</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] web_editor, *: review `public_render_template`</title>
<updated>2021-01-06T14:17:21+00:00</updated>
<author>
<name>Benoit Socias</name>
<email>bso@odoo.com</email>
</author>
<published>2021-01-06T10:12:07+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=3fd40ba2030fef7dccf4046a932e3b3a172dc53f'/>
<id>3fd40ba2030fef7dccf4046a932e3b3a172dc53f</id>
<content type='text'>
*: website, base

The normal flow to render a template is now to use `render_public_asset`
which bypasses the read access rights if the user matches the groups
the view declares.

For public users, we still cannot use that as they do not have access
to calling model methods at all. The route `public_render_template` is
thus still needed, but it should use the `render_public_asset` util. In
master, it will only rely on it but as a stable fix, we still need to
use the whitelist as we cannot change the related views' group.

This commit also adds deprecated comments to the read_template method
which has been removed in master.

Related to task-2412544

closes odoo/odoo#64137

Signed-off-by: Quentin Smetz (qsm) &lt;qsm@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
*: website, base

The normal flow to render a template is now to use `render_public_asset`
which bypasses the read access rights if the user matches the groups
the view declares.

For public users, we still cannot use that as they do not have access
to calling model methods at all. The route `public_render_template` is
thus still needed, but it should use the `render_public_asset` util. In
master, it will only rely on it but as a stable fix, we still need to
use the whitelist as we cannot change the related views' group.

This commit also adds deprecated comments to the read_template method
which has been removed in master.

Related to task-2412544

closes odoo/odoo#64137

Signed-off-by: Quentin Smetz (qsm) &lt;qsm@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] web_editor: fix gap between transformed shape and next section</title>
<updated>2020-11-02T07:04:01+00:00</updated>
<author>
<name>Samuel Degueldre</name>
<email>sad@odoo.com</email>
</author>
<published>2020-10-30T09:15:13+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=42b3ad10e0b32b7fc72f801e2c67d6baf938c566'/>
<id>42b3ad10e0b32b7fc72f801e2c67d6baf938c566</id>
<content type='text'>
Previously, when flipping some shapes vertically on chrome, and
vertically or horizontally on firefox, there was a gap of 1px or less at
some screen widths. This is caused by the way these browsers render
backgrounds on transformed elements. It seems like firefox will round
the size of the element to render the background image on it if the
element is transformed, while chrome will always render the background
at the correct size (or render it at a larger size and clip it to the
correct size after the fact), but will round the coordinates of the
symmetry point, causing only the vertical flip to have this issue, and
only if the background image would not extend beyond the bounds of the
element (on firefox, even shapes that would extend beyond the bounds of
the element would showcase a gap, eg origins 1)

This commit fixes that by applying the transform to the SVG rather than
to the element, by use of the shapes controller.

task-2369560

closes odoo/odoo#61114

Signed-off-by: Quentin Smetz (qsm) &lt;qsm@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, when flipping some shapes vertically on chrome, and
vertically or horizontally on firefox, there was a gap of 1px or less at
some screen widths. This is caused by the way these browsers render
backgrounds on transformed elements. It seems like firefox will round
the size of the element to render the background image on it if the
element is transformed, while chrome will always render the background
at the correct size (or render it at a larger size and clip it to the
correct size after the fact), but will round the coordinates of the
symmetry point, causing only the vertical flip to have this issue, and
only if the background image would not extend beyond the bounds of the
element (on firefox, even shapes that would extend beyond the bounds of
the element would showcase a gap, eg origins 1)

This commit fixes that by applying the transform to the SVG rather than
to the element, by use of the shapes controller.

task-2369560

closes odoo/odoo#61114

Signed-off-by: Quentin Smetz (qsm) &lt;qsm@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] web_editor: fix issues related to loading image info</title>
<updated>2020-10-29T10:51:07+00:00</updated>
<author>
<name>Samuel Degueldre</name>
<email>sad@odoo.com</email>
</author>
<published>2020-10-29T09:59:52+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=b0993370b6fcec1f966e4bf2994eee7f31da82d5'/>
<id>b0993370b6fcec1f966e4bf2994eee7f31da82d5</id>
<content type='text'>
In order to allow modifying background images, we need information on
the image, this is done by creating a placeholder img and calling the
loadImageInfo function on it. However this function did not account for
the case where an image had not src attribute, which causes an
unnecessary rpc. Other problems could arise from this as an attachment
that doesn't have the correct mimetype but has a matching src could be
returned, causing its image_src field to be false, which we would then
attempt to load as a valid image, causing crashes.

This commit fixes that by not trying to load image infos when the src of
an image is empty, only looking for attachments of the supported
mimetypes, and also checking that we actually did receive an image_src
before setting it as the original src of the image, which will prevent
accidentally trying to load a falsy src as an actual image.

closes odoo/odoo#60953

Signed-off-by: Quentin Smetz (qsm) &lt;qsm@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In order to allow modifying background images, we need information on
the image, this is done by creating a placeholder img and calling the
loadImageInfo function on it. However this function did not account for
the case where an image had not src attribute, which causes an
unnecessary rpc. Other problems could arise from this as an attachment
that doesn't have the correct mimetype but has a matching src could be
returned, causing its image_src field to be false, which we would then
attempt to load as a valid image, causing crashes.

This commit fixes that by not trying to load image infos when the src of
an image is empty, only looking for attachments of the supported
mimetypes, and also checking that we actually did receive an image_src
before setting it as the original src of the image, which will prevent
accidentally trying to load a falsy src as an actual image.

closes odoo/odoo#60953

Signed-off-by: Quentin Smetz (qsm) &lt;qsm@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] web_editor, *: make media-dialog search odoo media-library</title>
<updated>2020-09-16T07:01:15+00:00</updated>
<author>
<name>Samuel Degueldre</name>
<email>sad@odoo.com</email>
</author>
<published>2020-08-12T10:15:51+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=7a1308b426f94b33e2bd55e5d58e661067e26ff3'/>
<id>7a1308b426f94b33e2bd55e5d58e661067e26ff3</id>
<content type='text'>
*: website, web_unsplash, website_blog

We have recently created an odoo media library that exposes a public API
for searching for open-source media, including dynamic SVGs that can be
used with the dynamic background-shape system to create illustrations
whose colors can be changed by the user. This commit adds the
corresponding client-side functionalty: search for the images in the
media-library, creating a corresponding attachment when selected, as
well as an option to customize the colors of the dynamic SVGs.

In the process, adaptations have been made in the web_unsplash module to
avoid duplicating code and to adapt code that was making assumptions
that are no longer valid.

To make new users more aware of this feature, all default images have
been hidden from the media-dialog, so that the user is prompted so
search for images. Some tests and tours that were relying on having
default images in the media-dialog (eg in website_blog) have been
adapted to match.

task-2316651
Linked to: odoo/iap-apps#235

closes odoo/odoo#56479

Signed-off-by: Jérémy Kersten (jke) &lt;jke@openerp.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
*: website, web_unsplash, website_blog

We have recently created an odoo media library that exposes a public API
for searching for open-source media, including dynamic SVGs that can be
used with the dynamic background-shape system to create illustrations
whose colors can be changed by the user. This commit adds the
corresponding client-side functionalty: search for the images in the
media-library, creating a corresponding attachment when selected, as
well as an option to customize the colors of the dynamic SVGs.

In the process, adaptations have been made in the web_unsplash module to
avoid duplicating code and to adapt code that was making assumptions
that are no longer valid.

To make new users more aware of this feature, all default images have
been hidden from the media-dialog, so that the user is prompted so
search for images. Some tests and tours that were relying on having
default images in the media-dialog (eg in website_blog) have been
adapted to match.

task-2316651
Linked to: odoo/iap-apps#235

closes odoo/odoo#56479

Signed-off-by: Jérémy Kersten (jke) &lt;jke@openerp.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] web_editor: Multi-company error when adding image to task description</title>
<updated>2020-08-13T16:22:18+00:00</updated>
<author>
<name>Nasreddin (bon)</name>
<email>bon@odoo.com</email>
</author>
<published>2020-08-12T13:34:55+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=a137f22363ff538ab86f50d15851730af1b8ed76'/>
<id>a137f22363ff538ab86f50d15851730af1b8ed76</id>
<content type='text'>
Issue

	- Select "My Company (Chicago)" as current company
	- Open "Projects" module
	- Create a new Task
	- Edit description, upload a new Image and add it to description.

	Multi-company error "Write" on project.task .
	In frontend, can optimize uploaded picture.

Causes

	Wrong "allowed_company_ids" value in context.

Solution

	Remove allowed companies from context to avoid allowed_company_ids
	which may erroneously restrict based on website.

opw-2304511

closes odoo/odoo#55897

X-original-commit: 8f6506a57853040d065569fdd60f9d94be8e26e1
Signed-off-by: Nicolas Lempereur (nle) &lt;nle@odoo.com&gt;
Signed-off-by: bon-odoo &lt;nboulif@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Issue

	- Select "My Company (Chicago)" as current company
	- Open "Projects" module
	- Create a new Task
	- Edit description, upload a new Image and add it to description.

	Multi-company error "Write" on project.task .
	In frontend, can optimize uploaded picture.

Causes

	Wrong "allowed_company_ids" value in context.

Solution

	Remove allowed companies from context to avoid allowed_company_ids
	which may erroneously restrict based on website.

opw-2304511

closes odoo/odoo#55897

X-original-commit: 8f6506a57853040d065569fdd60f9d94be8e26e1
Signed-off-by: Nicolas Lempereur (nle) &lt;nle@odoo.com&gt;
Signed-off-by: bon-odoo &lt;nboulif@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] web_editor, website: add background shapes snippet option</title>
<updated>2020-08-07T15:34:45+00:00</updated>
<author>
<name>Samuel Degueldre</name>
<email>sad@odoo.com</email>
</author>
<published>2020-07-31T06:47:34+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=b84e0af742c51b88b4c108ebec2d0c7fff4b7483'/>
<id>b84e0af742c51b88b4c108ebec2d0c7fff4b7483</id>
<content type='text'>
This commit adds a new snippet option allowing the user to choose one of
a series of SVG shapes as their background, or to be overlaid over the
background image of a snippet and to customize the colors of those
shapes.

Part of https://github.com/odoo/odoo/pull/53017
task-2210790

closes odoo/odoo#53017

Signed-off-by: Quentin Smetz (qsm) &lt;qsm@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit adds a new snippet option allowing the user to choose one of
a series of SVG shapes as their background, or to be overlaid over the
background image of a snippet and to customize the colors of those
shapes.

Part of https://github.com/odoo/odoo/pull/53017
task-2210790

closes odoo/odoo#53017

Signed-off-by: Quentin Smetz (qsm) &lt;qsm@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] web_editor: fix traceback when clicking on website logo in edit</title>
<updated>2020-06-22T13:04:44+00:00</updated>
<author>
<name>Samuel Degueldre</name>
<email>sad@odoo.com</email>
</author>
<published>2020-06-16T11:03:18+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=5d7901a53b743e84846b19343e5ebf57b65df403'/>
<id>5d7901a53b743e84846b19343e5ebf57b65df403</id>
<content type='text'>
When clicking on an image in edit mode, the web editor attempts to find
an attachment that corresponds to the image's URL. In the case of the
website logo, the URL looks like it's referencing an attachment by id or
xml-id, but it's actually neither. This cause a variable to never be
initialized, which in turns causes a traceback when trying to access it
later.

This commit fixes that by always initializing attachment to None.

closes odoo/odoo#53418

X-original-commit: 790e33de190392b937e21c73905db4d48cfb86aa
Signed-off-by: Quentin Smetz (qsm) &lt;qsm@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When clicking on an image in edit mode, the web editor attempts to find
an attachment that corresponds to the image's URL. In the case of the
website logo, the URL looks like it's referencing an attachment by id or
xml-id, but it's actually neither. This cause a variable to never be
initialized, which in turns causes a traceback when trying to access it
later.

This commit fixes that by always initializing attachment to None.

closes odoo/odoo#53418

X-original-commit: 790e33de190392b937e21c73905db4d48cfb86aa
Signed-off-by: Quentin Smetz (qsm) &lt;qsm@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] web_editor, *: move image optimization feature to left-panel</title>
<updated>2020-06-05T18:11:53+00:00</updated>
<author>
<name>Samuel Degueldre</name>
<email>sad@odoo.com</email>
</author>
<published>2020-05-19T09:21:49+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=aa8d2a8be2c8f713b4b39b2aa1ea2aaf1839396c'/>
<id>aa8d2a8be2c8f713b4b39b2aa1ea2aaf1839396c</id>
<content type='text'>
*: website, mass_mailing

In continuity with the nline crop, in an effort to make the image
workflow as seamless as possible in the website editor, the image
optimization feature has been moved out of the modal which could be
opened through the media-dialog and into the left panel.

This commit adds a quality slider and a width selector, as well as a
preview of the image's weight to the left panel, and removes the
image_optimize dialog.

This commit also introduces the possibility to add a color filter on
images.

Part of https://github.com/odoo/odoo/pull/51517
task-2192755

closes odoo/odoo#51517

Signed-off-by: Quentin Smetz (qsm) &lt;qsm@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
*: website, mass_mailing

In continuity with the nline crop, in an effort to make the image
workflow as seamless as possible in the website editor, the image
optimization feature has been moved out of the modal which could be
opened through the media-dialog and into the left panel.

This commit adds a quality slider and a width selector, as well as a
preview of the image's weight to the left panel, and removes the
image_optimize dialog.

This commit also introduces the possibility to add a color filter on
images.

Part of https://github.com/odoo/odoo/pull/51517
task-2192755

closes odoo/odoo#51517

Signed-off-by: Quentin Smetz (qsm) &lt;qsm@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] web_editor, *: change image cropping from modal to inline widget</title>
<updated>2020-06-05T18:11:42+00:00</updated>
<author>
<name>Samuel Degueldre</name>
<email>sad@odoo.com</email>
</author>
<published>2020-03-31T07:10:34+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=c2de755bc690987f59cda27bd83a7429278955fc'/>
<id>c2de755bc690987f59cda27bd83a7429278955fc</id>
<content type='text'>
*: base

Previously, cropping an image was done inside of a modal window, turning
it into an inline widget makes the editor feel more integrated and
allows you to better see the result of cropping directly in the page,
it's also less intrusive to the user's edition workflow.

At the same time, the way cropped images are saved was refactored to use
the new original_id field on ir_attachment, as the old system was
creating problems.

Part of https://github.com/odoo/odoo/pull/51517
task-2192755</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
*: base

Previously, cropping an image was done inside of a modal window, turning
it into an inline widget makes the editor feel more integrated and
allows you to better see the result of cropping directly in the page,
it's also less intrusive to the user's edition workflow.

At the same time, the way cropped images are saved was refactored to use
the new original_id field on ir_attachment, as the old system was
creating problems.

Part of https://github.com/odoo/odoo/pull/51517
task-2192755</pre>
</div>
</content>
</entry>
</feed>
