Commit Graph
2618 Commits
Author SHA1 Message Date
qsm-odoo 55d6bbd723 [FIX] web_editor: trigger 'content_changed' event on correct elements
When 'data-apply-to' was introduced to be able to target different
elements for snippet option methods, we kept triggering the
'content_changed' event on the main option element. This can be a
problem if the main option element is not in an editable element and the
elements targeted by apply-to are, as that editable element would not
be marked as dirty.

Note: the bug could actually still be produced, even in Odoo <= 13.0
where the apply-to param does not exist, by using a option method
which searches by itself for an inner element in an inside editable
element. This is considered as a limitation for the time being.

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

X-original-commit: 906b2d9d4679c03365f949633e3c90319724deb8
2020-06-11 11:17:00 +00:00
qsm-odoo 117552f097 [FIX] web_editor: properly cover modal snippets
When a snippet contains a modal, the editor overlay should not cover the
0-height wrapping div but the modal element itself.

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

X-original-commit: bc055e7822b9b2e7f8f9608e335456a71d7896a1
2020-06-09 10:52:26 +00:00
qsm-odoo b61a3c9744 [FIX] web_editor: restore invisible snippet activation
The loading effect of the left panel was conflicting with the invisible
snippet activation. This is to be reviewed with the new UI anyway, so
the loading effect is just removed in that case for now.

closes odoo/odoo#52676

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-06-09 09:36:05 +00:00
qsm-odoo a33e23da74 [FIX] web_editor: restore crop widget backdrop color
Revert https://github.com/odoo/odoo/commit/14c8b285ef3e11cf8a8387bb211272e6456e4d42
which fixed a scss compilation error but changed the design by mistake.
The 4 digits hexa was not supported in old sass compiler so we use a
rgba() value instead.

closes odoo/odoo#52622

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-06-08 15:11:19 +00:00
qsm-odoo 7813f7b555 [FIX] web_editor: fix color classes for non-background properties
The computed preview for non-background properties (e.g. borders) was
wrong in the left panel since the color presets classes were considered
by mistake.

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

closes odoo/odoo#52605

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-06-08 13:19:21 +00:00
Jeremy Kersten 14c8b285ef [FIX] web_editor: fix typo in color code
closes odoo/odoo#52601

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-06-08 12:39:46 +00:00
jvm-odoo 17e409181e [FIX] web_editor: fix duplicated pasted image summernote
Issue

        - Windows > Chrome or Firefox
        - Any chatter > Open full screen
        - Paste any image

        The image is pasted twice

Cause

        Summernote adds the image but
        the browser event adds it too

Solution

	I applied the fix that summernote did
	summernote/summernote/commit/6e432941af17c5fee0877d9ff54b6ace65fbdb4b

OPW-2267712

closes odoo/odoo#52532

X-original-commit: 2b4b2ce8660326b1cb53b5624690718b89aaceda
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-06-05 15:24:05 +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 59cd23a4df [MOV] web_editor: rename crop_dialog.js in preparation for inlining
In the next commit the crop functionality will be made into an inline
widget instead of a modal dialog, as such, the name no longer makes
sense.

Part of https://github.com/odoo/odoo/pull/51517
task-2192755
2020-06-05 18:11:34 +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
Samuel Degueldre a904a63833 [FIX] web_editor: fix layoutInfo is null traceback
When attempting to update its UI in reaction to events, summernote tries
to make layout info for the event target, this relies on finding this
information on one of the target's ancestors. In some cases, elements
can be removed from the DOM between the moment the event was triggered,
and the moment summernote attempts to create the layoutInfo, resulting
in layoutInfo being null.

This commit prevents tracebacks from happening in such cases by checking
that a layoutInfo was actually returned, and if not, aborting the UI
update that relies on it.

closes odoo/odoo#52541

X-original-commit: 3e999db0c114d51102ae51f870f98a4cc276c4b4
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-06-05 16:33:21 +00:00
qsm-odoo 6e2ec9c7d4 [FIX] web_editor: ensure a crash during save does not lock the editor
An error has been introduced by [1]. Indeed `response.data` does not
exist, but `response.message.data` does. However, the whole `if` clause
there seems now useless so this commit removes it. The whole file is
being refactored anyway with the new editor.

[1]: https://github.com/odoo/odoo/commit/ab4000fb3cf8fa54ba714ceceec391b78d73755e#diff-b1b550326b2d36a24e94e52c3901d1fbL513

closes odoo/odoo#52534

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-06-05 15:41:10 +00:00
DramixDw 3ea7d6520c [FIX] web_editor: ease input selection in the left panel
If a mousedown event was fired over the left panel in edit mode while
the mouse up was fired over the current page in edit, the focus would
suddenly go at the top of the page due to pointer events. This made
input selection not easy on some browser.

task-2210712

closes odoo/odoo#52495

X-original-commit: 667ea8d586e8e8fdb7d0509e9ffc87fa5c76af56
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-06-05 10:51:38 +00:00
Laurent Stukkens (LTU) bad8e5a420 [IMP] web_editor: ease drag and drop understanding
Ease the understanding of the drag'n drop of a snippet. Users test have
demonstrated that one doesn't understand how to add a snippet on the page.

* Rotate the snippet once clicked, as it is for tasks in project application.
* Keep the position of the mouse.

task-2261817

closes odoo/odoo#51905

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-06-04 13:58:24 +00:00
stefanorigano (SRI) aa867ba702 [IMP] website, *: define 17 generic color palettes
*: web_editor

Those will be shared by all themes.

Part of https://github.com/odoo/odoo/pull/52224
task-2197038

closes odoo/odoo#52224

Related: odoo/design-themes#290
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-06-02 15:29:50 +00:00
qsm-odoo e505ed2833 [IMP] website, *: allow color palette selection
*: web_editor

Note: on color palette change, all the colors of the user are reset and
he is warned about it.

Part of https://github.com/odoo/odoo/pull/52224
task-2197038
2020-06-02 15:29:33 +00:00
stefanorigano (SRI) 257a21abd7 [IMP] website, *: refine default theme design
*: web_editor

Part of https://github.com/odoo/odoo/pull/52223
task-2197038
2020-06-02 12:17:23 +00:00
qsm-odoo 00f70f7936 [IMP] website, *: allow to use a color preset for menu and footer
*: web_editor, web

Also now allows to control the copyright section color.

This commit also allows to use color name alias when the user choose
one of the 5 main colors or a gray color for one component (e.g. if the
user picks 'o-color-1' as the color for its text in preset 4, then it
will no longer be linked to the current css color of 'o-color-1' but to
'o-color-1' directly; meaning that if that color changes in the future,
so will the text of preset 4).

Part of https://github.com/odoo/odoo/pull/52223
task-2197038
2020-06-02 12:17:23 +00:00
qsm-odoo 66c99b86b3 [IMP] web, *: stop automatic color for text for transparent bg classes
* web_editor

Now, if the opacity of the bg color for a bg classes is lower than x
(currently 0.3), the class will only control the bg and not the text
and other components anymore. This behavior is disabled for presets
though (otherwise the text color would be "undefined").

Part of https://github.com/odoo/odoo/pull/45856
task-2197038
2020-06-02 09:42:19 +00:00
qsm-odoo 55c90cc9fa [IMP] website, *: allow presets user edition
*: web, web_editor

Now, the user can edit each individual component of each color preset
thanks to the third tab of the left panel. The edition of the first
preset is the same as the others for the users but it is actually
also used for "no-preset" areas, meaning that they impact the whole
website by default (*without impacting the other presets*). The website
thus appears as areas using presets, preset 1 being the default (in the
future all areas will be customizable with a different preset). The only
difference between "using preset 1 explicitely" and "not using a preset"
will be that background color is transparent in no-preset, leaving the
body background appear. If the body background has no image, then there
is no difference at all as the background color of the body is set to be
the background color of the preset 1. In boxed mode, that color is used
for the "box" and the website body uses a different customizable color.

Note: before this commit, the "text" color edition was used to set the
main text color and one of the constrasting color for the color-yiq
function (the darkest if a dark color or the lightest if a light color).
That last part has been removed and automatic colors will now always
use $gray-900 and $white as contrasting colors, unless changed by the
theme explicitely. This needed to be removed as now the "text color"
edition has been moved in the "preset 1" config and should thus only
impact the "no-preset / preset 1" areas instead of all the presets.

Part of https://github.com/odoo/odoo/pull/45856
task-2197038
2020-06-02 09:42:19 +00:00
qsm-odoo 7736cde22c [IMP] web_editor, website, *: use new color names
*: mass_mailing, website_blog, website_forum, website_hr_recruitment

Deprecate alpha, beta, gamma, delta and espilon color names and now use
a new color system: o-color-x, with x from 1 to 5.

This will allow to review the colors of all themes to have nice visuals
for the new color combinations classes, without breaking the current
uses of bg-alpha, alert-delta, etc in current websites of customers
(by keeping the old color and classes for compatibility).

This will also allow to uniformize all themes under the same conventions
to enforce BS color override:
- o-color-1 used as primary (as before, for alpha)
- o-color-2 used as secondary (as before, for beta)

Before, some themes were not following the 2 guidelines. The users
using those themes will simply have the possibility to choose o-color-1
and o-color-2 colors accordingly to restore their website without
breaking the new system features.

Another change is that those colors are defined through color palettes
and not theme color palettes. This will avoid them to generate automatic
bootstrap classes which we don't want (alert, btn) and generate the one
we want by ourself.

Note: for mass mailing, the colors and classes also have been renamed
but the system stays unchanged.

Part of https://github.com/odoo/odoo/pull/45856
task-2197038
2020-06-02 09:42:19 +00:00
qsm-odoo ade27dd08d [IMP] web_editor: allow color combinations specific override and access
Now, the colors used in a color combination are accessible and possible
to override through the BS $colors map, with a specific prefix
(o-cc for "color combination").

So, to access the 'headings' color of the color combination 3, use:

color('o-cc3-headings');

If you don't need to completely override a color combinations preset,
you can override what you want through a color palette:

$o-color-palettes: (
    (
        'text': red,
        'o-cc4-btn-primary': 'alpha',
        // ...
    )
);

As our current system allows the user to customize colors of the color
palette (like for menu, default text, etc), this will allow to easily
give them the possibility to override combinations colors in a future
update.

Part of https://github.com/odoo/odoo/pull/45856
task-2197038
2020-06-02 09:42:19 +00:00
qsm-odoo d9c4d928f7 [IMP] web_editor, *: integrate new o_cc${xxx} classes in the colorpicker
*: website

Part of https://github.com/odoo/odoo/pull/45856
task-2197038
2020-06-02 09:42:19 +00:00
qsm-odoo 69190959ce [IMP] website, *: introduce new classes to color snippets
*: web, web_editor, website_blog, website_event

New o_cc${xxx} classes where ${xxx} is a number [1-5] to style snippets:
they come with a background color, a text color, headings colors, a
link color, primary button colors and secondary button colors which
will later be possible to customize by the user.

The classes are made so that they are working on two levels. So if a
column receives a color class and the snippet too, everything will work
fine. More than 2 levels are not supported and the editor is made so
those cases should not appear. See o_colored_level class.

Part of https://github.com/odoo/odoo/pull/45856
task-2197038
2020-06-02 09:42:19 +00:00
qsm-odoo 78d5b744f5 [IMP] website, *: introduce a way to define outline buttons by default
*: web, web_editor

Disable the automatic generation of bootstrap color buttons and do it
ourself with a tweak: we introduce btn-fill-* (working as the normal
btn-* classes (in opposition to btn-outline-* classes). We then map
btn-* classes to either btn-fill-* or btn-outline-* classes depending
on the configuration (with a sass extend).

Part of https://github.com/odoo/odoo/pull/52220
task-2197038

closes odoo/odoo#52220

Related: odoo/design-themes#288
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-06-01 10:48:53 +00:00
qsm-odoo 9db3012dd6 [IMP] web_editor: simplify button color choices
Now only suggest bootstrap classes for buttons: link/primary/secondary.
Also review the link dialog to show only the options which are
meaningful to the chosen type.

Note: it will still be possible to change from an old color to primary
or secondary).

Part of https://github.com/odoo/odoo/pull/52220
task-2197038
2020-06-01 10:48:45 +00:00
qsm-odoo be6a8cfde7 [IMP] website, web, *: allow to choose website font-size
*: web_editor

Note: this work also prepare the code to be able to support different
font configs per font family.

Part of https://github.com/odoo/odoo/pull/52220
task-2197038
2020-06-01 10:48:08 +00:00
qsm-odoo 930b1d00d4 [FIX] web_editor: render custom option XML before we-row processing
Using we-row inside custom XML was not working.

Part of https://github.com/odoo/odoo/pull/52211
Related to task-2197038
2020-05-31 13:37:18 +00:00
qsm-odoo 5c16c86cd5 [IMP] web_editor: allow left-panel select to have custom active labels
Instead of the text of the selected option displayed as label, we may
want another text (especially if the choice has long text). This can
be defined on buttons with 'data-select-label'.

Part of https://github.com/odoo/odoo/pull/52211
Related to task-2197038
2020-05-31 13:37:03 +00:00
qsm-odoo a5d59de84b [IMP] web_editor: allow left-panel select to have an unique icon label
Part of https://github.com/odoo/odoo/pull/52211
Related to task-2197038
2020-05-31 13:36:53 +00:00
qsm-odoo 3d20d36bad [FIX] web_editor: make a test more robust
Don't know how this test worked before but it will stop working with
next updates. This just make it more robust using the same trick as
other tests: wait for the colorpicker to be opened before actually
using it.

Part of https://github.com/odoo/odoo/pull/52211
Related to task-2197038
2020-05-31 13:36:45 +00:00
qsm-odoo 43557ecbc7 [IMP] web_editor, website: add loading effect in left panel editor
The goal is to reduce loadings as much as possible but there will
always be some. So that loadings do not appear as bugs and give users
some feedback that they are ongoing, this commit adds a loading effect
during the loading of some actions.

Part of https://github.com/odoo/odoo/pull/52211
Related to task-2197038
2020-05-31 13:36:25 +00:00
qsm-odoo e2cf0a2358 [FIX] website, *: review theme tab creation + switching
*: web_editor

When clicking on the theme tab on an empty page, a scrollbar appeared
and stayed. This was because the fake `<theme/>` element was focused and
the overlay positioned randomly outside of the page.

This commit fixes that by simplifying the code and always hiding the
related overlay. This commit also makes sure the onFocus/onBlur method
of the theme options are called consistently, even though they are
probably not useful.

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

closes odoo/odoo#52114

X-original-commit: 7760898de4e14fa30db1db87dfa05276bfcaa2bb
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-05-28 14:32:25 +00:00
qsm-odoo 0c895e0bf9 [FIX] web_editor: correctly call onBlur on tab change
Before this commit, the onBlur function of snippet options was not
called if the blur occured because of a click on the 'Blocks' tab.

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

X-original-commit: 85049e2dcf68c40218bd0f4ed7401a4f979951d4
2020-05-28 14:32:25 +00:00
qsm-odoo ff2c9fc195 [IMP] web_editor: preload colorpalette dependencies on editor start
As the colorpalette has very big chances to have to be loaded when the
user enters edit mode (any click on a text will require the colorpalette
to be available), this commit makes it so the dependencies are loaded as
soon as the editor is started, without actually waiting for them until
the colorpalette are used.

This allows to make the first click on a text or on the theme tab a bit
faster to react.

closes odoo/odoo#52116

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-05-28 14:41:49 +00:00
Anh Thao Pham (pta) aca52baee3 [FIX] web_editor: fix focus for some tools in Summernote
- Go to Project
- Open a project to display Tasks
- Switch to list view
- Click on create button
- On task form page, click nowhere. (It is important to not click on anything)
- On the taskbar of the WYSIWYG editor used for Description, click on one of the following actions:
    * Unordered list
    * Ordered list
    * Checklist
    * Table
    * Style
- The action will be applied to the "name" field (Task Title) and
  an error will prompt for Unordered list, Ordered list and Checklist actions
- If not, discard the form and retry by opening the form with create button

In this case, the WYSIWYG editor does not have the focus and try to execute
the tool action on the current focused element.

opw-2256835

closes odoo/odoo#52023

X-original-commit: eaa55ce3e806ad0d9609394309ff9d48b32bb73f
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-05-27 18:13:00 +00:00
Samuel Degueldre be54b82afd [FIX] web_editor, mass_mailing: fix assets template unable to load
View rendering from javascript has recently been made to check
permissions (See commits 64d0dab0a6
through ccc98e0169). Some assets required
by the iframe editor are rendered in JS so that they can be injected
into the iframe, but their permissions had not been updated, causing a
crash when trying to create or edit a mass_mailing campaign.

This commit fixes that by adding groups="base.group_user" to the
required templates.

closes odoo/odoo#51598

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-05-20 13:36:19 +00:00
fja-odoo 049745c5ff [FIX] web_editor: fix _view_get infinite recursion
The _view_get function is a recursive function used to retieve all the
views related to a view (inherited or t-called).

The issue is that by an odd set of circumstances it is possible to have
a loop in the view graph. Resulting in the recursive function being
called until a "maximum recursion depth exceeded" error occurs.

Example of a loop: A t-call B and A inherit from B

This is possible on an update of a view that has been forked by website:
If the view A was doing a t-call on B and is has been duplicated with
the arch modified.
When we update with the changes A now inherit from B instead of t-call B
Since the arch was modified it will not be updated so A will still
t-call B but the inherit_id of A is unchanged so it will be updated to
reference B resulting in a loop.

closes odoo/odoo#51620

X-original-commit: 63e1e84ebd7e609d6e06d83dc0f0092688b013eb
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-05-20 13:20:35 +00:00
Aaron Bohy 798931fc39 [REF] web(_editor): move jquery.nearest lib to web
This lib is also used by the Gantt view, so we move it to the
common basis between web_editor and web_gantt, which is web.

Part of task 2205607

closes odoo/odoo#51606

Related: odoo/enterprise#9740
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-05-20 09:33:04 +00:00
Samuel Degueldre a814b671ed [IMP] web_editor: optimize selector functions for snippetOptions
Because of cross-browser compatibility concerns, jQuery's selector
engine makes using :has selector relatively slow. This is usually
acceptable, but in the case of snippet options, some options also need
to use :has in their data-target selector, and nested :has selectors'
performance degrade exponentially with the level of nesting.

Additionaly, jQuery evaluates complex selectors right-to-left, which
makes the :not operator quite inefficient.

Because of that, this commit removes :has and :not from the conditions
that were added at the end of the data-selector, and speeds up the
selector by a factor of ~15-40

Lastly, the addDropSelector options was actually unused, and a leftover
from the editor revert, as such it has been removed.

closes odoo/odoo#50073

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-05-19 06:55:42 +00:00
fja-odoo 8fc0a06c40 [FIX] web_editor: restore colorpalette compatibility colors
Colorpalette compatibility system was broken so old color classes were
not removed from snippets when being edited.
The bug was introduced by [1].

Also if a compatibility color class happens to use the same css color as
a current theme class, that one will now be shown as selected.

[1]: https://github.com/odoo/odoo/commit/c20423313cf10f262e615badc0397e6ba4ef4087

closes odoo/odoo#51464

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-05-18 16:41:54 +00:00
fja-odoo 99910b526e [IMP] web, web_editor: integrate colorpicker in colorpalette
Stop using the colorpicker dialog in the colorpalette widget.
Integrate the colorpicker widget in the colorpalette widget. Of course,
the colorpicker behaviors are adapted so that no useless rerendering
of the colorpalette is made on each value change.

The 'reset color' button is now a button like the other colors, no need
for a 'color_reset' event anymore. It is removed and replaced with a
'color_picked' event with color being an empty string. The clear button
now also work on hover.

Also, the topbar colorpalette for text and text background colors now
has the exact same behaviour as the background colorpalette: adding
color preview on hover.

The colorpalette now also closes on 'enter' keypress.

Part of https://github.com/odoo/odoo/pull/46088
task-2195313

closes odoo/odoo#46088

Related: odoo/enterprise#8696
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-05-15 11:05:00 +00:00
fja-odoo a72c9adbe5 [IMP] web_editor, *: make Colorpicker a Widget
*: website, web

Move the colorpicker dialog logic into a colorpicker *widget*, which the
colorpicker dialog will now instantiate.

Part of https://github.com/odoo/odoo/pull/46088
task-2195313
2020-05-14 22:45:33 +00:00
fja-odoo 79903abc3e [REM] web_editor: remove ColorPaletteDialog
Removing dead code.

Part of https://github.com/odoo/odoo/pull/46088
task-2195313
2020-05-14 22:34:36 +00:00
Martin Trigaux 64d0dab0a6 [FIX] *: add group_ids where it is needed
Following the previous commit adding access via groups_id
These views are rendered publicly by specific user
2020-05-14 13:59:10 +02: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
Martin Trigaux 56a8c9e431 [FIX] *: add sudo when accessing views
The method fields_view_get should be the only way to retrieve the view
content. This method is executed in a super-user context.

To avoid retrieving views for a model a user does not have access to
(as it may reveal some informations like name of fields), add a
verification of 'read' rights before retrieving the view content.

Execute _postprocess_access_rights with sudo(False) as this method is
used to evaluate which buttons should be displayed.
Remove the su flag to avoid misleading the user and displaying a
button they won't be able to use.

Retrieving the database id from an view key is not considered as a
sensitive information and get_view_id and viewref can be left as a
public methods.

Add missing sudo when needed

Change _handle_visibility in website to avoid increasing the query
count: Checking the visibility (to fail most of the time) to retry in
sudo was making unecessary queries.
2020-05-14 13:59:10 +02:00
Samuel Degueldre e09120a1d6 [FIX] web_editor: increase precision of number-string conversion
Previously, when converting a number to a string we only kept 3
decimals, it turns out that when converting back and forth between rem
and pixels, we were losing enough precision that we had inexact pixel
values shown to the end user for odd number of pixels, even with the
default rem value of 16px.

This commit increases the precision to 5 to work around this issue and
allow us to convert exactly between rem and pixels at the default
16px/rem.

task-2248360

closes odoo/odoo#50881

X-original-commit: fdce273f4fe72a9e2555acecad3c2989110dac1a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-05-07 16:15:07 +00:00
David Monjoie 6c05214f90 [FIX] web_editor: fix media dialog when no media selected
closes odoo/odoo#50341

X-original-commit: 9baf753ace725b000eae98cd95e4f5e0aa84466a
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2020-04-28 15:44:31 +00:00