When the edit mode is entered, some elements receive
data-editor-message attributes. These were not removed on save which
could in some cases make the attributes be saved in the database. For
this to happen it would require an `.oe_structure.oe_empty` element to
be put *inside* an editable element (instead of being the one which is
editable). In that case the `.oe_structure` content would be saved in an
inheriting view but the parent view would also be COW'd for no reason
because of that attribute.
Difficult to say if such a case exist in the current views but as it
technically possible and that some of our tests use that configuration,
it is worth fixing.
Note: this fix was in fact done in the new editor in master and allowed
to detect that one of our test was not testing a feature correctly
because of that. This will be adapted in a different commit of this PR.
closesodoo/odoo#30834
Commit https://github.com/odoo/odoo/commit/29075a8e2c734624cec4f6009185616634f70dea
was written while there was an incorrect behavior related to
multi-website, oe_structure_ID and edit mode in a rare specific case
(see the second commit from this PR for detailed explanation
https://github.com/odoo/odoo/pull/30834).
That rare case was detected in 12.0 since the tour did not work on
master with the new editor (that fixed the incorrect behavior).
Basically, it was COWing the edited view even if only an oe_structure_ID
was touched.
Indeed, when saving a specific view in the HTML editor, we should also
search for its possible new ID as it could change if we also edited its
generic parent. In that case, the view will be copied and then unlinked
to preserve inherit order on the new specific tree.
Before this commit:
1. If we were editing a template with no xml_id, typically the case when
editing a specific view (COW'd), the 'Template ID' label would be left empty
as the view does not have an xml_id but only a key.
2. If we were editing a generic view, the template would be COW'd and replaced
by the specific one created during the save.
After the save, the page would be reload and will try to reopen the edited
template (stored in url `res=123`). But as this template would be replaced
by the COW'd view, the JS would crash trying to access an inexisting view.
The HTML editor would then open in a very thin modal, barely editable.
Now:
1. Display the template's key instead of its xml_id. The key is basically a
duplicate of the xml_id, mainly used in website.
2. If we are saving a generic view, we search for its newly created specific
view to upload the URL hash before reloading.
task-1934279
Fix#30447
With the following view hierarchy:
A
|
B' (oe_structure_ID view)
Before this fix, when saving multiple templates at once from the same hierarchy
the COW views (website) would not be saved correctly as the first call to
`write` would COW the parent view, then the second concurent call to `write`
would create the child specific view under the generic parent view.
Instead, the generic parent should have been cloned to a specific parent view
and then the child view should be COW under the specific parent.
A A'
| |
B' B*' (This one is the old B', without B' changes in the html editor)
Instead of
A A'
|
B'
Calling the `write` one after another will do the trick. Indeed, when the
second call is fired, the first call has already triggered the COW behavior.
Thus, the second call correctly retrieves the COW view.
Another issue might still appear, if the parent view write is sent first.
Indeed, the parent view will be COW, thus the specific child view (second write
waiting to be fired) will be deleted to be added on the new specific hierarchy.
Thus, that write will then raise an error since the view does not exist anymore.
task-1934279
Fix#30447
On mobile the frontend menu navbar is an hamburger menu that open on
click.
If the option "Customize > Main layout | Affix Top Menu" is
enabled, there is two menu:
- one at the full top of the page
- one affixed to the top of the viewport (only shown if we are at least
scrolling 300px away from the top of the page)
But there is a side effect: when scrolling if the menu at the top of the
page is opened, it will be automatically closed => this makes sense to
avoid having two menu shown on the same page but is an odd behavior.
With this commit, the behavior is changed and when the menu is opened in
the top, the affixed menu is not shown (it only works if the top page
menu has no opened dropdown).
opw-1920310
closes#30564
- Fix the position of 'Add to menu' toggle button in new page dialog
- Properly align tip icon in the welcome message
task-1895287
closesodoo/odoo#29403
In the 'banner' snippet, there is a column using a white jumbotron
component. Those comes with a default background color so when using the
website builder to remove the white background, it did not go away;
it was replaced with the default background color (some gray).
This commit sets the default background color of jumbotron components to
'transparent'.
task-1889341
closesodoo/odoo#30099
Since 12.0, some modal footer button order were changed. The primary button
would not be the one in the modal footer corner.
This is against bootstrap but more annoyingly, users are intuitively clicking
on the secondary button, ending up closing the modal and losing form
information they entered.
This commit simply fix the regression from 12.0 as before 12.0 these buttons
were positionned correctly.
Note that a commit in master (saas-12.2) will fix all the other ones that were
wrongly positionned before 12.0.
Step to reproduce:
- Go to an event having the possibility to register.
- Click on 'Register Now', a modal is shown to write details (name, email..)
- You intuitively click on 'Cancel' as it is the bottom right button
|________________________________ CONFIRM _ CANCEL _|
- The modal is closed, if you try to open it again your infos are lost
Closes#29884
task-1922120
When there is a website with traduction (for exemple, Spanish and
French). In the Spanish website, at the SEO menu, you can add keywords
using any of the languages (Spanish or French), but these keywords are
only added to the Spanish website.
To avoid misunderstanding between the website language and the keyword
language a tooltip is added.
closesodoo/odoo#29683
Lang / Context is implicitely added in the query using this._rpc
Before this commit if you set the title 'Title 1' for your website in the main
langage and after edit the title as "Title 2" in another language, it was the
main title that was replaced instead of the translation.
Now we use this._rpc that bind automatically the context and so the current lang
that we are editing.
closesodoo/odoo#29596
* web
This commit introduces helpers for async handlers, especially for button
clicks. Those helpers are now used automatically for website widgets
(animations) if the 'async' word is placed in front of a handler name
in the `events` key definition.
* web_editor
When an user saves its website, all the animations are destroyed so that
a clean DOM is saved. This is particularly important for snippets like
the latest post one that would crash the page if not cleaned before
saving.
Two cases were found where animations were not cleaned before saving and
this is what this commit fixes:
- When an user used the undo/redo system, all animations were lost as
the DOM is recreated.
- When an user duplicated a snippet, animations were not restarted on
the cloned element.
closesodoo/odoo#29159
Completes https://github.com/odoo/odoo/pull/27981
- Correct `col-*-offset-*` support.
- Compatibility for BS3-deprecated `visible-*` classes (only not taking
care of table/table-row/table-cell cases as difficult with sass and
those classes were already BS3 deprecated anyway).
- Correct order for BS3 `visible-*-*` and `hidden-*` classes (otherwise
their combination are not correctly working). Also, the 'inline'
version was forgotten by previous PR.
- Compatibility for BS3 `btn-xs` class.
closesodoo/odoo#28842
On save, the editor will ask to parent widgets if something needs to be
done first. The website navbar will receive that demand and asks to its
action-capable components to do something. For example, the content menu
handles page-related options saving. However, some users with limited
access rights do not have the content menu... but the website navbar
expects that the save action is performed. So, this empty action is
defined here so that all users have an 'on_save' related action.
This was only happening since 12.0 as 'on_save' actions were introduced
there to save page-related options.
closesodoo/odoo#28810
The previous code made sure we wait for images to be fully loaded before
initializing the auto more menu. But in some cases, it is not enough, we
also have to wait for fonts or even extra scripts. Those will have no
impact on the feature in most cases though, so we will only update the
auto more menu at that time, not wait for it to initialize the feature.
closesodoo/odoo#28684
* web_editor
- Restore the preservation of Odoo text-muted color (the rule became
!important with BS4 and had thus to become !important in the
preservation mixin).
- Preserve base design in the "new content" menu (which now uses
text-muted). Indeed, in some themes, the "new content" links were not
even visible anymore.
closesodoo/odoo#28666
Steps to reproduce the bug:
- Go to Website > Dashboard > Analytics and click on "Link my analytics account"
- Enter some data and save
Bug:
A traceback was raised: TypeError: website_set_ga_data() missing 1 required
positional argument: 'website_id'
opw:1905874
closesodoo/odoo#28636
This commit adds a compatibility file which can be added on demand by
enabling its associated view. This will basically map old BS3 classes
and structures to the related style with BS4.
closesodoo/odoo#27981
When opening the customize menu as soon as the page became visible, an
RPC crashed and the toggable options did not appear anymore. This
happened:
1) DOM is ready.
2) The user click on the menu.
3) At the same time, the customize menu is initialized (`attachTo`),
its event handlers are bound and the async `willStart` method is
called.
4) The event handler for the user click is called... and crashes as
requires a variable which would have been set in the `start` method.
The bug did not appear in previous versions as the handler was not using
the standard system and bound the event handler "by hand" in the `start`
method.
Maybe `attachTo` should not bind event handlers before the `willStart`
method is completed; this would be a subject for the master branch. This
commit solves the problem by setting the required variable in the
`willStart` method instead of the `start` method.
closesodoo/odoo#28578
Before this commit, RTL on frontend was only enabled for connected user.
To have RTL, we add the direction on the element, and the RTL version of
the stylesheet for the applicable languages are generated thanks to rtlcss.
opw-1892757
closes#28434
* web, web_editor
The logic which chose if the user text color was supposed to be used as
bootstrap "dark" text color or bootstrap "light" text color
(https://github.com/odoo/odoo/commit/8b2dbd1441d6713d9072db03e8d3cb6c2246410f)
was fine when using the default theme with default bootstrap but was not
working as intended in some themes.
This commit also introduces a more accurate and complex method to
determine the correct contrasted color in most cases.
closesodoo/odoo#28468
Some code is in charge of setting the same min-height for all items of
a carousel to the natural height of the tallest item, once the page is
loaded. This code was not working correctly in the case the natural
height of this tallest item depends on the height of one of its inner
image, as we have to wait for the image to be loaded in that case.
closesodoo/odoo#28159
This commit fixes a bug introduced with https://github.com/odoo/odoo/pull/28251:
When opening the ace editor on page load thanks to the #ace-view-editor
URL hash, a JS error occurred preventing the editor to open.
This was due to the way actions were executed on page loading:
- Menu elements are initialized and can handle actions
- On initialization, the ace menu tried to launch the editor
- First, it asked that all widgets are closed (see mentioned PR)
- The website handled that action demand by asking everyone to close
their widget
- The 'new content' menu tried... and failed as referenced a variable
which would only have been created in the start method.
Conclusion: before handling actions, all action-capable widgets should
be started. This is what this commit does: when receiving an action
demand, we first wait for the action handler to be fully started. This
implied another change: before, many menus were waiting for the result
of an action to notify that their start method is finished... this
would cause a deadlock in the new system so those were removed, this did
not make much sense anyway (if the result of that starting action has to
be known, a dedicated event/method should handle that).
closesodoo/odoo#28364
- The affix navbar went over the ace editor, preventing to save/close
- The ace editor went always under the new content menu
Now:
- The affix navbar is always under the ace editor
- The ace editor closes when the new content menu opens
- The new content menu closes when the ace editor opens
closesodoo/odoo#28251
When updating to BS4, the datetimepicker library was updated to
tempusdominus.js.
It expects the DOM to be slightly different to apply correctly.
opw 1896103
closesodoo/odoo#28073
* website
Default web_editor/website colors and other bootstrap related variables
took precedence over some bootswatch overriddes. While we have the
control with Odoo themes, theme bootswatch is a library we do not want
to modify. This commit removes the web_editor and website customizations
when bootswatch is installed.
Closes https://github.com/odoo/odoo/issues/27821closesodoo/odoo#27855
The animation that made all the carousel items have the same height
automatically was broken. This commit fixes it and improves its behavior
during edition.
closesodoo/odoo#27801
In website dashboard, 'DateRangeButtons' are pushed into control panel's
SearchView and breaks the UI in small devices.
This commit fixes the issue by hiding them in small devices.
task-1884038
closesodoo/odoo#27082
Before this commit, if the user chose a light color for the text (with
a dark color for the body for example), that color was also used for the
automatic "dark" color, leaving the "light" color to the default $white.
That means that when a light snippet background was set, the automatic
color which was used was the light color the user chose. We want to
invert the system in that case: use the user color as the "light" color
to use over dark backgrounds and leave the "dark" color to the default
$gray-900. This is what this commit does.
Before this commit, the nav-tabs IDs/urls/... were the same when that
snippet was added multiple times or duplicated. Now, the IDs are
recomputed everytime a new .nav-tabs appears.
* web_editor, website
Add an opacity slider and an opacity input to control opacity over
the chosen color.
task-1887571
Closes https://github.com/odoo/odoo/pull/27289
* web_editor, website_blog, website_crm_partner_assign, website_links,
website_livechat, website_mail_channel, website_mass_mailing,
website_slides
Calling a model's method thanks to an RPC will now always send the
web_editor context automatically, making sure the method gets the
website_id all the time, removing the need to guess the current website
(now the get_current_website method uses the context website_id if any).
Note: other routes already have the website_id via request.env.context
if they correctly set website=True (this commit also adds website=True
for scss files customization routes).
Previous system was strange: you were able to choose a body color but
not a body background when you were in full layout mode.
As transparent colors will soon be able to be chosen by the user, it
makes even more sense to give that possibility as the user can set a
body background pattern and a transparent footer color to let it
appear. Choosing a transparent background image which will be mixed with
the body color is also a common feature.
Also changes boxed layout option to use a white background for the boxed
content (we should maybe give the opportunity to the user to choose that
color instead of using always white).