RATIONALE
Improve usage of composer in comment or email mode: support batch-posting in
comment, support more configuration from templates, improve global model.
SPECIFICATIONS
Support a real res_ids field on mail.compose.message model. Instead of relying
on active_ids from context, store it once for all at composer level and use
it in code. Active_ids usage is still done at default_get level, using it to
populate the field.
Improve usage of domain, renamed to res_domain to match other document related
fields naming. Add support of a res_domain_user_id field allowing to set the
user from which the domain should be evaluated.
Composer now runs on a list of IDs. Mass mail mode and comment mode are now
distinct from running on a singleton or on more records. Rendered or raw
mode is not triggered by
* mass mailing mode: always display raw mode, whatever the number of records;
* comment mode: display rendered mode when having a single record (like the
previous comment mode). Display raw mode when having either no records
either at least two records.
Task-3035101 (Mail: Support batch-posting from composer)
Part-of: odoo/odoo#99482
Purpose of this commit is to avoid html entities in logged message by correctly
managing enclosures. For that purpose a new tool 'nl2br_enclose' is added that
eases Markup management on top of 'nl2br' simple tool.
Task-2710804 (Mail: Clean MailThread Posting API)
Part-of: odoo/odoo#99482
In website(_sale) messages are created from website forms. However those
are technical models, you should always use the MailThread API notably to
ensure values coherency. In our case using message_log seems to be what
original committers wanted to do (even creating a message as a comment
which has no effect as the notification process is not called that way).
Task-2710804 (Mail: Clean MailThread Posting API)
Part-of: odoo/odoo#99482
* = digest, hw_posbox_homepage, im_livechat, mass_mailing, web_editor,
website, website_slides_forum
Since the migration of Bootstrap 5 [1], some CSS rules was automatically
converted (`border-left` and `border-right`) when it shouldn't be.
These conversions were made because the CSS rules was embedded in
HTML/XML code and the REGEX for the conversion had no protection for
these cases.
This commit restores the old correct value.
Ref:
[1] odoo/odoo@1fcd098af5closesodoo/odoo#110141
X-original-commit: 0cbf7c00ecc307fc725da345415647828e771bb4
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
When overriding an existing controller route, developers can
easily c/p the route definition and call super() in the overridden method
when the route attributes are automatically deducted by odoo from the parent route.
Removing those redefined attributes simplifies the routes definition,
clearly highlighting what's changed by the override.
Also reduces unexpected behavior when modifying the base route without
noticing/considering the redefined attributes in a overridden route,
which overrides the changes made to the base route when the sub-module is installed.
This commit adds a test to catch routes attributes redefinition, and clean existing routes.
closesodoo/odoo#108512
Related: odoo/enterprise#35176
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Since it's first implementation at [1], a new cursor is created to then
build a new environment after the website's `authenticate` overide with
the new `uid` of the logged in user.
Since the new visitor SQL upsert refactoring done at [2], it seems to be
introducing a SQL deadlock sometimes.
It has been detected on odoo.com while monitoring the logs. Despite
being quite rare, it still happens too often due to our heavy trafic.
Step to reproduce (among others):
- Install website_livechat
- Login as admin on 127.0.0.1
- On 127.0.0.2, load the website
- Open the livechat
- Type something in the discussion
- Directly try to login as admin
- It will load for a certain time then crash on a 502 timeout due to the
SQL deadlock
- You may need to repeat the process to actually face the bug
[1]: https://github.com/odoo/odoo/commit/6bec0e4d29e6b33b74962b2893a7a405667ef58c
[2]: https://github.com/odoo/odoo/commit/d348bed1ad9d3d16b295f013f015706be6c07820closesodoo/odoo#109830
X-original-commit: b241cf7de9329af1410b9dd45b161aa41926effb
Signed-off-by: Olivier Dony (odo) <odo@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This basically reverts [1].
After discussion with the related team, [1]'s purpose was to prevent
merging two links together if backspace was hit at the beginning of one
mega menu item. [1] however made mega menu creation impossible as it
prevented removing any mega menu item (well, you had one possibility if
you used Chrome which was to unlink the mega menu item and then remove
it via backspace but...).
After some more discussion, we decided that allowing to merge mega menu
items seems not bad (it is the same behavior as the rest of the editor
when two links are next to each other). In any case, being able to
remove default mega menu items is more important.
[1]: https://github.com/odoo/odoo/commit/9779145d9157e9687c36d2caa0ecea2862a2ac5a
opw-3109946
opw-3120070
closesodoo/odoo#109804
X-original-commit: 7de359470fb4d8eb81f018262a5e4c66a71c7043
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit removes the title attribute on navbar items.
The title was only repeating the content so it was useless.
closesodoo/odoo#109230
Task: 3097276
Related: odoo/enterprise#35562
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, the behavior disabling the unused snippet assets
performed two checks:
1. It was looking for occurrences for its use in the snippet template
2. It was looking for occurrences for its use in the HTML fields
3. Checked on the occurrences of step 1 and 2 and return result.
In many cases there are already coincidences in the first step, making
the second step unnecessary since this second one is the slowest.
Matches are now checked between steps 1 and 2 to skip the second if
matches are already found.
closesodoo/odoo#109488
X-original-commit: 56100532dbcbdeb5487662d0cbf35ba6d62b15b5
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
When editing a website form, a `search_read` request is fired on
`ir.model` model to get the list of possible form actions (create
ticket, create opportunity, etc.).
But since commit [1] in Odoo 15, non-admin users don't have read access
anymore on this model, leading to a traceback when clicking on a form in
edit mode.
Steps to reproduce (as designer):
- Install only website and login as admin
- Make "portal" user an internal user and give him "Editor and Designer"
rights
- Login as "portal" user
- Enter edit mode on any page and drag & drop the form snippet, or
simply go to /contactus page which already has one
- Click on the form -> Traceback
Steps to reproduce (as publisher/restricted editor):
- Install website_hr_recruitment
- Make "portal" user an internal user and give him the following rights:
- Website: Restricted Editor
- Recruitment: Administrator
- Login as "portal" user
- Go to a job page like /jobs/detail/experienced-developer-4
- Enter edit mode and drag & drop the form snippet
- It will crash
[1]: https://github.com/odoo/odoo/commit/5dc4cff60a557e14b08440c227423291c407899b
opw-3098097
opw-3101884
closesodoo/odoo#109339
X-original-commit: 054c216e93b818794316bfd4b8ce56d6853a61d3
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Cannot be used in v16 since some mixin don't exist anymore.
After 4 odoo versions, and now that we use bootstrap 5, we drop the
support of bs3.
closesodoo/odoo#109359
X-original-commit: 2c34fd4f031b006451305c46b99a790540c5e902
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Before this commit, trying to delete a page from the page manager in
debug mode would throw an error of type "Got duplicate key in
t-foreach".
As explained in this commit [1] and as per the [owl documentation]:
"Owl requires the presence of a t-key directive, to be able to properly
reconcile renderings." and "A key should be a unique number or string."
In our case, "dependency_value" is an array. Due to that, the current
item of the "t-foreach" iteration is the current value. The bug is
fixed by ensuring that the value of "t-key" is the current value index
and not the value itself.
[1]: https://github.com/odoo/odoo/commit/0d1c263298ca6724a6fe6c31e2a2d3221c5e8c75
[owl documentation]: https://github.com/odoo/owl/blob/master/doc/reference/templates.md#loops
task-3082345
opw-3100483
opw-3111671
closesodoo/odoo#109329
X-original-commit: f56d5906f845cb45f88d9729b73aa2ed08c551f3
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Steps to reproduce the bug:
- Install the "Surveys" application.
- Go to the "Website" application.
- Go in the page manager ("Site" > "Pages").
- Select a page (typically "Home").
- Try to delete it.
- Error of type "'survey.survey' object has no attributes 'name'".
The error comes from the fact that records do not necessarily have the
attribute called "name". To fix this error, this commit uses
"display_name" that is defined in all models.
task-3082345
opw-3100483
opw-3111671
X-original-commit: d5aa5d7ebf9cd17a6df054252a1313ec8b85e83e
Part-of: odoo/odoo#109329
This commit allows to debounce the events of the RangeUserValueWidget so
that the user can use this widget with the left and right arrows without
having a lag effect (especially on the image quality option).
In addition, steps were added in the website_gray_color_palette tour to
let the time for the debounce to trigger the changes.
task-2601533
closesodoo/odoo#109165
X-original-commit: dddec7489f5cb4e48368684a8783015517c394ee
Signed-off-by: Bojabza Soukéina (sobo) <sobo@odoo.com>
Before this commit, the popup snippets were configuring the modal option
for bootstrap 4 rather than 5.
The `data-focus` in bootstrap 4 becomes `data-bs-focus` in bootstap 5.
Without `data-bs-focus` option, the Newsletter popup snippet became
uneditable because any click inside popup changed the selection to be
inside the first focusable element within the modal.
The reason of the input being focused is: upon click inside the modal,
the target of the focusin event is the parent of the modal because that
parent is contenteditable="true". Because that target is outside the
modal, `_handleFocusin` correct the selection by focusing the text
input.
task-3102155
closesodoo/odoo#109148
X-original-commit: bc99f3cdb5c2fca59a24dc4970c9ca6e69721838
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Since 2013 we have a kind of a URL hack that allows to redirect to the
initial URL after installing a lang through the website, see [1].
It was even tested in python unit test with [2] but sadly it was still
broken by a combination of [3] and [4] which actually broke it at the
javascript level: the python view was correctly still outputting the
correct URL and the python part was correctly handling that return URL
when passed, but the javascript was not actually passing the URL from
the view/href to the python side as the lang install wizard was now
called through JS instead of a normal backend URL redirect (since the
website frontend > backend imp at [4]).
Step to reproduce:
- Go to any page other than the homepage
- Click on footer > add a language
- Add a language
- You are redirected to the homepage always instead of the URL you came
from
Note that this is only true if done through the backend / iframe preview
as clicking on the "Add a language" from the frontend will work as it
should. Indeed, when clicking on it from the frontend, it's a simple
link redirect but when click in the iframe preview, the click is
preventend to let the JS open the action in the top window instead.
[1]: https://github.com/odoo/odoo/commit/5cfbcc3aff5a28022b397ec7a28ebaca6db43673
[2]: https://github.com/odoo/odoo/commit/269aa594111a152ad4b7714856ea745bfef57155
[3]: https://github.com/odoo/odoo/commit/11429329b8dea2dd0b2496dc8c1c8627751cccff
[4]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3bclosesodoo/odoo#108869
X-original-commit: 05caf6e697461176326ee61beeccb1193472267c
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
request.geoip is no more a dictionnary cached in the session. It is now
a full blown object with lazy and smart geolocalisation capabilities.
Among other things, the previous dictionnary API is now deprecated. The
changes are:
* `request.geoip['country_name']` -> `request.geoip.country_name`
* `request.geoip['country_code']` -> `request.geoip.country_code`
* `request.geoip['city']` -> `request.geoip.city.name`
* `request.geoip['latitude']` -> `request.geoip.location.latitude`
* `request.geoip['longitude']` -> `request.geoip.location.longitude`
* `request.geoip['region']` -> `(request.geoip.subdivisions[0].iso_code if request.geoip.subdivisions else None)`
* `request.geoip['time_zone']` -> `request.geoip.location.time_zone`
It is safe to access all the attributes. Doing `request.geoip.city.name`
when the geolocalization failed (missing db, invalid address, ...)
evaluates to None. It does not raise an AttributeError.
Task: 2848206
Part-of: odoo/odoo#91337
Maxmind offers multiple ip-geolocalization databases, historically we
have been using the City database which contains records on a
city-basis. Many years later it turns out we are primary using geoip to
know the country of the user. Geolocalization in the City database is
considered slow by our standard and we have been clever in order not to
geolocate each request by saving the info in the session.
On the other hand, the Country database that is offered by Maxmind is
much more lightweight and geoip using that country is considered a fast
operation by our standard.
In this work we make Odoo compatible with both the City and the Country
databases. Using multiple database at the same time, we can be smart and
only query each of the two on-demand. If a user ask for its country,
we'll use the fast Country db. If a user ask for its city/timezone we'll
use the slower City db.
By default it loads both database from the `/usr/share/GeoIP/` folder,
respectively the files `GeoLite2-City.mmdb` and `GeoLite2-Country.mmdb`,
you can provide alternative paths using the `--geoip-city-db` and
`--geoip-country-db` CLI options.
In the same mindset as #86015, geoip is still lazy. It is done on-demand
and the result is cached on the current request. The different with the
related PR is that as we know consider geoip to be fast, we no longer
cache the result in the session.
Task: 2848206
Part-of: odoo/odoo#91337
Before this commit, we have redundant loc in sitemap.
When we iter the rules from the routing map, the comparison between
two same endpoints are not equal since httpocalypse.
After this commit we compare the function of the endpoint to know if we
have already processed it or not.
X-original-commit: c408de398c6b4e59cd9a233df251147d8750b9f2
Part-of: odoo/odoo#108670
After [1], most snippet options should use something like
`this.$target[0].ownerDocument` to access the document properties
instead of the global object `document`. This is because the editable is
now inside an iframe.
Commit [2] tried to adapt most occurrences but missed some.
This commit adapts the leftover code and fixes 2 bugs:
1. The SCSS Variable `font` wasn't properly reset when deleting a Google
font that was currently being used, resulting in a `/` being displayed
and the variable having an inconsistent state.
2. In the Chart snippet, the color being used to represent data is
displayed inside the option as a border on the input widgets. It was
currently using Odoo's colors instead of the ones defined in website.
[1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b
[2]: https://github.com/odoo/odoo/commit/03c552690b15cbf2e7d6b7812386ac64042219af
task-2978623
X-original-commit: 6e0bd78e59b8352d15c9f21bf5f891924d6c3c9f
Part-of: odoo/odoo#108819
When `link_tools` was introduced at [1], `_onURLInput` did only update
the configuration form and did not touch the edited DOM. Even though its
name would be misleading for that purpose, it was therefore used without
issue as an event handler responding to the configuration form input
events and as a private method called in the `start` method of the
widget lifecycle.
At a later stage, with [2], DOM modifications were introduced in
`_onURLInput` (using the misleading `_adaptPreview` method whose
refactoring at [3] made it update the configuration form only in the
case of the "Link Dialog" but update the actual link DOM for the "Link
tools" (website / mass mailing)).
This commit fixes that behavior by touching what is strictly necessary
in stable to keep the original intend of `_onURLInput` (updating the
configuration UI) but at the same time update the DOM following
configuration form input events (as intended by [2]).
In master, all of this should be reviewed.
Here are steps which revealed the problem. Although, meanwhile, [4] and
its parents were merged which fixed other parts of this issue but
keeping the potentially problematic DOM update on selection as described
above. Notice that [4] and its parents may be reviewed further in a
future update.
- Edit Home page
- Drop a "Banner" block
- Select the "Contact Us" button
- Select "Custom" style in the link tool
- Select a fill color
- Deselect the button by clicking on the Banner's text
- Select the button again
=> Button is redrawn without its color
[1]: https://github.com/odoo/odoo/commit/740168ce8d27da3d6a7156d2d79655a898394923
[2]: https://github.com/odoo/odoo/commit/226c4c4032c26d3d8f622b29fb151fa8e78ba70a
[3]: https://github.com/odoo/odoo/commit/4a1d776243b059d423152bd026bb8bc758477224
[4]: https://github.com/odoo/odoo/commit/eb4edac560227b46efdcfe958e3b93e0b88def64
opw-3086198
task-3096806
X-original-commit: da25eadde299b81b78d84678978b7e1f703530cc
Part-of: odoo/odoo#108812
Co-authored-by: qsm-odoo <qsm@odoo.com>
The "website_gray_color_palette" tour recently failed 4 times during
staging build on runbot, out of those 4 caught times, it seems that:
A) 3 were because the last step was marked as failed too soon
(screenshots and logs seem to indicate the editor was still loading).
B) 1 was because of a "random" asset error (traceback when lazy loading
the editor JS).
The cause of (B) was not found and should be later investigated if seen
again. This commit tries to avoid (A) which is probably related to a
known issue: when the website iframe has to reload it may sometimes take
more time than is allowed by the default timeout of tour steps. Some
improvements regarding that will be made at [1] and probably by further
PR after that (improving the editor loading speed in general).
Meanwhile, this commit reviews the tour to not save the editor as it was
actually not needed in this tour (nothing has to be saved).
[1]: https://github.com/odoo/odoo/pull/100122
runbot-14112
closesodoo/odoo#108747
X-original-commit: fa1819f09948c64ff7acf634eed075515f6a01d2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
*: website
When dragging inner contents, dropzones appear in the Carousel snippet,
allowing to drop them directly in the element with the `row` class,
where it should not be the case. This is due to the `content` class
present on these elements and to the drop-in rule for inner contents
that allows them to be dropped in elements having this class.
This commit fixes this issue:
- in stable: as the XML files cannot be modified, the drop-in rule is
patched in JS to exclude the elements having both the `content` and
`row` classes.
- in master: it removes the `content` classes from the rows of the
Carousel snippet. It also removes this class from the drop-in rule,
as only Carousel was concerned by it.
See [1] for the following of this fix in design-themes.
[1]: https://github.com/odoo/design-themes/pull/603
task-3011192
closesodoo/odoo#108646
X-original-commit: 882c483ec1107879cd1c5693ea5cfce08e3220cc
Related: odoo/design-themes#628
Signed-off-by: Vray Benjamin (bvr) <bvr@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
To reproduce the issue:
- Website > Edit mode > Add "Share" block.
- Cannot edit the link by clicking a social share item ("Edit link"
on link popover doesn't work).
Since 15.x, "Share" snippet items are not meant to be user links but
buttons to share the page on the related social media. It is also
useless to update those links after the update on [1], since they will
be replaced by the right values "on social item click" (the shared URL
may be updated during the page use as on product pages).
The goal of this commit is to fix this behavior and prevent the link
popover from appearing on items (by setting the `o_no_link_popover`
class right after the snippet is dropped into a drop zone).
[1]: https://github.com/odoo/odoo/commit/ddb2c06be4196c86ff6a2fd74874487d75b31c94
opw-3084367
closesodoo/odoo#108724
X-original-commit: f4a602ca4d423056fa3f760fc8a3fc222e2a5e51
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
To reproduce the issue:
- Website > Edit mode > Add "Share" block > Save.
- Click WhatsApp > Missing space between page title and its URL.
Starting from [1], the `$('title').text()` value was replaced on "Share"
snippet by `document.title` (which will trim and collapse whitespaces
in the page title). This leads to a missing space between page title
and the shared URL.
After this commit, the correct spacing is restored.
[1]: https://github.com/odoo/odoo/commit/ddb2c06be4196c86ff6a2fd74874487d75b31c94
opw-3084367
X-original-commit: e7e9eb4f806680b19f3ec61fb080316a3160e7fb
Part-of: odoo/odoo#108724
The last two parent of this commit introduced fixes towards the Snippet
Cache, more specifically, the snippet cache according to the snippet
language.
Commit [1] introduced a Snippet template "Cache" that keeps the snippet
templates in memory throughout multiple instantiation of the
SnippetsMenu. Unfortunately, while this improved performance, it also
introduced bugs where the cache was not properly cleared. Starting
the edition in translate mode, then switching back to master edit mode
would sometimes lead to the Snippets being loaded in the wrong language.
The parent commits fix that but this one introduces a test to make the
snippet cache and translation more robust.
[1]: https://github.com/odoo/odoo/commit/03c552690b15cbf2e7d6b7812386ac64042219af#diff-52a4f9d2c217548e69e6b7fd097f286f1754a6389734eea254b87255e501cbefR18closesodoo/odoo#108643
X-original-commit: a066dc8319cc9c204656a25af16fc78ae618cd71
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
*: mass_mailing
When images are dropped from outside the browser into a website page
text paragraph, they are stored as an inline base64-encoded source.
This commit marks those images to be saved as attachments when it
happens in website. The save happens upon page save similarly to what is
done when images are transformed.
This commit also applies this behavior for pasted images.
task-2928495
closesodoo/odoo#98801
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Prior to this commit, adding an anchor using auto-complete would not
properly prefix the url with the URL of the current page.
Steps to reproduce:
- Create a page (e.g. /test), add blocks and create an anchor (e.g.
- Save the page
- Click on "Edit Menu" in "Pages"
- Add a new menu entry
- Type '#' in the URL field and select the anchor
- Save
=> The menu entry is wrongly set as it does not contain the original
page's URL inside the `href` attribute. This means that clicking on the
menu from any other place will not properly redirect to the anchor on
the /test page
On top of that, editing a menu entry that was previously linked to a
page would change the URL of the page with an anchor, making it
impossible to access the page anymore until you change the URL back in
the page manager.
Steps to reproduce:
- Create a new page (e.g. test)
- Add a new menu entry that has this page as its URL
- Save the new menu entry (close the dialogs)
- Re-open the Menu dialog and edit the newly created menu entry
- In the URL field, replace it with the page + an anchor
(e.g. /test#anchor)
- Save
=> The page's URL is now /test#anchor and is no longer accessible
The is due to the `save` method of the `website.menu` model not
containing code to properly manage adding an anchor to the menu.
This commit fixes that.
opw-3067750
closesodoo/odoo#108502
X-original-commit: 192bf08da191e6fad27dd2913be0801817256a3a
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
To reproduce the issue:
- Go to website > Add language > Add blocks to your homepage and
translate it.
- Make translations on the "Contact us" page (or a new custom page).
- Install a new app > The translation of the homepage is lost (only on
homepage).
Explanation:
After [1], The `_load_module_terms()` method was updated on website
module to copy translations from base to specific views when module
translation is loaded. And since [2], the translated field's column is
either NULL or a JSON dict mapping language codes to text (the field's
value in the corresponding language).
To explain what happens exactly when new app is installed, let's suppose
we want to load module translation for the config {'en_US', 'fr_BE'} in
the following situations:
S1 (e.g. "Contact us" page):
-=-=-=-=-=-=--=-=-=-=-=-=-=-
```
generic_arch_db = {
'en_US': '<div>Generic (EN)</div>',
'fr_BE': '<div>Generic (FR)</div>'
}
- specific_arch_db = {
'en_US': '<div>Specific (EN)</div>',
'fr_BE': '<div>Specific (FR)</div>'
}
```
`_load_module_terms()` will copy translations for 'fr_BE' from generic
to specific `arch_db` (using generic translation dictionary).
result:
```
new_specific_arch_db = {
'en_US': '<div>Specific (EN)</div>',
'fr_BE': '<div>Updated Specific (FR)</div>'
}
```
S2 (new custom page):
-=-=-=-=-=-=--=-=-=-=
```
generic_arch_db = NULL
specific_arch_db = {
'en_US': '<div>Specific (EN)</div>',
'fr_BE': '<div>Specific (FR)</div>'
}
```
result:
Nothing to do here (only specific version), the specific translation
will not be updated.
S3 (e.g. website homepage):
-=-=-=-=-=-=--=-=-=-=-=-=-=
The generic view has no translated `arch_db` (only the 'en_US' version):
```
generic_arch_db = {'en_US': '<div>Generic (EN)</div>'}
specific_arch_db = {
'en_US': '<div>Specific (EN)</div>',
'fr_BE': '<div>Specific (FR)</div>'
}
```
`_load_module_terms()` will copy generic translations only for languages
available on "generic_arch_db" and the 'fr_BE' version will be lost.
result:
`new_specific_arch_db = {'en_US': '<div>Specific (EN)</div>'}`
The goal of this commit is to prevent this behaviour by keeping the
specific translated `arch_db` even when the generic value has no content
for the translation language.
Remark: This behaviour occurred while loading module translations,
as a consequence, the specific translations are also lost when the
website module is updated.
[1]: https://github.com/odoo/odoo/commit/94db81d8d28c4cbc7b51ae1688c9362042ee3619
[2]: https://github.com/odoo/odoo/commit/ef00294e7189359c47638c4a71626f1937395edb
opw-3083480
closesodoo/odoo#108477
X-original-commit: 91a9c870eede96040ac49d2375fe0e18342342e1
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Note: this bug is not possible to reproduce in 16.0 anymore, since the
Bootstrap 5 update. This commit is however kept as it makes the behavior
more efficient keeping the original fix's diff + it also cleans things
that were not necessary anymore since the "website-in-backend" update
that was made at [1].
Steps to reproduce the bugs (in older versions):
- In edit mode, choose the "contact" header template.
- Drag and drop a table of content snippet on the page.
- Save the page.
- Click on the table of content links.
- Bug => the links are not activated correctly.
The reason of the bug was that the scrollspy offset (calculated against
the header height) was not updating when the header height changed.
We did make a new call to scrollspy at the right time but that had no
effect because we first had to destroy the existing scrollSpy to be able
to make a new call that works.
opw-2951315
[1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3bclosesodoo/odoo#108223
X-original-commit: edd9d2b3df597786b2db416aed382dc5666623e2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Prior to this commit, the steps block options could not support a column
that was more than nine out of twelve (bootstrap columns) wide.
Steps to reproduce the bug:
- Drop a block step on a page
- Set a width of 10 columns on the first step
- Set a width <= 2 columns on the second step
=> the connector is not well displayed.
task-3033126
closesodoo/odoo#108362
X-original-commit: 9c4e0eaa60ad89140661e3c297ea1b4e22d6faae
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
*: website
The fields of a form that are mandatory because of the model they need
to be used in cannot be removed. When such a field is selected, the
remove button displays a tooltip giving this information.
Disabling the overlay button is done by removing the specific class -
which makes the event selector not linked to the button, but also
impacts the applied CSS rules.
This commit adds an `o_disabled` CSS class upon disabling the button.
The tooltip is put on a `span` that wraps the disabled button because
tooltips cannot be shown on disabled elements.
Steps to reproduce:
- Drop a "Form" block.
- Select the "Phone Number" field.
- The overlay's delete icon has a reddish background.
- Select the "Your Email" field.
=> The overlay's delete icon had a dark gray background instead of a
reddish one.
task-2950433
closesodoo/odoo#107864
X-original-commit: ed3acbae6a6b2fe91c948ceeb16a5bdb3fa8f060
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Before this commit, following this flow:
- Add a form
- Add a selection field
- Add an option starting with a number
- Save
=> The created form's option value is only the number
From the website_form options, the options HTMLElement of a form field
are generated using the field's records ids for their html element value
attribute (see FormEditor._renderField).
When [1] refactored the website_form options to use a generic
ListUserValueWidget, the list records id computation changed to use
parseInt instead of strings.
This commit changes the detection of parsable int to match only strings
that are made only of digits, and less than 16 of them so that their
value is not lost.
[1]: https://github.com/odoo/odoo/commit/9304f8fa7bb94f21dd4caa83f9679ffd1642691b
opw-2980760
closesodoo/odoo#108248
X-original-commit: 166f4aa4d23a01901585b60d69fac47fe70b7ebe
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Co-authored-by: Younn Olivier <yol@odoo.com>
This commit mitigates an issue with shape elements sometimes having tiny
spacing on their top or bottom edge.
This issue is mainly on Chrome when the user has changed the page zoom.
When the page is zoomed the elements can have a width value with a
decimal part. Because of it, the size of the SVG background images are
not correctly rounded compared to their container and therefore leaves a
visible space.
Steps to reproduce the bug:
- On Chrome, add several shapes on a website page.
- Change the zoom of the page and change the window width.
- At some points, the gap will appear.
The least bad solution we found to fix this is to ensure that the width
of the shape elements is always as close to an integer as possible.
Reminder: several commits had attempted to fix this before ([1], [2],
[3], [4]). But that wasn't enough to stop it happening. Some shapes
still need to be fixed although that will likely be done in future
versions.
[1]: https://github.com/odoo/odoo/commit/c0f62593a4da37e8404dddc0a5762879a5ebbf7f
[2]: https://github.com/odoo/odoo/commit/ac82407b259eab929486bf0a333a48bc507efa60
[3]: https://github.com/odoo/odoo/commit/42b3ad10e0b32b7fc72f801e2c67d6baf938c566
[4]: https://github.com/odoo/odoo/commit/e386f318f5cff50901dba3db8a2587911ba02a6e
task-2824607
opw-3069213
opw-3057533
X-original-commit: 623db525e18931a4dd5794da78be840afc34991a
Part-of: odoo/odoo#108228
It was reported the following error:
```
psycopg2.errors.DatatypeMismatch: column "country_id" is of type integer
but expression is of type boolean
LINE 9: false, 1, NULL, 4, 4,
```
The root cause is unknown, it's not yet sure how this is happening
exactly.
This commit is then fixing naively the consequence.
Somehow, GEOIP is returning a country code which does not exists in Odoo
for this error to appear. It's normally not possible.
There is multiple possible cases that would lead to this error:
- The user modified the `code` field of a country in his DB (unlikely)
- The user deleted a country in his DB (unlikely)
- The GEOIP database is returning a country which does not exists in
Odoo. This is the most probably case, even if the latest up to date
`GeoLite 2 City` seems to have the exact same country code list as in
Odoo 16.0 (250 exact same ones).
Moving the country_id search directly in the query will prevent the
issue and is better anyway to avoid an useless query everytime when
GEOIP is enabled.
Perf wise, it doesn't seems to alter at all the query speed.
closesodoo/odoo#108232
X-original-commit: 42fe2540620b7529d9a848c4570290cbf64a4f48
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Steps to reproduce the bug:
- Add a "Table of Content" on the website.
- Try to save a "Block" of the table.
- 14.0: you get an error message.
- 15.0: it keeps loading forever.
- 16.0: you get a white page.
Users should not have the possibility to save part of a snippet. The
goal of this commit is to ensure that the save option applies on a
snippet. If it is the case, the user has the possibility to save it. If
not, the user does not have the opportunity to save it.
opw-3056913
closesodoo/odoo#108002
X-original-commit: 5f28c7d9a04c46d570b13766eaaa90e755008623
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Before this commit, following this flow:
- From the documents app, click on the "share" icon of a document,
- In the website builder, in edit mode, paste the link in the link
tools,
- Save and click on the link,
=> There is a traceback coming from cross-origins errors with the iframe.
These documents should be opened in the top window, as it does not make
sense to open the pdf viewer inside the iframe. This is defined in the
website module, to avoid creating a website_documents module just to
patch the WebsitePreview._isTopWindowURL method.
[1]: 44da4bf
task-2687506
closesodoo/odoo#107860
X-original-commit: 2e8fce06cbe4e2d24dd80eca1c59a9d44d181d30
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Before this commit, following this flow on the website builder:
- Add a new .xml page,
- From the page manager, click on the record to open it,
=> There is a traceback as the website service parses the html document
as an editable one.
This commit fixes the test introduced in [1] to hide edit options on non
editable documents. The test is updated to check:
1/ If there is a dataset (the document of an XML file opened on Firefox
will not have a dataset),
2/ If the dataset has a websiteId key. It is the case only for website
pages, rendered using the 'website.layout' template, and not for other
files (js, css, scss, less, xml, csv).
[1]: https://github.com/odoo/odoo/commit/44da4bfcc30ca4fe78a1e0c5cb2f9f498ba6e72e
task-2687506
X-original-commit: bf2c6abdded1509ae22ed299abaa39fa066efb7d
Part-of: odoo/odoo#107860
This commit removes unnecessary spaces from the XML of the table of
content block.
Related to opw-3047375
Related to opw-3035502
task-2948895
closesodoo/odoo#107732
X-original-commit: 7ee4cc7d02158c63e6e2bd5eacc94371040872a8
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Since the Bootstrap 5 merge, when there were several TOCs on the same
page the scrollSpy only worked for one of them. This commit fixes that.
Steps to reproduce the bug:
- Drop two TOC blocks on the same page
- Save the page
=> The second TOC is not working properly, it does not highlight the
current section.
Related to opw-3047375
Related to opw-3035502
task-2948895
X-original-commit: c182691bbfd6be8cc9aed26162635f5fdb117991
Part-of: odoo/odoo#107732
The table of content (TOC) has two mechanisms that interest us here:
The first one is scrollSpy (from Bootstrap) which allows (among other
things) to bold the menu elements according to the scroll. The second
one is a mutation observer which is implemented to regenerate the menu
when the content of the TOC changes.
This being said, when we edit the TOC and scroll at the same time, there
is a race condition that makes scrollSpy want to add a class to a menu
element while this menu has just been regenerated by the observer. The
error is only visible since the migration from Bootstrap 4 to Bootstrap
5 because to add the class, Bootstrap 4 did it with the jQuery
`addClass()` function which does not cause an error if the element on
which it is called does not exist. Now, Bootstrap 5 does the same thing
in pure JS with `classList.add()` which causes an error if the element
on which it is called is not defined. This commit fixes this error by
disposing the scrollSpy when the menu is regenerated.
Steps to reproduce the error:
- drop a table of content block
- drag a snippet around and go over the drop zones
=> traceback. It can appear directly or after some tries.
opw-3047375
opw-3035502
task-2948895
X-original-commit: a05f782871c61b2d58ca2fd4277cb7aed65a301d
Part-of: odoo/odoo#107732
Since [this commit], when dropping several "table of content" blocks on
the same page, it was impossible to save. This commit solves this
problem.
Steps to reproduce the resolved bug:
- In edit mode, drop two TOC blocks
- Click on Save
=> the UI is blocked
[this commit]: https://github.com/odoo/odoo/commit/06b03ba5ef8375b1236f6ecb52ac468124e910ba
Related to opw-3047375
Related to opw-3035502
task-2948895
X-original-commit: a6de596017cdbd0da10b4050da132d46dc82a491
Part-of: odoo/odoo#107732
When the url redirects to an anchor on a website page, the page must
scroll correctly to the section. This commit allows to do that by taking
into account the size of the navbar. The bug is visible by following
those steps:
- Drop a text - image block on a page
- Drop a picture block under text - image block
- Create a link to target the picture block
- Put link to block picture in the "Learn more" button
- Save
- Right click on the "Learn more" button and open link in a new tab
=> The page is not scrolled correctly to the picture block.
Note that the bug is not present if the header has scroll, disappear or
fade out as scroll effect.
task-2818629
closesodoo/odoo#92777
Signed-off-by: Vray Benjamin (bvr) <bvr@odoo.com>
One can very well select a "auth=user route" as homepage for his
website, like /my.
There would then be an issue with such an URL being set as homepage:
- As the user landed in the homepage controller which is auth=public,
the system will add the public user as env user (see
`_auth_method_public()`).
```
@http.route('/', type='http', auth="public", website=True, sitemap=True)
def index(self, **kw):
```
- Then, that controller will reroute to the homepage url (/my). The
request.httprequest.path will now be /my
- Then, that controller will recall the dispatcher stack:
`request._serve_ir_http()`
- From there, this call won't fail as it should because the user is
considered as logged in as it went already through the
`_auth_method_public()`, adding the public user as env.user.
`_auth_method_user()` won't raise its error.
- The /my page will be rendered despite not being logged in.
Once the user land on that page, the system will actually detect him as
logged out on a page supposed to be accessed when logged in.
It will then:
1. Show a toaster to inform the user
2. Auto reload the page
As the current URL is still `/` (due to the reroute and not a redirect),
the same flow will happen again, and again, looping forever.
--------
Note that accessing /my directly won't be an issue, as it won't go
through the homepage controller (which is auth=public), so there won't
be a user_id set on the env (the public user), meaning that the dispatch
layer will reject the access and raise an access error (through
`_auth_method_user()`.
Also note that the same behavior will occur when going through the first
menu fallback mechanism:
- if the user didn't setup any homepage_url
- and deleted his / website.page
- and his first website menu is /my
In that case, it will go through the first menu redirect fallback, which
will be working fine (as it's a redirect and not a reroute).
With both those 2 flows (going through redirect), the user will
correctly land on the login page (which will redirect to /my once logged
in).
------
Finally, the other solution would be to prevent such a configuration
(/my as homepage_url) but it was not easily doable (if doable at all),
see https://github.com/odoo/odoo/pull/99100#discussion_r963055251
------
A test is also added and over the more complexe case (which should cover
everything):
- With /my as homepage_url
- With the / website.page deleted
- With /my as first menu URL
-> Accessing / as public user should:
1. Reroute to /my (because of the homepage_url set to it) which
should fail now thanks to this commit
2. Since the reroute / re-serve failed, it should reach the
"first menu fallback" mechanism, which is also /my
3. That fallback should be a redirect, not a reroute, so the user
should actually land on the login page
4. Once logged in on that page, it should properly redirect to /my
opw-3077339
X-original-commit: 4f5899f769266edc27a0b2d812df092b95f43c71
Part-of: odoo/odoo#107759
Commit [1] improved the "sanitation" of this field for special
character. For instance, when copy pasting the following terms:
| Input | Before | After |
|-----------------|------------------|-----------------|
| fée d'été à 40€ | f-e-d-t-40- | fee-dete-a-40 |
| Nội dung có Dấu | n-i-dung-c-d-u | noi-dung-co-dau |
But it actually came with a bad behavior which was not noticed: it
prevents to type `-` at the end of the input, which sounds good but is
not.
Indeed, when typing `a-word`, you will type `a` then try to type `-`
which won't work as considering a (forbidden) trailing slash, even if
you actually want to type something after.
This commit allows trailing slashes again, it's not a big deal and one
can remove it if he wants to.
[1]: https://github.com/odoo/odoo/commit/bb43d4dbb5745be84f0f9462e768989e50607bea
opw-3075419
closesodoo/odoo#107746
X-original-commit: bb43e343c0ec823dad8b102a81945b4a05a7af85
Signed-off-by: Romain Derie (rde) <rde@odoo.com>