The goal of this commit is to forward port [the original commit] which
was introduced in 16.4 but, due to an error, has not been forward
ported.
Original commit message:
Since [1] when uploading images from URL the data is downloaded and then
hosted on the Odoo instance. As stated in its task (task-3129360) it
should not have been applied to document URLs.
Because of this, when hitting a CORS issue to fetch binary data, we try
to fetch the data through an `<img>` element by setting its `src` field
- which also fails when the data is not an image.
This commit makes the changes of [1] specific to image uploads and
restores the previous behavior for other files.
Steps to reproduce:
- Drop a "Text - Image" snippet.
- Double-click on the image.
- Go to the Documents tab.
- Click on "Add URL".
- Enter an example PDF URL.
E.g.: https://www.africau.edu/images/default/sample.pdf
- Click on "Add URL".
=> Fails because of a CORS issue.
[the original commit]: https://github.com/odoo/odoo/commit/238566d1dea29fd11353e7e6529d29843c4f658b
[1]: https://github.com/odoo/odoo/commit/943944dd249c15de870d6800d89e48d54a422e5a
task-3493618
closesodoo/odoo#163576
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
The image displayed in the theme selection page is the last one that
was created out of the theme's manifest's `images` entry.
Because of this, when a theme has a different non-last image in a new
version compared to an old version, that image becomes the last created
one and is displayed in the theme selection page instead of the expected
screenshot image.
This commit preserves the order that was specified in the `images`
definition by re-creating all images instead of only the modified ones -
if an update is needed at all.
Steps to reproduce:
- Install `website` with a theme in 14.0.
- Upgrade to 15.0.
- Go to the theme selection page.
=> Some themes (e.g. `theme_beauty`) displayed their cover picture
instead of their screenshot.
task-2719425
closesodoo/odoo#163118
X-original-commit: 4bc165b68078638a8057c79162f428026ca81321
Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
In order for preview images to be shown in the theme selection page, the
`update_theme_images` function needs to be called.
This was done in a `post_init_hook`, which is called e.g. when
installing `website`.
This was also done in a `website` override of
`ir.module.module.update_list()` which is called when updating a module
interactively.
Unfortunately, even though this override is defined, at the time
`update_list()` is called from `loading.py` when using `-u` in the
command line, the modules are not loaded yet, and therefore the override
is not applied.
Because of this, when a database was upgraded to versions that introduce
new themes or new screenshots for themes, `update_theme_images` was not
called during the upgrade, and the new images were missing in the
upgraded database.
This commit solves this by calling `update_theme_images` from a
`function` data record, so that it is run both on install and on update
of `website`.
Steps to reproduce:
- Install website and a theme in 14.0.
- Upgrade to 15.0.
- Access the theme selection page.
=> Images were missing for some themes.
task-2719425
X-original-commit: 8e73375e674ba0018ac4ea12a5b19bb4e6bcae31
Part-of: odoo/odoo#163118
In Chrome, if a scroll event is not brand new, its `currentTarget` is
lost.
This commit makes sure that the `currentTarget` of the throttled scroll
event sent to `_onScrollWebsiteAnimate` is kept separately to avoid the
issue in case of throttling delay.
task-3449843
closesodoo/odoo#161850
X-original-commit: 277e9f292a031ed835f4135e597c17dab2fd067d
Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
This is a followup on [1].
In Chrome the event's currentTarget is cleared after events such as
"scroll" are handled. For asynchronously called methods to be able to
access it, the current value of currentTarget needs to be kept.
To help developers that might stumble on this issue when using
`throttleForAnimation`, this commit emphasizes the fact that usage of
that function is not limited to event handlers, and it adds a test case
that illustrates a solution for tracking the lost scroll event target.
No scenario was identified in 15.0, but this could be used as an
alternative solution for [1].
[1]: https://github.com/odoo/odoo/commit/0ba601d2ef5c4e2f846818e78dcd23966d6f563d
task-3449843
X-original-commit: 6cc4cbf2b91d624368c489460a90795921985f6b
Part-of: odoo/odoo#161850
If an error happens when a website page is being saved, the error
message was displayed as a popup on the edited block.
Since [1] that error was not displayed anymore because the call to
`ir.ui.view`.`save` from `this._rpc`, which wrapped errors into a
message, was changed to `this.orm.call`, which raises errors in their
original form.
This commit adapts the error handling to expect an actual error instead
of a message.
[1]: https://github.com/odoo/odoo/commit/d7245d2abf528d093226c80e40975e63d61e8997
task-3599890
closesodoo/odoo#155071
X-original-commit: 7d5aeabebbc56ac22d06e8291e1cf58b62d4defe
Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com>
When using the up/down arrows in an `InputUserValueWidget`, only the
first value is updated but the other ones are lost.
This commit adapts the behavior so that all parts of the composite value
are updated.
When decreasing, parts that have reached zero are set to zero.
Steps to reproduce:
- Drop a "Banner" snippet.
- Select the text block.
- Set the "Border" option to "5 10".
- Press the up or down key.
=> Only the "5" was updated, the "10" was lost.
task-3800288
closesodoo/odoo#159385
Signed-off-by: Robin Lejeune (role) <role@odoo.com>
When specifying a composite value in a `UnitUserValueWidget`, if the
first element is a 0, it is considered inactive and resets to its
default value.
This commit considers composite values that start with a 0 as active.
Steps to reproduce:
- Drop a "Banner" snippet in a page.
- Select the text column.
- Specify "0 10" in the Border.
=> The value was reset to 0.
task-3800288
Part-of: odoo/odoo#159385
Since [1] when `extraClass` was introduced, styles are wrongly applied
if an `extraClass` is defined on a `selectStyle` option, but both the
class and the option modify the same CSS property.
Typically, the "Round Corners" option sets the `border-radius` property
and uses the `rounded` extra class. But that extra class specifies
values for the `border-radius` properties.
Without the class, `applyCSS` determines that the style of some corners
is already `0px` and does therefore not need to be added to the inline
style.
But once the class is added, this is not true anymore - and the `0px`
should have been specified.
This commit avoids this issue by applying the CSS again once the
`extraClass` is added.
It also reverts [2] partially to remove the `extraClass` handling from
within the `applyCSS` function.
Steps to reproduce:
- Drop a "Text - Image" snippet.
- Select the image.
- Set the "Round Corners" to "50 0 0 0".
- Press tab to leave the field.
=> The entered field values was transformed.
[1]: https://github.com/odoo/odoo/commit/bf5b4b69330747af7b09d48e59218b78a29a4b14
[2]: https://github.com/odoo/odoo/commit/d3c3dab8950abc25b29937605091d8ce32305fa4
task-3800288
Part-of: odoo/odoo#159385
Since [1] when options on background images have been applied as soon as
they were modified instead of on save, those options were not reset when
the background was removed.
This commit removes those options when the background image is removed.
Steps to reproduce:
- Drop a Text snippet.
- Add a background image.
- Remove the background image.
- Save.
=> Save failed.
[1]: https://github.com/odoo/odoo/commit/4a797f51ec9d3d378fc30033e4fda2bc1e73586c
task-3794812
closesodoo/odoo#158326
X-original-commit: 23c805030abb89ca449cf430d5661d725f5801a8
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Co-authored-by: Serge Bayet <seba@odoo.com>
Since [1] when the social share widget was introduced, a hashtag is
generated from the name of the website that is found inside the page
title.
This fails when the page title is replaced through the SEO feature.
This commit prevents the failure but not extracting the website name if
it is missing from the title.
Note that the `registry.socialShare` fixed here is only used by the
forum post page in the whole codebase. It is different from the social
snippet. The social snippet is doing the same code (kind of duplicate),
but it does not care about removing the | right part. It means that if
you drag & drop the "Share" snippet in a forum post page (like in the
footer) and click on it, it will work since it does not try to split on
the title's pipe.
In master, we will evaluate if we should remove this
`registry.socialShare` and use the `Share` snippet instead.
Steps to reproduce:
- Install website_forum.
- Go to a forum post.
- Set SEO title to a value without `|` (pipe).
- Share to X.
=> An error popup was shown.
[1]: https://github.com/odoo/odoo/commit/1c91e27c8c8cb7492d26f03e27c4991b53a1675d
opw-3799914
closesodoo/odoo#158478
X-original-commit: f89f4a8f1ad0ee3fb62ba246ea17988955dbdc4b
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Since [1] when the "Padding (Y, X)" option was added, form elements are
recognized as columns because they match the `.row > div` selector of
that new option.
This commit excludes those form elements from this option's selector.
Steps to reproduce:
- Drop a website form.
- Click on field's input.
=> An empty "Column" editor appeared in the side panel, and an error
occurred when trying to delete it.
[1]: https://github.com/odoo/odoo/commit/11418cc6f0afcc8e14869f4f38ae0d6d462ac712
task-3748574
closesodoo/odoo#157572
Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
When configuring a Newsletter Block snippet to display a subscription
form, the option to decide whether a message must be displayed is only
available when "On Success" is set to "Show Message" through the button
beside that option.
Unfortunately, the general option for the "Thanks" message is not
disabled for other "On Success" values, for which no outcome can display
a message. Trying to combine these triggered an error.
This commit fixes this problem by hiding the "Display Thanks Button"
option when the "Form Subscription" template is selected.
Steps to produce:
- Install `website_mass_mailing`.
- Drop a "Newsletter Block" snippet.
- Change template to "Form Subscription".
- Click on "Subscribe" button.
- Change "On Success" to "Nothing".
- Click on "Display Thanks Button".
=> An error was displayed.
task-3748574
closesodoo/odoo#157739
X-original-commit: b090d68894fb96a73df230e021e516e6df22f40e
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
This commit is a follow-up on [1] which fixed the caching of restricted
editor which was accidentally shared with public users.
It introduces a test that verifies that this fix is not lost.
[1]: https://github.com/odoo/odoo/commit/821888023db462d522c5d6de84fcab80a81c2713
task-3482439
closesodoo/odoo#156795
X-original-commit: d1ca64498ce656a2d091121d73ab2a9b6d043549
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
When QWeb templates became cached and compiled in [1], the list of
default cache key elements did not contain `inherit_branding_auto`
(but it included the old `inherit_branding`).
Because of this the cache was shared between restricted editors and
public users, which could lead to problems such as missing the branding
on edited fields.
Steps to reproduce:
- Use a single browser instance and do not log any user out.
- Start with `website_sale`.
- Make "demo" user a restricted editor and a sales administrator.
- Connect on 127.0.0.1 as "demo" and go to a product website page.
- Go to 127.0.0.2 as a visitor and go to the same product page.
=> The product name field of the visitor page was branded.
If you swap the last two steps, the "demo" user's page lacks the
branding.
[1]: https://github.com/odoo/odoo/commit/7ede9bcb2de9d52994b3a6fcb84edc3f81d60284
task-3482439
closesodoo/odoo#156146
X-original-commit: 821888023db462d522c5d6de84fcab80a81c2713
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Since [1] when the mega menu were first introduced, to make their
edition possible, the bootstrap dropdown behavior was neutralized by
removing the `data-[bs-]toggle` attribute.
In [2] when Bootstrap was upgraded to version 5.1.3, the
`dataApiKeydownHandler` event handler that is called when up, down or
escape are pressed raises an error if `data-bs-toggle` cannot be found
on a previous sibling of the dropdown. This makes the approach chosen
in [1] incomplete.
This commit avoids this issue by temporarily adding a class that
is excluded from the event handler selector.
The patch must unfortunately be applied within bootstrap itself because
the event handler is registered right after the method is defined and
we have no way to access the registered event handlers afterwards.
This makes it impossible to patch the called method from outside, nor
its associated selector.
We cannot simply update the selector that was already patched by [3]
because it is also used by other methods.
A test is included which should mitigate the risk of accidentally losing
this patch upon bootstrap upgrades.
Steps to reproduce:
- Create a mega menu.
- Edit the page.
- Open the mega menu.
- Click inside the mega menu content to have a cursor selection.
- Press the arrow up key, the arrow down key or the escape key.
=> An error dialog was displayed.
The same issue happened with a nested menu instead of a mega menu.
[1]: https://github.com/odoo/odoo/commit/1345702258adbfbee0d780dc22e552395e6d1df7
[2]: https://github.com/odoo/odoo/commit/971e5a91aab96d36129a823e03f1f9f1b1293968
[3]: https://github.com/odoo/odoo/commit/daca8fe4e3da4a5ad5fabf3730496a3919af8abc
task-3614926
opw-3741670
closesodoo/odoo#155019
X-original-commit: 48f0c4203ceb5e770fed6193bd6382690b1b62fe
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Before this commit the button to add documents from an URL is labeled
"Add Document" which is confusing given it is displayed besides an
"Upload Document" button.
This commit renames the "Add Document" button into "Add URL" to make its
purpose more obvious.
task-3493618
closesodoo/odoo#149406
X-original-commit: 860cbe0fcddc7b7a6f1ca383161ab439ba68fd72
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Since [1] a margin is applied when another `o_we_user_value_widget`
follows a color palette. Unfortunately this is also applied when the two
elements are not on the same row. Because of this the "Slideout Effect"
option below the "Colors" option of "Footer" looks like it is indented
while it is unrelated to the color selection.
This commit restricts that margin to elements that belong to the a
`we-row`.
[1]: https://github.com/odoo/odoo/commit/2f81c6ae68751d5f93c30aef822730ee04ead391
task-3696870
closesodoo/odoo#150701
X-original-commit: 50c0a5479a11fef0b03bf319283817a94a32cea4
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
When obtaining several batches of images for the same string query on
Unsplash, sometimes the same image appears in several batches.
Because of this the `t-foreach` in the `web_unsplash.ImagesListTemplate`
template fails when duplicate records appear in the list of images.
This commit ignores duplicates received from Unsplash to avoid the
issue.
task-3637756
closesodoo/odoo#150511
X-original-commit: 78cad00e169e42d13aecf37ffb19615d725f4e2d
Signed-off-by: Robin Lejeune (role) <role@odoo.com>
*: theme_default
Since [1] when installing a theme from the Website builder's Themes tab,
if that theme used other snippets than the default ones in their
configurator pages which were inherited, the import of the theme failed
because the primary template was not generated before the import of the
data files.
This commit relies on each theme calling
`_generate_primary_snippet_templates` before declaring templates that
require them.
In master, the early loading is removed altogether.
See the changes in `theme_default` for the approach that was adopted
through all themes.
Steps to reproduce in master:
- Start odoo-bin with `-i website`.
- Edit home page.
- Go to the "Theme" tab.
- Click on "Switch Theme".
- Pick "CORPORATE / Buzzy".
=> Fails because the `website.configurator_s_banner` template is not
defined.
[1]: https://github.com/odoo/odoo/commit/cfed4e391d11058b1b46417f0b630cdbc4070d7c
task-3670496
closesodoo/odoo#148443
Related: odoo/design-themes#755
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
When pasting text inside the editor, if the text looks like a URL, a
link is implicitly created.
Unfortunately, this also happens when the edited element does not
support HTML.
Because of this, when translating a page, links are created inside the
translated text which does not support HTML.
This commit solves this by pasting the plain text if the target of the
paste does not support HTML (which is the case for translations).
This commit also prevent link creation when typing a space after text
that looks like an URL in targets that do not support HTML.
In saas-16.4, `_handleAutomaticLinkInsertion` is also adapted to prevent
unwanted link creation.
Steps to reproduce for first scenario:
- Add French to your website.
- Edit your master English Home page.
- Drop a Text snippet in the Home page.
- Save the Home page.
- Switch to French.
- Translate the page.
- From an external text input, copy `http://odoo.com` in your clipboard.
- Put the cursor inside the Text snippet's text.
- Paste.
=> A link was created.
Steps to reproduce for second scenario:
- Add French to your website.
- Edit your master English Home page.
- Drop a Text snippet in the Home page.
- Save the Home page.
- Switch to French.
- Translate the page.
- Put the cursor inside the Text snippet's text.
- Type `http://odoo.com` followed by a space.
=> A link was created.
opw-3546308
closesodoo/odoo#150189
X-original-commit: de351e500559166963fd2e748229d5c1d901aa44
Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
Since [1] when the `Colorpicker` template cache was moved from
`ColorPalette` to `getColorPickerTemplateService`, the custom buttons
fill color cannot be set as a gradient anymore.
This happens because the needed `getTemplate` props is injected for the
font and background colors, for the `we-colorpicker` but not for the
link tools color palettes.
This commit restores the gradient color selection for custom buttons by
linking the `getColorPickerTemplateService` to the link tools color
palettes.
Steps to reproduce:
- Edit Home page.
- Click on "Contact Us" link in header.
- Select link style "Custom" in link tools.
- Open "Fill Color" palette.
=> Gradient tab was not shown in palette.
[1]: https://github.com/odoo/odoo/commit/1d2e54088b0f0e28464ab6aa884fb2e1110e8e04
task-3641914
closesodoo/odoo#147373
X-original-commit: 087861bcbfe444765fdb0b81e0398c12d8db34e8
Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Before this commit if invisible elements are in the DOM (e.g.
device-visibility restricted) the arrows to move snippets (columns,
sections) did show up and behave as if the neighbour elements were
visible.
This commit hides arrows that would not visually move the snippet, and
upon using the move arrow, it also moves the snippet beyond the first
visible neighbour.
Steps to reproduce as of 16.0:
- Drop a "Columns" snippet.
- Make the center column hidden on desktop.
- Move the first column to the right.
=> It did not move and an arrow to move to the left was displayed.
Steps to reproduce before 16.0:
- Drop three snippets.
- Make the second snippet conditionally visible.
- Hide it using the eye icon in the "Invisible Elements" list.
- Move the first block down.
=> It did not move and an arrow to move upwards was displayed.
task-3584947
closesodoo/odoo#146879
X-original-commit: 60e2a5bc9ed8721ed34eb952cd34375fe5a93395
Signed-off-by: Robin Lejeune (role) <role@odoo.com>
During upgrades, customization modules are defined in the database but
their codebase is not in the addons path.
Because of this, when running an upgrade the manifest of such modules
does not exist which makes `_generate_primary_snippet_templates` fail
because it cannot locate some default keys.
This commit adapts the access to the manifest in order to use a default
value in case the manifest is not available.
closesodoo/odoo#144222
Related: odoo/design-themes#751
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
If the first theme that generates configurator templates has the same
block used several times within a single page, a unique constraint is
violated because it tries to create several identical
`configurator_<pagename>_<s_snippet_name>` templates.
This commit avoids this by only considering unique snippet names.
The issue typically appears with `s_title` on `theme_monglia` and
`theme_real_estate` if they are installed by themselves.
Part-of: odoo/odoo#144222
When shapes were extracted to configurator snippets in [1], some
configurator-specific snippets were created that do not appear on pages
of the specific theme.
Because in [2] the call to `_generate_primary_snippet_templates` is done
on a full list of themes instead of only the installed ones, the problem
was not noticed: if any theme defines a block, it's website-side
configurator-specific template is generated.
This is not the case during an upgrade: the templates are generated only
for the installed themes. Because of this some "useless" configurator
templates trigger an error when importing their XML definition because
their parent template does not exist.
This is fixed in design-themes by adding those templates in a pseudo
page `_` in the `configurator_snippets` entry of each theme's manifest.
This commit makes sure to not consider that `_` page name as an actual
page name.
In master, the templates will be removed instead.
[1]: https://github.com/odoo/design-themes/commit/d206c119720d557c11320ebb3d7339890b8f9efa
[2]: https://github.com/odoo/odoo/commit/928eeca714a161f6bc03343e4dc8af9b050b9841#diff-f49a1e9eda23df9f1d48121ba376a5fabafe70ea18b29d4eab23d737e5d4eeb6R446
Part-of: odoo/odoo#144222
It happened previously that the grid item could be broken if `top` and
`left` style properties were not set on it, which resulted in `NaN`
values being used in the grid-area computation.
This commit makes the drop more robust by obtaining their values through
the computed style instead of the style. This way these properties are
always defined.
task-3554752
closesodoo/odoo#143903
X-original-commit: 7a8fd5792f9eedfebf812b15730259de2b511a58
Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
Upon drop, the fix in [1] did consider invisible the blocks that were
visible within the current preview mode (mobile/desktop).
Because of this `onTargetHide` was be called instead of `onTargetShow`.
This commit changes that behavior so that the correct method remains
called according to the actual visibility, but the `DeviceVisibility`'s
`onTargetShow` is adapted to only add the override if it matches the
current preview mode.
No steps to reproduce for this first change, but third-party options
could have been impacted by it.
This commit also adds that condition on the cleanup that was added in
[2] to keep the `dataset.invisible` state consistent upon toggling the
preview mode.
Steps to reproduce this second issue:
- Drop a Columns snippet.
- Make a column visible only on mobile.
- Make another column visible only on desktop.
- Toggle preview mode several times.
=> `dataset.invisible` was set to `1` on all columns having
device-dependent visibility.
[1]: https://github.com/odoo/odoo/commit/acfca25e48ac9bc227234de860fe8128f0312ed4
[2]: https://github.com/odoo/odoo/commit/174e9fe0d8665d1a81c90a6f7bf5cc9e3361f161
task-3538535
closesodoo/odoo#143640closesodoo/odoo#143875
Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Since [1] when the generation of missing configurator templates and new
page templates was introduced, `_load_xmlid` was called for every
generated record so that `_process_end` does not delete them after a
module update.
Unfortunately, this trick does not work when using the "Upgrade" command
on the Website app in the Apps view. (or calling
```py
env['ir.module.module'].search([
('name', '=', 'website')
]).button_immediate_upgrade()`
```
from the shell): in that case, the `self.pool` onto which the xmlids
were registered was a different instance from the one accessed by
`_process_end`.
This commit avoids this problem by making the generated templates
`noupdate: True`, thus preventing `_process_end` from deleting them.
Steps to reproduce:
- Install website with -i
- Go to Apps, search Website, upgrade Website
=> In the logs you can see that some templates are deleted at the end of
the upgrade
- Website configurator: a business website, furniture store, get leads,
choose a palette, about us + services + pricing + privacy policy,
choose the center template (loftspace)
=> You see some crash in the logs
[1]: https://github.com/odoo/odoo/commit/a2f8e18b76e52e1a349b77691d0af18edc09a1beclosesodoo/odoo#140986
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Since [1] when device visibility became a visibility option, when
dropping a snippet that contains device-invisible blocks, all those
blocks were made visible.
This commit makes that behavior limited to blocks that are not
device-invisible. (E.g. when dropping a popup)
Steps to reproduce:
- drop a Columns snippet
- hide a column on mobile
- hide a column on desktop
- save snippet
- drop saved snippet in either desktop or mobile preview
=> All columns were shown with the `o_snippet_override_invisible` effect
on the conditional ones.
[1]: https://github.com/odoo/odoo/commit/3103e0553011b5c1f4078972d7a88fa3fd4068b2
task-3538535
closesodoo/odoo#140505
Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
When introducing the templates for the "new page" feature in [1], on
some elements classes ended up being specified twice, or being added
without removing a contradicting class (e.g. different bottom paddings)
This commit adjusts the blocks of the new page templates so that:
- no class appears twice
- only the visually applied class of several conflicting classes is kept
For `pt*`, `pb*` and `o_cc*` the class with the highest number is the
visually applied one.
[1]: https://github.com/odoo/odoo/commit/b27d52c193a08fe6a4471c844afa3d01a33ccace
task-3562147
closesodoo/odoo#139572
Related: odoo/design-themes#731
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Since [1] when the layout of the theme options was reorganized, the
button's font-family option was not displayed anymore.
This commit restores the button's font-family inside the "Button"
section, before the button "Padding" options.
[1]: https://github.com/odoo/odoo/commit/388e4bb2bfcaebdd4ff30277fb49a034592d7086
task-3478355
closesodoo/odoo#140692
X-original-commit: 718ae15606fe452da26fe9c4fa9c90cc443fd8f1
Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
In [1] when the "New page from template" feature was added,
`background-image: none` was removed from many blocks to avoid having to
handle it when adding an image.
That situation actually never arised, making those removals useless.
This commit removes those attribute removals.
The only impact this has it that it fixes the `s_call_to_action` styles
in `theme_notes` by restoring their images. The `<attribute remove=...>`
actually did separately remove `background-image` and `none`, corrupting
the exiting style.
[1]: https://github.com/odoo/odoo/commit/e0796020ee0c3188e1e9d9fa077de73a2211c6f7
task-3555325
Part-of: odoo/odoo#138748
In [1] when the "New page from template" feature was introduced, when
obtaining the CSS of the target website a Promise was returned which was
resolved in an asynchronous executor after obtaining a server response.
This commit relies on resolving a Deferred promise instead.
[1]: https://github.com/odoo/odoo/commit/e0796020ee0c3188e1e9d9fa077de73a2211c6f7
task-3555325
Part-of: odoo/odoo#138748
In [1] a mechanism was introduced to prevent the "New page" dialog from
being opened several times.
That problem occurred at a point during development when the loading of
the templates was delaying the display of the dialog, giving time to the
used to trigger again the action that opened the dialog. Now that the
dialog is actually opening right away to give access to the "Blank Page"
pseudo template, the situation cannot occur anymore.
To simplify the code, this commit removes that mechanism which is now
useless.
[1]: https://github.com/odoo/odoo/commit/e0796020ee0c3188e1e9d9fa077de73a2211c6f7
task-3555325
Part-of: odoo/odoo#138748
Before this commit, the "Table of Content" snippet only got its
navigation part rendered once the block was dropped.
In [1] when the "New page from template" feature was introduced, a
default pre-rendered content was introduced so that the "Table of
Content" snippet was properly rendered in the template previews where it
was used.
This commit moves this pre-rendered content from [1] into the base
definition of the snippet itself.
There is no collision problem regarding the default ids that are
included because the dynamic content is re-generated when the block is
dropped and whenever the headers texts are changed.
[1]: https://github.com/odoo/odoo/commit/e0796020ee0c3188e1e9d9fa077de73a2211c6f7#diff-bee4662b672e30dbfb9778f8747fee45698d9b8d16282d8f80066d8a30137928R35-R50
task-3555325
Part-of: odoo/odoo#138748
*: website_crm, website_event, website_event_track
Before this commit, when accessing the visitor views without having any
event rights, an error was triggered.
This commit restricts the display of the `event_registration_count`
field on the `website_visitor_view_form` restricted to the
`event.group_event_user` group so that its invisible condition does not
fail. Similarly it restricts a visibility condition on
`event_track_wishlisted_count` to the `event.group_event_manager` group.
To avoid encountering the same issue with further extensions of
`_compute_email_phone` on the `website.visitor` model, we make its
fields `compute_sudo=True`, and revert the specific `sudo` that had
been added in [1].
Steps to reproduce:
- install `website_event`
- set Demo user to have no Events right, but be an "Editor and Designer"
for Website
- register to an event as an anonymous user
- access the Visitors page as Demo user
=> An error was produced.
Steps to reproduce (2):
- install `website_event_track`
- set Demo user to have no Events right, but be an "Editor and Designer"
- access the Visitors page as Demo user
=> An error was produced.
[1]: https://github.com/odoo/odoo/commit/5ba09c2cb2bb180cfb1363c352f35bd8cf3b132b
opw-3537849
closesodoo/odoo#139271
X-original-commit: 4cb18fab5e8d14dd9a2dfb5cb3e65b43fab02846
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
This commit modifies the "New Page" dialog so that it displays a list
of page templates to pick from in addition to the possibility to create
a blank page.
task-3381714
Part-of: odoo/odoo#126719
Co-authored-by: stefanorigano (SRI) <sri@odoo.com>
This commit adapts the configurator so that the pages it generates are
composed of the primary templates generated from the manifest by the
previous commit.
task-3381714
Part-of: odoo/odoo#126719
This commit is a preparation for the new page from template feature.
In order to make it possible for new page templates to be customizable
at several levels from themes, it was decided to create several layers
of primary templates.
Those templates are build from the descriptions found in manifest files
under the new `new_page_templates` key.
The same principle is also applied for configurator pages (described in
manifest files under the `snippet_lists` key) because we noticed that
some of the changes that were made in themes for some blocks were not
supposed to impact the "drag'n'drop" version of the block, but only
the version used inside the pages generated by the configurator. (E.g.
connecting shapes between blocks)
The manifest entries now have the following structure:
```py
'snippet_lists': {
'somepagename': ['s_block_name', ...],
},
'new_template_pages': {
'somecategoryname': {
'sometemplatename': ['s_block_name', ...],
},
},
```
This commit finds those entries in the manifests and creates the
following primary templates:
- `s_block_name`: already exists, this is the block that is drag and
dropped using the website builder
- `configurator_s_block_name`: specialization of `s_block_name` used in
all pages generated by the configurator
- `configurator_somepagename_s_block_name`: specialization of
`configurator_s_block_name` for that specific page
- `new_page_template_s_block_name`: specialization of `s_block_name`
used in all new page templates
- `new_page_template_somecategoryname_s_block_name`: specialization of
`new_page_template_s_block_name` used in new page templates of that
specific category
- `new_page_template_somecategoryname_sometemplatename_s_block_name`:
specialization of `new_page_template_somecategoryname_s_block_name` for
that specific template
For the template pages defined in `website` it also creates primary
templates that assemble `t-snippet-call`s of the most specific block
templates. Those templates are named
`new_page_template_sections_somecategoryname_sometemplatename`.
task-3381714
Part-of: odoo/odoo#126719
Since [1] when webp support was introduced, pre-converted images
(resizes and jpgs) are automatically created so that the images can be
used in PDF reports.
This only needed to be done for image fields - which can be referenced
in reports.
This commit limits the pre-conversion of images to images that are set
in image fields.
[1]: https://github.com/odoo/odoo/commit/0449fe85cb0e1d639a4e1aeba26e90906f79254d
task-3510621
closesodoo/odoo#137109
X-original-commit: cd0164339e5179177aaaf21b69615a71a8982da8
Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
This commit replaces the `.jpg`, `.jpeg` or `.png` extension of uploaded
images to `.webp` when the image is converted to webp.
task-3460171
closesodoo/odoo#137022
X-original-commit: 77624c9eafc7f21a2ec5edcd3d56ee76e646fc38
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Steps to reproduce:
- Go to `/blog`.
- Enable "Show Sidebar" in the "Customize" menu.
- Edit the page.
- Click on an icon of the "Follow Us" section of the sidebar.
- Click on the "Link" icon of the editor toolbar.
=> An error popup appears.
In further versions, the link parameters can be edited - but they are
lost upon save.
The social media links sections of the blog and blog post pages is
generated and is not supposed to be editable.
This commits makes these social media links sections non editable.
If a user needs to configure such a content specifically, it can be done
inside the "About Us" section of the sidebar above.
E.g.:
- Deactivate the "Follow Us" section from the "Customize" menu.
- You can use copy/paste to duplicate the existing style of the
"About Us" section if you want.
- Click on the "File / Image" icon of the editor toolbar (or type
"/image" to use the Power Box as of 15.0).
- Select a pictogram.
- Click on the "Shape: Circle" icon of the editor toolbar.
- Select the "Font Color" from the editor toolbar.
- Click on the "Link" icon of the editor toolbar to specify an URL.
opw-3450880
closesodoo/odoo#135980
X-original-commit: 27d8633c73106b7278eda7d07c9fce370d29784a
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Since the website page preview is within an iframe, the selector used to
neutralize some events during edition of blog pages were not targetting
the elements anymore.
This commit makes the elements looked up within the iframe.
opw-3450880
Part-of: odoo/odoo#135980
If leads are created using live chat, users without CRM rights cannot
access the visitors list anymore because the lead/opportunity
information is not available to them.
This commit limits the display of `lead_count` to the
`sales_team.group_sale_salesman` group.
Then, the visitor's form cannot be accessed because the "Lead" smart
button fails to load.
This commit therefore limits the display of the button to that same
`sales_team.group_sale_salesman` group.
In 14.0, the column still appeared without the `lead_count` value
displayed, but clicking on it raised a traceback.
Steps to reproduce:
- Install `website_crm_livechat`
- Login as Mitchell Admin
- Send a message in the live chat
- Go to Discuss
- Answer the livechat message with `/lead New`
- Go to Settings / Users / Marc Demo
- Remove the Sales rights
- Logout
- Login as Marc Demo
- Go to the Website / Reporting / Visitors page
=> The page could not be reached and an access right error message was
generated.
opw-3475301
closesodoo/odoo#135571
X-original-commit: 4f67701f99e4b86cb0a4330a32b455bd6ff4686a
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: Robin Lejeune (role) <role@odoo.com>
Since [1] if the partner related to a visitor belongs to a company that
cannot be accessed by the current user, an error is raised when trying
to display the list of visitors.
This commit makes the name obtained through an additional sudo on the
`partner_id` record which might not be accessible to the current user.
This is equivalent to using the `name` field of visitor, except that
accessing the `partner_id` field will fail if `website.visitor` itself
cannot be accessed.
Steps to reproduce:
- Go to Settings / Companies
- Create a second company
- Go to Website / Reporting / Visitors
- Select "Edwin Hansen"
- Navigate to its linked partner in the contact field
"Gemini Furniture, Edwin Hansen"
- Navigate to its company "Gemini Furniture"
- In the "Sales & Purchase" tab, assign the second company as the
Company
- Save (this creates an error - but it is saved)
- Go to Website / Reporting / Visitors
=> The page was not displayed and an access error message was
displayed.
[1]: https://github.com/odoo/odoo/commit/d348bed1ad9d3d16b295f013f015706be6c07820
opw-3462104
closesodoo/odoo#134190
X-original-commit: a75673217aef2ffaaa93585526dc1e647a270495
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Since [1] images uploaded through the website builder that are neither
GIF nor SVG are converted to the WEBP format by default.
The upload of product extra images does not follow this rule.
Adding the extra images is done through its own specific route instead
of putting the images inside the DOM before the save, it therefore does
not run though the general image tools code.
This commit converts the uploaded product extra images to WEBP before
saving them into the records.
It is achieved by following the same approach as when uploading a WEBP
in the backend [2], before calling the `/shop/product/extra-images` RPC.
The fix is not done by replacing the custom route by an update of the
DOM with the images because a full page rendering from the server is
needed when adding extra images.
Steps to reproduce:
- Edit a product through the website builder
- Add a JPG extra image
- Save the page to leave the website builder
- Check the image content
=> Image was a JPG instead of WEBP.
[1]: https://github.com/odoo/odoo/commit/0449fe85cb0e1d639a4e1aeba26e90906f79254d
[2]: https://github.com/odoo/odoo/commit/40955397658e4bf858e969668079d0c6a4cef43b
task-3460171
closesodoo/odoo#134037
X-original-commit: f970147a2113608d18b47c6f59de6c6338bb2f43
Signed-off-by: Robin Lejeune (role) <role@odoo.com>
Since [1] the line height is specified as an absolute height instead of
a ratio of the font size. This leads to multiline text with big font
sizes to overlap.
This commit removes the `rem` unit from the `body-line-height` primary
SCSS variable.
Steps to reproduce:
- Drop a text snippet.
- Select a paragraph.
- Change font size to 62.
=> Lines of paragraph did overlap.
In case the value had been edited before this fix, it will be shown
with the "rem" text within the option, which can be removed to update
the value to the correct behavior.
[1]: https://github.com/odoo/odoo/commit/388e4bb2bfcaebdd4ff30277fb49a034592d7086
task-3471117
closesodoo/odoo#133401
X-original-commit: a368dad33d128c95262053769e3f5de852d2be3a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Since [1] form fields cannot be moved outside of their form and since
[2] table of contents cannot be nested within another table of content.
Those were implemented with specific references to website classes
within web_editor.
This commit introduces declarative mechanisms for both situations:
- `data-drop-lock-within`: prevents dropping outside the closest parent
that matches the specified selector.
- `data-drop-exclude-ancestor`: disallows dropping within a parent that
matches the specified selector.
[1]: https://github.com/odoo/odoo/commit/638d0e875dcb05191fe833d2f889235891dfb46a
[2]: https://github.com/odoo/odoo/commit/55339cd6a7b7916184893c0fe27b5483683a047a
task-3131384
closesodoo/odoo#130477
Signed-off-by: Guillaume Dieleman (gdi) <gdi@odoo.com>
*: web_tour, website
When no transformation is applied on an image, changing the quality
sometimes increases its storage size.
This commit makes sure that the original image remains used if only the
image quality is modified and if this makes its storage size bigger.
Fixes#61619
task-2835144
closesodoo/odoo#103398
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit extracts the calculation of the number of bytes within a
base64 data URL to a method named `getDataURLBinarySize`.
task-2835144
Part-of: odoo/odoo#103398
This commit separates the test that was added together with the "not
move images twice within image wall" fix because it requires additional
fixes for working in 16.0.
task-2990053
closesodoo/odoo#125758
X-original-commit: f4e8ca1eca1193a72a0b1d21cbc4af5093907ca9
Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
*: web_editor
During the masonry layout calculation of the images wall snippet, the
image height is used to determine into which column each image is
inserted. Their height is zero until they are actually loaded. Because
of this, the column into which an image is inserted can be wrong.
This becomes more obvious in 16.0 because since [1] the image selection
is lost when moving it within an Image Wall because it is replaced by a
clone when using masonry mode.
This commit makes sure that the images are loaded before taking their
height into account when building the masonry layout.
This involves two changes:
1. By awaiting `wUtils.onceAllImagesLoaded(this.$target)` after the
insertion of each cloned image, we are sure that the reached height of
each column is available before deciding where to insert the next image.
2. Before re-selecting the previously selected image, we need to be
sure that it is loaded. Therefore we keep track of the last masonry
layout operation and await for it. This way, we rely on the await of
the last image as described in point 1.
Additionally, as of 16.0, there is a race condition with
`snippet_option_update`: in some situations, `notify` is called before
`snippet_option_update` is completed, and before the masonry layout is
applied. To make sure it is completed, the whole notify is run within
the mutex through a `snippet_edition_request` event.
To uphold the stable policy, making `mode` async will only be done in
master.
In stable, a new `_modeWithImageWait` is added which is called only
for the situations that causing an issue, and which enables the fix
of the masonry layout.
In 14.0, it is used when computing the layout from `start` and
`addImages`.
In 16.0, it is also used in `notify` when images are removed or moved
around - because masonry clones the images.
In master, it is always applied.
Steps to reproduce:
- Drop an Images Wall.
- Add four images, the first one being taller than the others.
=> The fourth image sometimes appeared below the tall image.
[1]: https://github.com/odoo/odoo/commit/0d43aec24baad6420e0fe150a9c19d33c0b74198
task-2990053
X-original-commit: 9605d9ba7b26885d66e861e0e5c7dff7489031f9
Part-of: odoo/odoo#125758
Since [1] the "Images Add/Remove All" buttons are on top of the
background options in order to appear as the first option for the
"Image Wall" snippet.
This makes the JS related to the handling of the options of that
snippet created twice: once for the buttons above and once for the
options below.
Because of this, events are registered by both instances and they both
get notified on option update. Therefore, when an image is moved, it is
moved twice instead of once.
This commit differentiates both instances, and makes the one that
handles the "Add" and "Remove All" buttons be the only one that works on
the images.
In stable the differentiation is done with conditional statements.
In master the instances should be of distinct classes.
Steps to reproduce:
- Drop an "Images Wall" block.
- Switch the "Mode" option to "Grid" instead of "Masonry".
- Select the wine glass image in the third column.
- Click on "Move to previous".
=> The wine glass image ended up in the first column because it was
moved twice.
This commit also fixes a typo in the `reoder_items` name introduced
by [2].
[1]: https://github.com/odoo/odoo/commit/b6494fcf284edcddaa36b5fcfd407a6d7186fbd7
[2]: https://github.com/odoo/odoo/commit/e8713dc078b5c1799917f238a4c32b4289aceb8a
task-2990053
X-original-commit: f8724b55162b2550734dbe6e0454c406d6e4241c
Part-of: odoo/odoo#125758
Inside the Images Wall snippet, images are dispatched to columns
depending on the height already reached by each column. This computation
relies on a sub-pixel height which leads to a confusing behavior.
This commit rounds the sub-pixel height to a visible pixel height to
avoid the confusion.
Steps to reproduce:
In the default images of the Images Wall snippet, the third image (sign)
is one pixel taller than the other ones.
- Drop an Images Wall snippet.
- Select the "sign" image.
- Move it to the first position.
(Because of another bug involving a race condition with the loading of
images, you might observe a different behavior. Move to first position
again to recompute the layout several times.)
=> The compass image moved to the first column.
task-2990053
X-original-commit: d0c15abd17e151a8861cc950116b11111d694bb3
Part-of: odoo/odoo#125758
When using the previous button in an image wall, the image wraps around
but skips the last position.
When using the next button in an image wall, the image does not wrap
around.
This commit fixes this inconsistency by using the same behavior as the
one in 15.0 since [1]: wrap through all positions in both directions.
Steps to reproduce:
- Drop an "Images Wall" snippet.
- Add 6 images.
- Select an image.
- Click repeatedly on "Move to previous".
=> The image wraps around all positions except the last one.
- Click repeatedly on "Move to next".
=> The image does not move anymore once it reached the last position.
[1]: https://github.com/odoo/odoo/commit/3931f0a67f904daea6c891a3a80aa984760a7682
task-2990053
X-original-commit: 054f480376e8d08d1582cedd6caec6455be828e2
Part-of: odoo/odoo#125758
Colors of headings are inherited between levels. (E.g. if no color is
defined for `<h4>`, it uses the color of `<h3>`)
This commit changes it so that all levels only inherit from `<h1>`.
task-3140991
closesodoo/odoo#111621
Related: odoo/design-themes#633
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
*: web_editor, website_mass_mailing
Because the shape is now also part of the theme options for primary and
secondary button, it does not make sense to select it when the button
is either primary or secondary.
This commit makes the Shape option shown only for Custom buttons, and
therefore also nests it under the Style option.
task-3140991
Part-of: odoo/odoo#111621
Before this commit, when a heading font was selected, it was not
possible to deselect it (so that the H1 font gets applied again).
After this commit, the font selector has an extra "Reset" button to
restore the default state if it has a specified value.
task-3140991
Part-of: odoo/odoo#111621
Before this commit, customizing the theme option's background image or a
theme option's button style required several RPCs and refreshes of the
assets bundle.
After this commit those options are updated through a single RPC call
and a single refresh of the assets bundle.
task-3140991
Part-of: odoo/odoo#111621
This commit reorganizes the theme options to make them easier to find.
It also adds the following options:
- 'Font size' for each of the six headings
- 'Font (family)' for each of the six headings
- 'Margins' (top & bottom) for paragraph & the 6 headings
- 'Line Height' for paragraph & the 6 headings
- Harmonize buttons options with the custom button ones
task-3140991
Part-of: odoo/odoo#111621
This commit introduces the computation of the image size from a webp
binary source without relying on PIL.
This is needed by eCommerce to determine which image to fetch when using
the zoom functionality on the product page.
task-2774352
Part-of: odoo/odoo#85494
Since [1] dropped images are saved as attachments.
When such an image is a WEBP, its pre-computed resizes and conversions
to jpeg are not generated.
This commit adds the behavior of saving an `o_modified_image_to_save`
when a `o_b64_image_to_save` is a WEBP.
[1]: https://github.com/odoo/odoo/commit/3bbce756c69a206d07abd31059f0392c26b36096
task-2774352
Part-of: odoo/odoo#85494
`libwebp` cannot be used to perform resize operations on webp images on
the server.
This commit uploads all resizes of webp images whenever a webp image is
uploaded:
- resized to any smaller size in 1024, 512, 256 & 128,
- each size converted to jpg as well to be usable in `wkhtmltopdf`.
When an Image field requires `_imageProcessing` to resize a webp image,
it retrieves the pre-resized image instead of running through the
Pillow toolbox.
Pre-converted images are stored as `ir.attachment`s with:
- `res_model` = ir.attachment
- `res_id` = id of transformed attachment
i.e. id of original size webp for resized images
id of webp for jpeg-converted images
- `description` = "format: image/jpeg" for jpeg conversions,
"resize: [size]" for resized images.
task-2774352
Part-of: odoo/odoo#85494
Wkhtmltopdf is unable to render WebP images.
This commit intercepts the requests for the image data during PDF
reports rendering to replace them by the converted image that was
uploaded with it.
task-2774352
Part-of: odoo/odoo#85494
The library used to generate PDFs does not support the WEBP image
format. For those images to be included in reports, they need to be
converted. For security reasons, this conversion cannot be done on the
server, therefore it was decided to keep an already converted copy of
such images.
This commit converts uploaded WEBP images to JPEG and uploads them both
so that the report generation can use the JPEG instead.
This commit also pre-generates the resized version of images - and JPEG
versions of each of them.
task-2774352
Part-of: odoo/odoo#85494
The library used to generate PDFs does not support the WEBP image
format. For those images to be included in reports, they need to be
converted. For security reasons, this conversion cannot be done on the
server, therefore it was decided to keep an already converted copy of
such images.
This commit converts uploaded WEBP images to JPEG and uploads them both
so that the report generation can use the JPEG instead.
task-2774352
Part-of: odoo/odoo#85494
Before this commit two options of images are named "Width":
- the one that adjusts the image resolution
- the one that changes the `width` CSS property
This commit makes the following changes:
- the option about the image resolution is renamed to "Format"
- the "Format" option combines the image resolution and the file format
- an option item gives access to the initially uploaded file format and
resolution
- for all sizes the image format is set to `image/webp`
- for the uploaded size, an `image/webp` version of it is available too
- upon upload, the default selection is an `image/webp` version of the
image
task-2774352
Part-of: odoo/odoo#85494
*: mail, mrp, test_website, web, web_editor
Before this commit '.webp' images could not be used in odoo.
After this commit '.webp' images can be uploaded to odoo.
- can be used in image field
- can be used in HTML field image
- can be used in mails and website
- can be transformed (shape mask, filter effect, crop, rotate, resize,
adjust quality)
task-2774352
Part-of: odoo/odoo#85494
Since the edited website pages are inside an iframe, the options panel
cannot base its display on the CSS rules of the page. When changing the
theme colors, only the edited page's CSS is reloaded, not the option
one. Because of this, the background shapes are displayed using an
obsolete color palette inside the options panel.
This causes colors to be forced on background shapes within the iframe
because their default colors do not match the ones inside the options
panel when different theme colors are set. Once forced, the colors of
the background shapes within the content do not follow the theme
palette changes anymore.
This commit forces the background shapes displayed in the options panel
to use the current palette.
This is done by recovering the current edited page's shape background
images from the CSS rules. This approach was chosen as opposed to
adding a `d-none` version of the shape `div` to the edited page and
getting the background image from its computed style.
This fixes the color comparison between the background shapes of the
content and the ones of the options panel, thus not forcing colors if
the theme colors are used.
Steps to reproduce:
- Edit a website page.
- Drop a "Banner" block.
- Enable background shapes.
- Go to the theme tab.
- Select a different theme color palette.
- Select the "Banner" block.
- Open the "Shape" option's menu.
=> The shapes were displayed with the old color palette and if selected
were applied with the old color palette.
Additionally, to avoid a race condition when leaving a theme color
picker by either clicking on the BLOCKS tab or re-selecting the
snippet with a shape, a re-rendering of the existing snippet editors
is requested and the shape cache is invalidated if the palette has
changed in the meantime.
task-3370939
closesodoo/odoo#127951
X-original-commit: c511e100cad2febc0ebb9ce61b5eb52232e60f7d
Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
When an HTML field is empty and no block can be dropped inside it, it
is very difficult to locate or even notice.
This commit adds a placeholder text inside sanitized HTML fields.
Steps to reproduce:
- Install website_crm_partner_assign.
- Go to a contact without website description.
- Go to its website page.
- Edit page.
=> The `partner.website_description` field is difficult to locate.
task-3293600
closesodoo/odoo#120588
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
*: web_editor
When an HTML field sanitizes its attributes, it can still be filled with
HTML content (blocks, styling, power box commands) using the website
builder. This causes problems because those elements can then be broken
by the sanitizing.
It is possible to break elements so badly that the page cannot be
edited anymore to fix the problem.
This commit prevents the user from dropping snippet blocks inside the
content of such fields.
Steps to reproduce:
(Unless `slide.slide`'s `description` becomes
`sanitize_attributes=False` in the meantime.)
- Edit a single Course's slide.
- Drop a Carousel into the description field at the bottom.
- Save.
=> Carousel did not work.
Worse:
- Instead of the Carousel, drop a Countdown.
=> An error happens on each page reload, and the edit mode cannot be
reached anymore.
task-3293600
Part-of: odoo/odoo#120588
Since [1] the `website_text_edition` tour fails because it manages to
change tab, drop a block, select a paragraph and click on a button
before the bundle reload happens.
This commit makes sure `updateOptionsUI` is awaited and that any
subsequent call is only queued afterwards.
task-3370939
[1]: https://github.com/odoo/odoo/commit/c511e100cad2febc0ebb9ce61b5eb52232e60f7dclosesodoo/odoo#129855
X-original-commit: 81abdb96aeb95e492230d39000e28c0d239840de
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
The unsplash beacon public widget is started before the test assets JS
is loaded. Because of this, the approach in [1] fails sporadically.
If the result from the `/web_unsplash/get_app_id` RPC is obtained
before the test assets JS is loaded, the beacon patch is not applied
in time, and the test fails.
This commit applies the patch within the actual page HTML to avoid this
issue.
[1]: https://github.com/odoo/odoo/commit/a5abc766424f34074be3ae7a97ad7c6e9583f9c5
runbot-22610
closesodoo/odoo#127809
X-original-commit: 3f64135ff136addfad7c4c79e8c19cc33f8b19cf
Signed-off-by: Guillaume Dieleman (gdi) <gdi@odoo.com>
Since [1] the page manager tour test fails from time to time because it
manages to click on the Delete Page popup's OK button before it is
enabled.
This commit makes sure it only clicks on the button once it is enabled.
This commit also includes the master version cleanup of [1].
[1]: https://github.com/odoo/odoo/commit/a65d8811119f4d1a044be3e140fd0c27ad1cf823
runbot-20823
runbot-23032
closesodoo/odoo#127614
X-original-commit: 668fc8fa6f56b8eda9c81300a818da2559c0d0dd
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
When a URL is entered to add an attachment through the media dialog
a URL attachment is created. If the source material is removed the
attachment will not be reachable anymore.
This commit fetches the data and adds it as an uploaded file when
adding a URL image in website.
If the image binary cannot be fetched by the client (e.g. CORS), the
old approach is used instead.
This commit also adapts test tours which relied on the image's `src` to
verify if the entered URL had been taken into account by making them
rely on the image's `data-original-src` instead.
task-3129360
closesodoo/odoo#118877
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
The `PageDependencies` obtains the page dependencies from the server
during its `onWillStart`. If the parent component state changes before
the component is mounted, Owl destroys and creates a new one.
This is the case if the server response is not obtained before the
value of the URL field is modified again.
Because of this, if the user types quickly in the URL field, an RPC
is sent for each key press.
This commit obtains the dependencies in a `useEffect` that is run only
once (instead of inside the `onWillStart`), and only after the
component is mounted. It stores them in the `state` so that they are
rendered once they are obtained.
Steps to reproduce:
- Open Website > Site > This page > Properties.
- Type quickly in the URL field.
=> One RPC was sent per key press.
task-3169376
closesodoo/odoo#127125
X-original-commit: a65d8811119f4d1a044be3e140fd0c27ad1cf823
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
*: account, event_booth, gamification, hr, project,
website_event_track, website_hr_recruitment, website_slides
HTML fields that appear in the front-end can be modified using the
website editor. Some of them are sanitized in a way that breaks the
behavior of snippets that can be dropped within them.
This commit adapts the sanitization of those HTML fields so that the
snippets behave as expected.
opw-3267589
closesodoo/odoo#126708
X-original-commit: 7fd28afaf3e45cafbef80b69aa45c58b31fb3de6
Related: odoo/enterprise#43311
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
This commit ensures that the unsplash beacon calls home when an unsplash
image appears on a page.
To achieve this it patches the RPC call when the test URL contains the
test name as parameter. The patch cancels the actual beacon call to
avoid polluting data during the test, but marks the image as having had
its beacon message sent. The test then simply checks if this marker
appears on the image.
task-3360109
closesodoo/odoo#126522
X-original-commit: 1b0f25130b461e7b531548363c680200c7363e7f
Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Since [1] an error is raised when switching the Mode of an Images Wall
from Float to Grid or Masonry while an image is selected.
The display of the size of the image is being updated while its option
panel is not there anymore.
This commit prevents this error from happening by setting up the grid
layout with clones of the images instead of the images themselves.
This leads to the construction of a new editor for the new image.
Steps to reproduce:
- Drop an Images Wall snippet.
- Switch Mode to Float.
- Select an image.
- Switch Mode to Grid.
=> Traceback.
[1]: https://github.com/odoo/odoo/commit/2cbb691a84ce186ddd34a2a4c76d95671ed6e834
task-2990053
closesodoo/odoo#125436
X-original-commit: c532bc6c3b861a68e8381f39efaa22201ae253cb
Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
When the browser is zoomed, the value of the `border-width` CSS
properties obtained through `getComputedStyle` are impacted by the
zoom. Because of this, entering a "10px" border in a Chrome zoomed at
125% turns it into "9.6px" when leaving the input field.
This commit neutralizes the zoom effect by rounding the value up.
The rounding operation was empirically determined by observing values,
see table below.
When zoomed out this does not always work: e.g. at 50% zoom, a value
of 11px becomes 10px. But zooming out is an unxpected use case, that
situation is therefore not handled by this fix.
Observed values of the border-width property:
Set value => `getComputedStyle`
```
Value Chrome 125% Firefox 120%
1px 0.8px 0.83333px
2px 1.6px 1.66667px
3px 2.4px 2.50000px
4px 4.0px 3.33333px
5px 4.8px 5.00000px
6px 5.6px 5.83333px
7px 6.4px 6.66667px
8px 8.0px 7.50000px
9px 8.8px 8.33333px
10px 9.6px 10.00000px
11px 10.4px 10.83333px
12px 12.0px 11.66667px
```
Steps to reproduce:
- Drop a "Text - Image" block.
- Select the text column.
- Zoom with ctrl+mouse wheel or ctrl-plus.
- Set a 10px border.
- Leave input field.
=> Border option field displayed a different size.
task-3172235
closesodoo/odoo#125107
X-original-commit: 6398b0c75b9e14b7cecb1526fe5a950101d534ad
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
*: website_sale_stock
When translations are loaded in a front-end page, the language is
initially deduced by the server. The `GET` that obtains them does not
have a language parameter set. Because of this, this initial result is
reused from the browser cache on subsequent page accesses.
This is a problem when the user toggles between languages because the
cached content is reused while it is related to a previously selected
language.
This commit avoids this problem by making the cache specific to the
current front-end language.
Steps to reproduce:
- Make sure "Disable cache" is not enabled in your browser.
- Install website_sale_stock.
- Add the French language and activate it on the first website.
- In the backend, go to a product (e.g. Office Lamp)'s Sales tab.
- Disable "Out-of-Stock: Continue selling".
- Enter an "Out-of-Stock Message" in both English and French.
- Open the product's website page in French.
- Copy the URL.
- Open a new browser private navigation window.
- Go to the copied URL.
- Switch to English.
- Switch to French.
=> The price is first displayed correctly in French with a "," decimal
separator then is replaced by using the English "." decimal separator
and the out-of-stock message is displayed in English.
opw-3293403
opw-3343614
closesodoo/odoo#124907
X-original-commit: a827de6fffedc9d952d0a4e888c7089896bdb44f
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Since [1], navigating from the website application to another one
raises an error when using Firefox.
This commit avoids looking at the URL if the iframe is not available.
It seems that in Firefox the `pagehide` event is triggered after the
iframe is released.
Steps to reproduce:
- Use Firefox.
- Go to the Website app.
- Go to Discuss.
=> An error popup was displayed.
[1]: https://github.com/odoo/odoo/commit/eacfab230b8b6d676f378ad74a402849af83dcbb
task-3302981
opw-3349388
opw-3357461
opw-3357511
closesodoo/odoo#124940
X-original-commit: 57c3ab3058d4e2eee581f5c35a7a9e1b9ac83593
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
When a sub-menu needs to be opened in the navbar, it sometimes gets
nested within the navbar itself, making a vertical scrollbar appear
instead of floating outside the navbar, above the top of the page.
This happens if the navbar was opened in small screen sizes using the
hamburger icon, then, after a rotation, the navbar is turned into its
fully expanded version.
This commit hides the hamburger menu if the collapse toggler becomes
`display: none`.
Steps to reproduce:
- Add a sub-menu nested under the "Home" menu.
- Open the developer tools, enable mobile view.
- Select "Surface Pro 7" (Vertical 912x1368 - use "Rotate" if needed).
- Open the menu with the hamburger icon.
- Click on the "Rotate" button.
- Open the sub-menu by clicking on "Home".
=> The menu was displayed within the navbar causing a vertical scrollbar
to appear.
task-3247552
closesodoo/odoo#124046
X-original-commit: 02603d6e9f98488369ff61d31aa7f47e1bd21e6e
Signed-off-by: Colin Louis (loco) <loco@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
When generating a new page key, it was only made sure to not match
existing page keys. This leads to COW happening on existing views if the
key already existed in a view.
This commit ensures that new page keys are not existing view keys
either.
Steps to reproduce:
- Create a page named "snippets".
=> Notification was shown indicating that `website.snippets` is private.
task-3328827
closesodoo/odoo#123693
X-original-commit: e7ef9f0bfc59a468c9f883561c371367cc06c1b7
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
When the name given when creating a new page starts with a slash, the
werkzeug route `/website/add/<path:path>` cannot be matched. This leads
to wrong navigation situations.
This commit removes any leading slash from the entered page name.
Steps to reproduce:
- Create a page.
- Enter "/abc" as name.
=> A 404 error page was reached.
task-3328827
X-original-commit: 7ff29b680d8552f0b4a440b3209a6a37357af21e
Part-of: odoo/odoo#123693
The build does not break if the `with_context(active_test=False)` is
removed from `ir.asset`'s `_get_related_assets`. This access to inactive
assets is actually needed to be able to disable assets on a specific
website, similarly to what is done for `ir.ui.view`.
This commit adds a test to ensures that this feature is not accidentally
lost.
task-3326887
closesodoo/odoo#123662
X-original-commit: fced70f840c98e29675ff41812e76c1883d1d57f
Signed-off-by: Dieleman Guillaume (gdi) <gdi@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
When leaving the `website` application, the HTML/CSS editor keeps its
open/closed state. Because of this, when returning to the website
preview, the HTML/CSS editor is being mounted immediately if it was
left opened when leaving the `website` application.
This commit closes the HTML/CSS editor upon leaving the website
preview, or navigating to another page.
Steps to reproduce:
- Open HTML/CSS editor.
- Go to the Discuss application.
- Go to the Website application.
=> Error dialog was displayed.
task-3302981
closesodoo/odoo#123661
X-original-commit: 45fd54f15689e2a749666059f9d2b99aa80f6c88
Signed-off-by: Bojabza Soukéina (sobo) <sobo@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
With some fonts (e.g. Roboto), the placeholder inside the "Custom
Amount" button of the Donation snippet does not fit within the button.
This commit adjusts the maximum width of the button to make it fit
according to the used font and the placeholder text.
The width has to be set from JavaScript because the same issue
arises with different length of translations of the placeholder.
Steps to reproduce:
- Drop a Donation snippet.
- Increase the button text size (change button font, change large
button font size...)
=> Text is not fully drawn inside custom button.
opw-3283549
closesodoo/odoo#123443
X-original-commit: 1ff46591fb8a28d747ea89e711849c079d993ab6
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Edition of block links has been broken several times.
This commit adds a test that makes sure it does not happen again by
changing the URL of a card of a mega menu with the Cards template.
task-3300977
closesodoo/odoo#121362
X-original-commit: b4b5816a4acd953eb4dabfd14d2a142934dee357
Signed-off-by: Vray Benjamin (bvr) <bvr@odoo.com>
[1] mistakenly removed the variable used by the mechanism that was
introduced in [2] to avoid updating link content.
This commit uses the link's `needLabel` instead to achieve the same
goal.
Steps to reproduce:
- Add a mega menu.
- Set the mega menu template to Cards.
- Click on the text of a card.
- DO NOT click on the edit link icon in the popover.
- Click on the href field in the options panel.
- Change the value.
=> Links content was broken (image was removed and texts were grouped).
[1]: https://github.com/odoo/odoo/commit/75166dbcd4962f30624fe19829757acbf8e76022
[2]: https://github.com/odoo/odoo/commit/7a0e58f8d7237514d23d815cdf3d81fc79edb1ec
task-3300977
X-original-commit: 1dbcf2825b2d495c206e110a39efe620e646e7c4
Part-of: odoo/odoo#121362
*: base, web_editor
The Many2oneUserValueWidget does not allow the user to reset it
to blank if it already contains a selection. This commit makes it
possible to select an empty value by specifying a `null_text` option.
task-2406626
Part-of: odoo/odoo#67913