Commit Graph
103 Commits
Author SHA1 Message Date
xO-Tx eb1262960f [IMP] web_editor: allow adding a shape-on-image via custom URL (themes)
The goal of this commit is to add a "Python version" of the
shape-on-image feature using a controller.

Since the whole logic to apply shapes on image is JS-based, we need
to use this URL (just like for background shapes) when we want to add
a shape by default on images in themes. When the configurator replaces a
snippet image (which the theme defines to have a shape), the shape
option should still be applied on the new image.

On the JS side, loadImageInfo() is overridden in order to mark
images (with theme default shapes) with corresponding attachment
data (original-id, original-src, mimetype).

Here is an example of the minimum xpath required to add a shape on a
snippet image in a theme:

```
<template id="s_image_text" inherit_id="website.s_image_text">
    <xpath expr="//img" position="attributes">
        <attribute name="src">/web_editor/image_shape/website.s_image_text_default_image/web_editor/solid/blob_1_solid_rd.svg?c2=o-color-1</attribute>
        <attribute name="data-shape">web_editor/solid/blob_1_solid_rd</attribute>
        <attribute name="data-original-mimetype">image/jpeg</attribute>
        <attribute name="data-file-name">s_image_text.svg</attribute>
        <attribute name="data-shape-colors">;o-color-1;;;</attribute>
    </xpath>
</template>
```

task-2593454

closes odoo/odoo#73938

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-07-30 17:35:19 +00:00
cd403480f9 [IMP] web_editor, mass_mailing, *: add shape clipping option on images
*: tools

The ImageOptimizer option can now set shapes on images to use those
shapes as clip path and background. It uses a flexible path so that the
shape will always fit the image proportionally. We also added an html
file alongside a javascript file to semi-convert the shape from
illustrator into a usable shape for this usecase (the clip path must
have values between one and zero therefore we must do some computation
before the shape is ready to use).

Thanks to Samuel for this specific shape-converter tool and other
technical points about svgs and clip-paths.

Thanks to Mehdi for remaining development post-testing and post-reviews
and for the many fixes.

Thanks to Brieuc for the actual shape SVG files.

Part of https://github.com/odoo/odoo/pull/69179
task-2327045

closes odoo/odoo#69179

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: xO-Tx <mou@odoo.com>
Co-authored-by: Brieuc-brd <brd@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
2021-06-21 16:31:07 +00:00
Younn Olivier 7e5251bdd8 [FIX] web_editor: fix svg images upload
We check if the mimetype is supported when uploading an image.

task-2523574

closes odoo/odoo#71839

X-original-commit: 3765ac1f1f1644c919456246f1a3791c47c45a83
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-06-07 19:47:26 +00:00
8cc066173d [IMP] *: Improve assets management
This commit changes the way assets are declared in Odoo modules.

Before: assets were declared in template files. Template bundles were
generated from primary templates, so technically any qweb template could
have been called as an asset bundle, with the 't-call-assets' directive.

Being standard qweb templates, they had access to standard HTML tags
(script, link, with or without raw scripts or style definition), qweb
directives (t-call, t-raw, etc.) and could be inherited by other
templates.

Now: assets are defined in the module's manifest and generated by the
't-call-assets' directive.

More information on the new system can be found on the updated user
documentation (see the "JavaScript Reference" section).

Task: 2352566

Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais <lpe@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
2021-03-31 13:57:17 +02:00
Romain Derie 603ace1966 [IMP] web_editor: add error support for too big image files
ValueError is raised when image resolution is too big (over 45e6[1]).

[1]: https://github.com/odoo/odoo/blame/4c91e895a98642f10bd1d2d46819705edc38f638/odoo/tools/image.py#L47

Part of https://github.com/odoo/odoo/pull/65828
task-2345082

closes odoo/odoo#65828

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-31 07:07:39 +00:00
Romain Derie 9dab9ffce2 [IMP] web_editor: show error if uploaded image type is not suported
We only support .gif, .jpe, .jpeg, .jpg, .png, .svg

This commit won't let the code go though if we know the image format is not
suported.

Part of https://github.com/odoo/odoo/pull/65828
task-2345082
2021-03-31 07:07:31 +00:00
Romain Derie 46ea05ab03 [FIX] web_editor: prevent mismatch between mimetype and content type
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` -> 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
2021-03-25 12:35:10 +00:00
Samuel Degueldre ff8070033b [FIX] web_editor: show mimetype warning for illustrations
Previously, when clicking on an illustration in the editor, the image
options would be unavailable with a message saying that it was due to
technical limitations, and that the user should reselect the image in
the media-dialog for quality options to become available. This was
caused by the fact that in order to support more than one customizable
color in illustrations, they are now saved inside the database with an
url containing which colors are customizable inside the url's query
parameters. Since the endpoint that finds which attachment corresponds
to which image src was looking for an exact URL match, but query params
are trimmed on the client side before talking to the endpoint, they were
no longer matching.

This commit fixes that by searching for attachments whose URL matches
the provided one with or without any extra query parameters.

closes odoo/odoo#67625

X-original-commit: b26319c3c9409e8724fadeec80e63ea94dc8d599
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-10 17:59:34 +00:00
Benoit Socias 1feebf2a4d [FIX] web_editor: review public_render_template
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.

Related to task-2412544

closes odoo/odoo#64167

X-original-commit: 3fd40ba2030fef7dccf4046a932e3b3a172dc53f
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-01-06 17:01:34 +00:00
Benoit Socias bde8abcfeb [IMP] web_editor: support 5 dynamic colors for illustrations
Before this commit only the first default palette color was configurable
on illustrations

After this commit all 5 default palette colors are configurable on
illustrations

task-2368585

closes odoo/odoo#60503

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-11-20 13:13:15 +00:00
Samuel Degueldre c5a2652c9b [FIX] web_editor: fix gap between transformed shape and next section
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#61609

X-original-commit: 42b3ad10e0b32b7fc72f801e2c67d6baf938c566
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-11-10 18:27:45 +00:00
Samuel Degueldre b1654e5b2b [FIX] web_editor: fix issues related to loading image info
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#60982

X-original-commit: b0993370b6fcec1f966e4bf2994eee7f31da82d5
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-10-29 12:27:13 +00:00
Samuel Degueldre c46204dff9 [IMP] web_editor, *: make media-dialog search odoo media-library
*: 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#57888

X-original-commit: 7a1308b426f94b33e2bd55e5d58e661067e26ff3
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-09-16 16:14:37 +00:00
Nasreddin (bon) a137f22363 [FIX] web_editor: Multi-company error when adding image to task description
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) <nle@odoo.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2020-08-13 16:22:18 +00:00
Samuel Degueldre b84e0af742 [IMP] web_editor, website: add background shapes snippet option
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) <qsm@odoo.com>
2020-08-07 15:34:45 +00:00
Samuel Degueldre 5d7901a53b [FIX] web_editor: fix traceback when clicking on website logo in edit
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) <qsm@odoo.com>
2020-06-22 13:04:44 +00:00
Samuel Degueldre aa8d2a8be2 [IMP] web_editor, *: move image optimization feature to left-panel
*: 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) <qsm@odoo.com>
2020-06-05 18:11:53 +00:00
Samuel Degueldre c2de755bc6 [IMP] web_editor, *: change image cropping from modal to inline widget
*: 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
2020-06-05 18:11:42 +00:00
Samuel Degueldre 629a93274e [REF] web_editor: remove relics of filter feature
Previously, the media-dialog had a "filter" feature, where when changing
a background image for example, all backgrounds would show first in the
media-dialog. However, because this required to load all public
attachments in the database it was causing issues and was removed. The
backend code for this feature however was unfortunately forgotten, this
commit removes that code.

Part of https://github.com/odoo/odoo/pull/51517
2020-06-05 18:11:25 +00:00
Martin Trigaux d9287caf94 [IMP] *: convert to private methods
render, render_template, load, activity_schedule_with_view,
get_website_pages should all be private:
It should not be possible to render an aribtrary template only with
its name or id

Still need to render some qweb views from js so the method
render_template is kept public.
This explains why the website editor still need read access on
ir.ui.view as we want to allow any snippet to be rendered.
2020-05-14 13:59:10 +02:00
qsm-odoo e4a7103517 [FIX] web, web_editor: allow editor instantiation from public user
If for some reason someone wanted to develop a textarea using the
editor which is supposed to work as a public user (like we are trying
to do on Odoo.com), it was not possible. The code was "designed" to
allow it but there was one problem: the lazy loading of the editor
assets required a `render_template` call to the server... which cannot
be done from a public user.

This commit solves the issues by allowing the lazy loading of assets
to use a custom route if required. That route is then used by the editor
"root". That route performs the render_template as a superuser provided
that the view's xmlid is whitelisted.

Note: there was another unauthorized call for public user: the
colorpicker. This was solved by disabling the colorpicker template rpc
for public user, they will still get the default summernote one.

Part of https://github.com/odoo/odoo/pull/48981

closes odoo/odoo#48981

closes odoo/odoo#49398

X-original-commit: e84a0bfdc99c21406861b88c02b11c925d92f927
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-04-10 11:54:03 +00:00
Samuel Degueldre 49ea7b2b41 [IMP] web_editor: improve image optimization workflow in media dialog
Previously, when selecting an image, the user could optimize their
images by clicking a little cog icon in the media dialog. They would
also be prompted to optimize their images when uploading them. In most
cases, it makes a lot more sense to always save the original in the
database, and optimize the original whenever it's dropped in the page
automatically.

A second problem is that when using the optimization feature, optimized
images would be displayed along the originals by default, resulting in a
lot of duplicates while browsing the media dialog.

This commit changes both of these things:

- By default, when uploading an image, the original uploaded image is
  used. The user can still optimize their image manually through the
  media-dialog by using the cog icon. When choosing an image in the
  media-dialog, if it's not already an optimized image, an optimized copy
  is automatically created and used instead.

- Optimized images are now hidden by default, in the media dialog, and
  can be shown by clicking a checkbox at the top of the modal when in
  debug mode

task-2091417
closes odoo/odoo#45174
2020-03-30 11:06:48 +00:00
Kevin Baptiste 6cbe824871 [REV] web: reverts update to fontawesome 5.11.2
This reverts commit ff1c35513a.

closes odoo/odoo#41480

X-original-commit: 116057b26e71db4692280463669f3e80d813ddcc
Related: odoo/enterprise#7110
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-12-09 10:33:36 +00:00
Kevin Baptiste ff1c35513a [IMP] web: update to fontawesome 4.7.0 to 5.11.2
FontAwesome 5 introduced new names for some icons as described on
https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4#name-changes

This commit replaces the old names to the new ones.

closes odoo/odoo#35826

Taskid: 2050241
Related: odoo/enterprise#5180
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-28 10:05:12 +00:00
RomainLibert 85eeaccf06 [FIX] tools: use user friendly message in case of error
closes odoo/odoo#37058

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-09-18 10:14:12 +00:00
Gorash 42df7f84a4 [FIX] web_editor: checkbox without text change can now be checked 2019-09-19 07:40:47 +00:00
Gorash d1f25b178a [FIX] web_editor: recursive checkbox check
In multi-level checkboxes, if there is only one checkbox per level, the
expected behavior is that all checkbox will be checked if one of them is
checked. This was not the case before this commit.
2019-09-19 07:40:47 +00:00
912996fe90 [REF] web_editor, website: adapt wysiwyg to 12.0 editor
The wysiwyg abstraction layer was introduced in saas-12.2 by
commit f2969923. Its goal was to provide an external interface
for other modules that wanted to use the editor feature such
that the editor core itself could be changed without requiring
extensive changes in the other modules.

This commit is adapting the wysiwyg interface to instantiate
the 12.0 editor below it rather than the saas-12.2 one, thus
reverting the "new editor" part of f2969923 itself.

Part of PR 35677.

Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
2019-08-21 19:11:31 +00:00
Sébastien Theys 87a35d4263 [IMP] web, web_editor, *: add media image optimize dialog
* = website, website_blog

The goal is to give the user an opportunity to optimize his images before using
them.

For this we introduce a preview/configuration dialog after every image upload,
where appropriate default values are filled for the quality and resolution,
based on where the image is going to be used. Since this is not going to be
perfect all the time, we still allow the user to configure them, and we display
a preview to ease this process.

Indeed it is important for SEO and for usability in general that the images are
as light as possible in size.

Technically the original image is uploaded and saved first, and then it can be
optimized. This way the upload only happens once, and the preview can be
computed from the already saved image.

task-1930726
PR: #31208
2019-06-04 22:14:13 +02:00
Sébastien Theys 76cf2ae82a [IMP] web_editor, *: improve media dialog attachment upload
* = web_unsplash, website

Remove iframe upload and replace it with a proper RPC. The route is now only
accepting one file at a time, which makes it easier to maintain, and allows to
process the first file as soon as it is ready, instead of having to wait on
everything.

Also fix a bug where a document could not be uploaded because it would try to
parse it as an image.

Remove filter after search result from the JS and add the corresponding
conditions in the domain to avoid processing and returning unnecessary records.

If multiple attachments exist with the same URL, now display them all to avoid
confusion.

Compute all the necessary values in the python model instead of in the JS.

Allow SVG in the widget (the server already accepted them before).

Disable multiple image upload when not in multiImages mode.

task-1930726
PR: #31208
2019-06-04 22:14:13 +02:00
Sébastien Theys 191c556d6b [IMP] web_editor, *: improve file media widget views & selection
* = web_unsplash, website_blog

Rename "image" to "attachment" when appropriate in FileWidget

Improve image selection / highlight code (now based on attachment id)

Improve image grid view:
 - Remove the row mechanism and replace it by a single loop over the images.
 - Take advantage of row wrap for a responsive display.
 - Uniformize the height (prevent tall images from moving down everything).
 - Load a miniature of the images when possible, remove the loading placeholder.
 	This should significantly reduce the download size when opening the dialog,
 	at the cost of CPU usage on the server.
 - Split the existing image view into one view for the loop and one view for the
 	image itself. This way in a following commit we can reuse the image view
 	when adding a new one, instead of having to render everything again.

task-1930726
PR: #31208
2019-06-04 22:14:13 +02:00
Sébastien Theys 425f197f16 [IMP] tools,base,*: remove intermediary image functions
* = hr, im_livechat, mail, payment, purchase, web, web_editor, web_unsplash,
	website_profile, website_slides

Since the merge of all image tools into one function, the intermediary functions
are not needed anymore.

task-1958000
PR: #31811
2019-04-29 13:45:34 +00:00
Sébastien Theys 433d007075 [IMP] tools,web_editor,web_unsplash: improve image optimize for web
This commit introduces the possibility to resize and to select the quality when
optimizing an image for web.

This will be used by the media dialog in a future commit.

The arbitrary resolution limit of 42e6 has been increased to 45e6 to fit some
of the biggest images we might get from Unsplash, and this value has been moved
into a variable so it can be customized.

The mimetype computation has been moved after the image processing because in a
next commit the operation could return the image in a different format than what
was originally given. Eg. BMP -> PNG, or unsupported format -> JPEG.

task-1958000
PR: #31811
2019-04-29 13:45:03 +00:00
qsm-odoo bd2624a7ba [REF] web_editor, website: remove useless code
Commit https://github.com/odoo/odoo/commit/29075a8e2c734624cec4f6009185616634f70dea
introduced some python methods which became useless with commit
https://github.com/odoo/odoo/commit/aef6a5aaed22b250799ce92b5021d240fed9e12e

They were not removed with that commit since it was a stable version and
because it would have made forward-port difficult because of master
tasks. Now that those tasks are merged, this commit removes the useless
methods.
2019-02-15 11:15:37 +00:00
qsm-odoo 10384c689a [IMP] website, *: optimize scss customizations
* web_editor

This commit's goal is to optimize the delay to make a scss customization
thanks to the website customize dialog. Before this commit, the JS code
took advantage of existing web_editor routes but this was far from
efficient as this was done:

1) PY: Load all scss files used in the page
2) JS: Find the one we want to customize and adapt the scss content
3) PY: Create the scss customization with the new content

(So two RPC (including one very slow) and content building in
javascript)

After this commit, this is done:

1) PY: Load the scss file being customized, adapt its content according
   to the new values and save the customization

(So the whole logic is in python, requiring only one small RPC)

This commit also take the opportunity to review the web_editor ace
editor loading code (the logic is shared with website customizations).

PR https://github.com/odoo/odoo/pull/29624
task-1904244
2019-02-08 14:38:51 +00:00
Andrea Ulliana 515e7bc50f [IMP] website, *: improve CSS edition usability + add JS edition
* web_editor

Currently, when an user wants to edit the css of its website, he has
access to lots of files and, in debug mode, to even more files. While
the feature is nice for people who know what they are doing, a lambda
person can easily break its website by changing the wrong files. Also,
nothing warns the user that the files that are edited will never receive
updates anymore (unless if they are reset). The goal is to prevent
those behavior while still allowing the add custom css. Another goal
is to be able to *add* custom javascript.

Custom files created for the user:
SCSS: user_custom_rules.scss, user_custom_bootstrap_overridden.scss
JS: user_custom_javascript.js

See https://github.com/odoo/odoo/pull/29999
task-1919350
2019-02-05 14:28:29 +00:00
Christophe Simonis 4400cce820 [MERGE] forward port branch saas-12.1 up to 4524ad06a8 2019-02-04 13:27:22 +01:00
Christophe Simonis f927c68ddb [MERGE] forward port branch 12.0 up to cb8fefa899 2019-01-31 16:59:58 +01:00
Romain Derie 326a44c3f7 [FIX] web_editor, website: consider COW view when loading view
Before this commit:
1. If we were editing a template with no xml_id, typically the case when
   editing a specific view (COW'd), the 'Template ID' label would be left empty
   as the view does not have an xml_id but only a key.
2. If we were editing a generic view, the template would be COW'd and replaced
   by the specific one created during the save.
   After the save, the page would be reload and will try to reopen the edited
   template (stored in url `res=123`). But as this template would be replaced
   by the COW'd view, the JS would crash trying to access an inexisting view.
   The HTML editor would then open in a very thin modal, barely editable.

Now:
1. Display the template's key instead of its xml_id. The key is basically a
   duplicate of the xml_id, mainly used in website.
2. If we are saving a generic view, we search for its newly created specific
   view to upload the URL hash before reloading.

task-1934279
Fix #30447
2019-01-29 16:06:23 +00:00
Christophe Simonis bdfef60d60 [MERGE] forward port branch saas-11.3 up to cd5c8a02f9 2019-01-29 18:35:14 +01:00
Christophe Simonis cd5c8a02f9 [MERGE] forward port branch 11.0 up to 36d96e0150 2019-01-29 13:17:12 +01:00
Christophe Simonis fab415acab [MERGE] forward port branch 11.0 up to 984a99611e 2019-01-23 18:15:18 +01:00
Christophe Simonis 4aa153e65c [MERGE] forward port branch 11.0 up to 19558129f0 2019-01-17 20:49:36 +01:00
Christophe Simonis c8ace043e5 [MERGE] forward port branch saas-11.3 up to 387d5cff90
closes odoo/odoo#30566
2019-01-25 17:29:34 +00:00
Julien (juc) Castiaux 71c4c13996 [FIX] web_editor: save less file
Modifying less files and saving them using the web editor can raise
and error. The error is due to the way odoo save the modified file.

It extends the view containing the URL of the file by filtering views
related to the xml bundle id and keeping those that have the said URL
in their content.

This lookup fails to give just one result in case there are multiple
file containing the said URL. This fix change the filter from a
bare `if url in view.arch` to a correct xpath lookup.

The "/web/static/src/variables.less" less file was one of the
problematic files.

opw-1889794

closes odoo/odoo#30186
2019-01-17 15:19:54 +00:00
qsm-odoo 6930f9c353 [FIX] web_editor: restore less files edition
Broken by https://github.com/odoo/odoo/pull/30186

closes odoo/odoo#30403
2019-01-21 11:38:32 +00:00
Christophe Simonis f854e01a98 [MERGE] forward port branch saas-11.3 up to 4aa153e65c 2019-01-18 10:58:41 +01:00
Christophe Simonis a337b9ec92 [MERGE] forward port branch 12.0 up to f854e01a98 2019-01-18 14:26:33 +01:00
Kishan Gajjar daceeb5348 [FIX] web_editor: use default value for html fields of new records
While creating a new record, the default value of a field used with the
'html_frame' field widget was not used.

Discovered with task-1903256

closes odoo/odoo#28838
2019-01-28 14:10:03 +00:00
Adrian Torres 758382b3a7 [REM] pycompat: remove python 2 shims and helpers
Odoo no longer supports python 2, thus some of these helpers can and
have been replaced by python 3 built-ins, therefore there is no need for
them to stay defined.

The removed helpers are:
    * izip, imap and ifilter
    * unichr, text_type
    * implements_to_string, implements_iterator
    * string_types, integer_types
    * to_native

The python 2 shims have also been removed, and only the python 3 helpers
have been kept, because they can still be usable (i.e. accepting
both bytes and str for functions that can only accept one of the two)

[REM] pyjsparser: remove PY3 shims

They're no longer necessary as Odoo doesn't officially support python 2
anymore.

closes odoo/odoo#28519
2018-11-29 09:28:17 +00:00