Commit Graph
4309 Commits
Author SHA1 Message Date
Samuel Degueldre 910897fc97 [REF] web, *: remove tempusdominus date(time) picker lib
As tempusdominus relies on jQuery, we have written our own date(time)
picker in owl. This commit converts the remaining uses of the
tempusdominus date(time) picker and replaces them by our own.

closes odoo/odoo#133349

Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2023-09-04 09:19:08 +00:00
Jorge Pinna Puissant ebd538a194 [IMP] web, *: optimize save record from webclient
This commit, adds a new python method (`web_save`) to save a record, and
optionally read-it again in one rpc call. This optimizes the current
behavior that is to save a record in one rpc, and read-it in a second
rpc.

web_save, will receive the list of IDs of the records to save (if this
list is empty it will create the records, if not, it will write on the
existing records), the list of changed fields, and the unity
specification as optional argument to read the created/modified records
(if the specification is not set, the function will return a list of IDs
of the created/modified records).

closes odoo/odoo#133021

Task-id: 3453184
Related: odoo/enterprise#46559
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-04 09:19:06 +00:00
bve-odoo 66dcfc9bcb [FIX] web_editor: better error message when missing filename field
closes #112101

Signed-off-by: Rémy Voet <ryv@odoo.com>
2023-06-09 12:58:02 +00:00
Romain Estievenart 507c368836 [IMP] *: remove jquery.ba-bbq 🍖
Task Id: 3439226

closes odoo/odoo#133763

Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-09-01 15:09:51 +00:00
Pierre Rousseau 82697d0b18 [REF] web, *: remove owl2 compatibility
*: mrp_subcontracting, point_of_sale, project, web_editor, website,
website_slides

Part of task-id 3439226

closes odoo/odoo#133551

Related: odoo/enterprise#46526
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-09-01 13:20:56 +00:00
Ivan Rasputin a5ec75012e [FIX] web_editor: make crop widget visible again
Crop widget is implemented as div block that is supposed to be displayed on top
of other elements. However, it's not the case for dialogs, because they want to
be on top as well (z-index of dialog is 1050 bootstrap [1])

STEPS:
* Go to Sales Order
* SO
* Schedule an activity
* Use '/' command
* select image
* click image
* crop image

BEFORE: image crop toolbar is hidden behind 'Schedule activity' Pop-up

Fix it by increasing z-index for the crop widget

[1]: https://github.com/odoo/odoo/blob/9102df15cce455205a19fb7b9a0c36186cc51e3a/addons/web/static/lib/bootstrap/dist/css/bootstrap.css#L5524

opw-3391583

closes odoo/odoo#133781

X-original-commit: 36c9b2b7916fbbdcfc912d652695699e50043edb
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Ivan Elizaryev (iel) <iel@odoo.com>
2023-08-31 16:05:49 +00:00
Pierre Paridans fedecc1f27 [IMP] web,*: remove unused legacy download.js
task-3439226

closes odoo/odoo#133768

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-08-31 14:15:07 +00:00
Pierre Paridans 31a00125de [IMP] web,*: remove unused legacy content-disposition.js
task-3439226

Part-of: odoo/odoo#133768
2023-08-31 14:15:07 +00:00
Pierre Paridans ead4f57b3b [IMP] web,*: remove jQuery.hotkeys
Apparently unused library introduced in 022bff6.

task-3439226

closes odoo/odoo#133725

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-08-31 12:26:47 +00:00
qsm-odoo 40de57cbca [FIX] web_editor: prevent crash because of saved snippets tooltips
Since [1], many tickets were created because of a crash preventing any
action in edit mode. This actually occurred in most databases were
snippets were saved previously (which probably is most old-enough ones).

Steps to reproduce on a fresh DB:
1. Enter edit mode
2. Drag and drop a snippet which contains an image, like "Text - Image"
3. Click on the image once (a tooltip asks to double click)
4. Save the snippet (not the page, floppy disk icon in the right panel)
=> You cannot do anything in edit mode ever again.

This is actually a combination of 2 bugs:

A. On step (3) in the steps above, the image receives the
   "aria-describedby" attribute related to the tooltip... and it never
   disappears (if the page is saved, the attribute is saved with it).
   When saving the snippets we should probably clean such problematic
   attributes to be sure anyway too.

B. Because of [1], the snippets saved by the customers and which
   contain the problematic "aria-describedby" attribute are now the
   source of a crash: we try to hide the related tooltips... even
   though there is none, which causes a crash.

This commit focuses on fixing (B). (A) will need to be fixed later,
probably in an earlier version anyway.

[1]: https://github.com/odoo/odoo/commit/095721a9cace476c3eae445c7abd8f8b458aea36

opw-3475051
opw-3481944
opw-3482170
opw-3483220
opw-3483829
opw-3483837
opw-3484069
opw-3484647
opw-3484950
opw-3485343
opw-3485612
opw-3485623
opw-3485704
opw-3486096
opw-3486425
... and many more

closes odoo/odoo#133707

X-original-commit: 824be46dded7efacf2a351b78e723aa9e205b60d
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-08-31 10:37:09 +00:00
Guillaume (gdi) 4c1d7fec82 [FIX] web_editor: don't display option if target matches data-exclude
Since [this commit], it's now possible to edit a media when it's in a
parent that is not editable thanks to `o_editable_media` class.
Unfortunately, these changes make the new class bypass the potential
`data-exclude` defined in the XML option declaration. So if the target
looks like that:
```html
<img class="o_editable_media odoo"/>
```
and the XML option declaration has a `data-exclude=".odoo"`, the option
will still be displayed. This commit corrects the way the
`o_editable_media` class works, so that it only bypasses the
`.o_not_editable` but not the entire exclude.

[this commit]: https://github.com/odoo/odoo/commit/580f1b77ce0b96b7efbf83a0ccdf6979bbf0e904

task-3476644

closes odoo/odoo#133663

X-original-commit: f73734557116a348ac14b2724e1380546192ca12
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Guillaume Dieleman (gdi) <gdi@odoo.com>
2023-08-31 06:16:04 +00:00
Pierre Paridans 0776f2465c [IMP] web,*: split {non-}legacy ui.scss
task-3439226

Part-of: odoo/odoo#133289
2023-08-31 06:15:55 +00:00
Pierre Paridans 8bbe70433d [IMP] web,*: remove unused .o-dropdown-menu class
task-3439226

Part-of: odoo/odoo#133289
2023-08-31 06:15:55 +00:00
Louis (loco) 83616825ce [FIX] web, web_editor: restore the use of throttled calls
Since [this commit], some throttle calls have been replaced by debounced
calls. This commit modifies those calls in three cases.

The first case is to adapt the overlay covering when the window is
resized or content changes. Note: to reproduce the problem, you might
have to use a test tour for example, as the last operation has to be
done really quickly.
Steps to reproduce the problem:
- Go on a product page.
- Double click on the product image and replace it by one of your own.
- Quickly click on the "Remove" button to remove the product image.

-> Problem: In the `ReplaceMedia` option, the call to `destroy()` (due
to the change of target) is done after the call to `removeMedia()`.

A race condition appears here as since [this commit], the function
`updateCurrentSnippetEditorOverlay()` (responsible of the destroy of the
options whose `$target` are not in the DOM anymore) is debounced and not
throttled anymore. This is a problem for two reasons:
- We do not want the first call to the function to be deferred.
- We want this function to be executed at least at a certain rate if
there are a lot of `content_changed` events recorded in a short period
of time.

This commit also removes the call to a debounced version of a function
at a `mouseup` event in the context of the `ColorpickerWidget`. Indeed,
while the use of a debounced or a throttled version of a function is
totally justified at a `scroll` or a `mousemove` event, it is not in the
case of a `mouseup` event as the occurrence of this kind of event can
not be very high over a give time period.

Finally, this commit restores the use of a throttled version of the post
animation cover.
This can be justified by the fact that we want the post animation cover
function to be executed at least at a certain rate if there are a lot
transition or animation end events recorded in a short period of time.

[this commit]: https://github.com/odoo/odoo/commit/f4f0f783183507df8227b37fe1234c256325df6d

task-3111601

X-original-commit: 4c9eb9589e81b02945618195fbe12a4dd0ab9a50
Part-of: odoo/odoo#133546
2023-08-30 13:10:23 +00:00
Louis (loco) b742e93bb0 [FIX] web_editor: do not create variant image while selecting an image
Steps to reproduce the bug:
- Go on a product page of a product with multiple variants but no image
set for those variants. Because there is no image set to those variants,
the variant images fall back on the template image.
- Edit.
- Click on the variant image of the product. (Note that `.o_dirty` is
added to the element).
- Save.

-> The image of the product is not the template image anymore but a
variant image that is the same as the template image.

Because `.o_dirty` is added while clicking on the product image,
`save_embedded_field()` will set the `image_1920` field of
`product.product`. Because the product has multiple variants, the
`image_variant_1920` field of `product.product` is modified see
(`_set_template_field()`).

The problem is that the `o_dirty` class is added on the clicked element.
To solve the problem, the `MutationObserver` responsible for adding this
class is paused when modifying the tooltips. Note that it was introduced
by [1] but it was broken since [2].

[1]: https://github.com/odoo/odoo/commit/9f93fa8e77b11da2fcf60f606784eec49a94778a
[2]: https://github.com/odoo/odoo/commit/8eb0ca54200f0f8e1078bb6a0d507e747ccea122

task-3111601

X-original-commit: 3b8f601f95845d65a515e9c8bb8e25cc17565dbf
Part-of: odoo/odoo#133546
2023-08-30 13:10:23 +00:00
Rodolpho Lima d21007f397 [FIX] web_editor: mobile toolbar visibility over modals
When the editor is displayed in a modal, the floating toolbar needs a
higher z-index than the modal in order to be visible. This is due to the
fact that the toolbar is mounted on the 'body' element (therefore, behind
the modal in terms of z-index).

The mobile toolbar, on the other hand, is mounted as a sibling of the
editable's element, which means it is always visible when the html field
is in a modal, without the need for a z-index. In fact, the mobile
toolbar, being fixed (no auto-hide) and having a z-index higher than
modals, leads to the undersired effect of being visible over modals that
are displayed on top of the html field. An example can be seen in the
Project app, where the editor is inside the task's description tab and a
modal can be opened for the customer.

This commit fixes such undesired visibility of the mobile toolbar over
modals by not applying the z-index to the toolbar when it's not
necessary (when not a direct child of the 'body' element).

task-3263463

closes odoo/odoo#133459

X-original-commit: ae569fd97737bc3fe02f12531857b8cc416c80e6
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-30 13:10:22 +00:00
Rodolpho Lima 05b9eff656 [FIX] web_editor: toolbar scroll over navbar
Before this commit the floating toolbar would scroll over the headers
above the html field, such as the form view header and the web client
navbar.

This commit ensures the toolbar is hidden when it overflows the scroll
container.

task-3263463

X-original-commit: 96d180c7591bcb359c5b74796f39c0e36ea541fa
Part-of: odoo/odoo#133459
2023-08-30 13:10:22 +00:00
Rodolpho Lima ea2bcfc83c [FIX] web_editor: toolbar position update on scroll
Before this commit the floating toolbar position was not being updated
on scroll events in certain scenarios. The problem resulted from adding
the event listener to the incorrect scroll container, which was
calculated only once in the Wysiwyg life cycle, on start.

The calculated scrollable container could be incorrect due to:
- changes in the web client resulting from the swich from read to edit
mode taking place after the Wysiwyg was started,
- changes in the web client resulting from a window resize (particularly
when, in the form view, the chatter switches position from right to
bottom and vice-versa),
- the editor being mounted inside an iframe and the scroll container
being an element in the top document.
- the editor being mounter inside an iframe and the scroll container
being the iframe's root element.

This commit solves the issue by detecting scroll events anywhere in the
document (and in the iframe's document when it applies) and updating the
toolbar position when the editable is a descendant of the scrolled
element.

task-3263463

X-original-commit: 5382c995eecfe2fcea39d9456860b48704645c99
Part-of: odoo/odoo#133459
2023-08-30 13:10:22 +00:00
Michael (mcm) 1f5e8f0fd4 [IMP] web,*: remove web.session
This commit removes the legacy session and adapts the modules where it
was used.

task 3439226

closes odoo/odoo#133153

Related: odoo/enterprise#46290
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2023-08-29 11:10:47 +00:00
Michael (mcm) 55f1822911 [IMP] web,*: remove services/config.js
This commit removes the module services/config.js and adapts the module
that imported it.

task 3439226

Part-of: odoo/odoo#133153
2023-08-29 11:10:47 +00:00
Rodolpho Lima 3e938043dc [FIX] web_editor: style-inline option in HtmlField
Before this commit, the "style-inline" option was misspelled as
"styleInline", resulting in setting the Wysiwyg "inlineStyle" option as
undefined. This broke functionality that depended on such option, such
as disabling the convertion of pasted/dropped base64-encoded images to
attachment for mail compose.

OPW-3448851

closes odoo/odoo#133406

X-original-commit: 4ec687366eca1e05716fe93dad77eef5a9981153
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Rodolpho Cammarosano de Lima (rcdl) <rcdl@odoo.com>
2023-08-29 09:11:59 +00:00
shsa-odoo 9d49150afa [FIX] web_editor: remove block tooltip should not stuck
Before this commit:

Remove Block tooltip gets stuck after click and mousemove.

After this commit:

Remove Block tooltip hides as mousemoves.

task-3432060

closes odoo/odoo#132888

X-original-commit: 095721a9cace476c3eae445c7abd8f8b458aea36
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-28 16:42:06 +00:00
Saurabh Mishra f1f4ef1d8f [FIX] web_editor: get image source while modifying it
If the user is using the `note` or any other module to add and modify images,
and they try to crop the image and apply the changes, they may face an error if
they try to crop it again without clicking on `apply changes` and instead click
somewhere outside the image.

steps to produce:
- Install `note`.
- Create a note, add an image in it.
- Click on image to crop it, select the portion you want to crop and then
  click on `Apply` to apply changes.
- Select the image again, click on crop icon and then click anywhere outside the
  image boundaries.

Error: `TypeError: 'bool' object is not subscriptable`.

Applying this commit will solve the issue because, after applying it, whenever
`modify_image` is called, `datas` will receive the proper source.

sentry-4185609374

closes odoo/odoo#133164

X-original-commit: 0c38bb37e720a3c06f59becbf9bcc78f9f978723
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-28 07:11:03 +02:00
Jorge Pinna Puissant b1829d906b [REF] web, *: remove legacy MutexedDropPrevious
In our continued effort to remove legacy code, this commit replaces
the unique usage of the legacy MutexedDropPrevious util with the new
mutex util. The legacy MutexedDropPrevious has been removed.

Part-of task-id 3439226

closes odoo/odoo#132948

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-08-25 12:20:53 +02:00
Pierre Rousseau 2d9f6fb324 [REF] web, *: remove legacy registry
*: website, website_slides

Part of task-id 3439226

closes odoo/odoo#133132

Related: odoo/enterprise#46272
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-08-25 10:59:55 +02:00
Pierre Rousseau 609a7b234b [REF] web, *: remove legacy storage
*: web_editor, website, website_sale, website_slides

This commit removes the legacy storage (localStorage and sessionStorage)
and replaces it with the storage coming from browser.

Part of task-id 3439226

Part-of: odoo/odoo#133132
2023-08-25 10:59:54 +02:00
Mathieu Walravens 9826d59cbe [FIX] web_editor: getScrollOptions not initialized in translations
Steps to reproduce:
1. Go to a blog post
2. Add a header
3. Hide the element on desktop and save
4. Click the button to translate the page

When translating a page, `getScrollOptions` is not initialized, which
throws an error when updating invisible DOM, as it could require the
function to be loaded.

This is because `_updateInvisibleDOM` needs this property to be set.

Similar fix: https://github.com/odoo/odoo/commit/62cc16dae74729a805a08f17db8ba75d9c51d096

opw-3430581

closes odoo/odoo#133100

X-original-commit: 233cc3439799d2ecc7342c5f02176cef394e08a7
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Walravens Mathieu (wama) <wama@odoo.com>
2023-08-24 23:40:12 +02:00
Morgane (morm) 1bc197b380 [FIX] web_editor: replace buttons color
This commit fixes the color of the "replace" buttons on images in the web
editor.

task-3376752
Part of task-3326263

closes odoo/odoo#133091

X-original-commit: a9a89bc54c7c110460382629bd283effdd7eade6
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-08-24 22:00:17 +02:00
Adrien Dieudonne 3d56c3db42 [REF] web, *: Replace jQuery BlockUI by uiService
Task ID: 45869

closes odoo/odoo#132295

Related: odoo/enterprise#46166
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-08-24 21:59:43 +02:00
Nicolas Bayet f5eca4245f [FIX] web_editor: use owl idiom for link tools_updateOptionsUI
There is an undeterministic error while testing the link tools
because `this.linkComponentWrapperRef` is null at the time of calling
`_updateOptionsUI` by the `onWillUpdateProps`.

As using the element for setting the class is not idiomatic in owl,
this commit adapt the code to use `t-att` attribute.

runbot-23346

closes odoo/odoo#132535

X-original-commit: a16c8b8598761808f5cb2a712c6f5808297e48f3
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-24 18:37:34 +02:00
Samuel Degueldre 6f95be6884 [REF] *: remove web.assets_common
*: auth_password_policy, bus, event, im_livechat, mail, mass_mailing,
mrp_subcontracting, point_of_sale, pos_self_order, project, stock,
survey, web, web_editor, web_tour, website, website_event,
website_forum, website_sale, website_slides, base

Historically, the web.assets_common bundle was used to contain assets
that were needed by both the frontend and the backend. In practice, this
caused a bunch of issues where people would add things in assets common
that were not needed by both, and it was also abused as a way to get
bootstrap working in unrelated places by only using that bundle's css.

Because of this, as a first step, the assets_common stop being used in
the frontend, but was left everywhere else.

This commit removes the bundle completely, and moves the files that used
to be in that bundle in the other bundles that need them, this will
allow those bundles to evolve independently going forward.

in im_livechat and mail, some of the unneeded legacy code was removed, this
allows us to avoind including all of the legacy code from web in the
livechat embed bundle and in the dicuss public bundle respectively.

closes odoo/odoo#132190

Related: odoo/enterprise#45884
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-08-24 15:11:05 +02:00
Rodolpho Lima 954b2d1673 [FIX] web_editor: notification when image can't be cropped
After convertion of the ImageCrop widget to an Owl component [1], the call
to `this.displayNotification` no longer applies. In fact, it produces a
traceback when trying to crop an image that cannot be cropped
(base64-encoded image not yet converted to an attachment, for example).

This commit replaces such call for the more suitable notification
service's `add` method.

task-3471481

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

closes odoo/odoo#132726

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-23 14:43:21 +02:00
Sébastien Geelen (sge) 4a7de52b0f [FIX] web_editor: ensure link insertion
When inserting a link into mass_mailing document
we need to delay the blur event to prevent the to_inline.

If the to_inline is called when the link dialog is open
the context is lost in the document and the link failed
to be inserted.

task-3234749

closes odoo/odoo#132667

X-original-commit: db38abf259c1a6fed51e8e99785ffea770e9e909
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
2023-08-22 20:00:44 +02:00
Benjamin Vray 568198374b [FIX] web_editor: fix image shape selector
Steps to reproduce the bug:

- On Chrome, go to the Email Marketing application.
- Enter edit mode to modify a mail template.
- Add a text-image snippet to the template.
- Click on the image.
- Open the shape image selector in the options of the image.
- Scroll through the list of available shapes.
- Bug: A traceback error occurs.

The bug occurs because sometimes, in the 'scroll' function of the
selector, the 'ev.currentTarget' becomes 'Null'. This issue is specific
to Chrome and only happens in the email template editor (not in the web
page editor). It appears that this issue is related to using the
'throttleForAnimation' function for the event, where the value of
'currentTarget' gets lost during various calls.

We fix this bug by avoiding the use of 'currentTarget' in this specific
case. However, further investigation would be required to fully
understand the problem.

task-3431820

closes odoo/odoo#132574

X-original-commit: c799345f6ae81f10a8133688431fe63ed23617ad
Signed-off-by: Colin Louis (loco) <loco@odoo.com>
Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
2023-08-22 09:49:54 +02:00
Antoine GuenetandPedro Manuel Calheiros Lima de Sousa 2ab529ed29 [FIX] web_editor: prevent error on undefined closest Node
Summary:
	page with 2 popups (newsletter popup and regular popup), cookie
	bar all justaposed. Chatbot window also open. For some reason
	closestBlock(testedNode) is undefined (testedNode) is a #text
	Node. Change already in place for 16.3

Cause:
	no preventive measure for null value before creating
	a node iterator on the value.Node in dom does not have
	an ancestor of type block.

Solution:
	backport solution from 16.3, return false when currentNodeParentBlock
	is null, since preceding and following would also be undefined,
	return false.

opw-3395673

closes odoo/odoo#132590

X-original-commit: 8a72f669813bc7d8aa9038d75e08ecef00b70e01
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Co-authored-by: Pedro Manuel Calheiros Lima de Sousa <peso@odoo.com>
2023-08-22 07:36:05 +02:00
dhba-odoo 6a35f242a7 [FIX] web_editor: color pallete flicker
Before this commit:

After applying formatting styles to text that already has some color applied to
it, we encountered an issue where the color pallete would flicker when
attempting to change the color.

After this commit:

Now, the color palette will no longer flicker when trying to change the color of
text that has formatting styles applied to it.

task-3417998

closes odoo/odoo#132561

X-original-commit: 7a9977882b0e9222beba7de23f026de937a60a4d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-21 19:57:50 +02:00
Soukéina Bojabza eded9a301c [FIX] web_editor, *: correctly set the ProgressBar component props
*: web_unsplash

Before this commit, if we were in debug mode, when we tried to replace
or add an image, a traceback appeared when selecting an Unsplash image
for the first time or when uploading an image of size 0 (also for the
first time). Note that once the traceback was closed, it did not
reappear until the page was refreshed, but the progress bar was not
displayed anymore.

It happened because in debug mode, there is a validation of the
different owl components props and some props of the `ProgressBar`
component were not correctly set when adding Unsplash images or empty
image files, causing the props validation to fail. Those props
definition were incorrectly added with [1].
The traceback was not reappearing because the `UploadProgressToast`
component (= the parent of `ProgressBar`) has been destroyed and so the
props validation was not done anymore since the components were not
there.

This commit fixes these issues by correctly setting the `ProgressBar`
props and by adding default props, in order for them to always have a
value when omitted.

Steps to reproduce:
- Activate the debug mode.
- In edit mode, drop the Text-Image snippet.
- Double-click on the image to replace it.
- Type something in the search bar and select an Unsplash image or
upload an empty image file.
=> A traceback appears.

[1]: https://github.com/odoo/odoo/commit/886f3de768b647f4b402c97098abf274d6258f75

opw-3413299

closes odoo/odoo#132377

X-original-commit: 425dfb07f21288caf56bceea3a86e0b7ecac4a91
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-08-21 19:57:16 +02:00
divy-odoo ce49ff9742 [FIX] web_editor: preserve content around on unlink images
Before this, we were considering only the case where only a single
element is wrapped by the anchor tag, like `<a><img></a>`. So it simply
replaces parent node `<a>` with childNode `<img>`. However, cases like
`<a>text<img><a>` (where there are multiple element within the <a> tag)
were failing.

To handle such cases, this commit replaced the code that considering
multiple childNodes and replacing parentNode with all the childNode.

task-3231606

closes odoo/odoo#132531

X-original-commit: 08432308819e83fd0122a8e87170ec8ff27ca2a1
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Divyesh Vyas (divy) <divy@odoo.com>
2023-08-21 17:01:07 +02:00
Jorge Pinna Puissant a4b9050ec5 [REF] web, website_sale: remove legacy mutex
In our continued effort to remove legacy code, this commit replaces
usage of the legacy mutex util with the new one, which is fully
compatible as a drop-in replacement. The legacy mutex has been removed.

Part of task-3439226

closes odoo/odoo#131748

Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-08-21 14:15:09 +02:00
Pierre Paridans 8164f107be [IMP] web,web_editor,point_of_sale: remove jquery.nearest library
This library provided the `nearest()` and `touching()` methods.

This commit replaces them by our own utility methods from
`@web/core/utils/ui`: `closest()` and `touching()`.

closes odoo/odoo#130818

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-08-21 12:38:57 +02:00
Pierre Pulinckx (pipu) c07181b20b [REF] *: Replace env._t() by _t()
In this commit, all usages of env._t() are replaced by _t().
In templates files, env._t() didn't work because terms used
in attributes where not extracted into the translation files.
Only string are exported from .xml files to translation files.
So, to make it works, we set a variable that is then used
in attributes.
For example :

<t t-set="string_to_translate">String to translate</t>
<Dialog title="string_to_translate>...</Dialog>

task-3292454

closes odoo/odoo#131390

Related: odoo/enterprise#45631
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-08-18 19:17:16 +02:00
Louis Wicket (wil) 75c69aeb38 [IMP] account, web_editor, base: remove useless use strict
According to the ECMAScript 2023 Language Specification:
> Module code is always strict mode code.

Odoo Modules mimic this behavior and automatically add “use strict“ at
the top of the file, so there's no need to do it yourself.

This commit removes all the useless occurrences of use strict.

closes odoo/odoo#132235

Related: odoo/enterprise#45908
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-08-17 19:51:17 +02:00
Rodolpho Lima ab10ed0c62 [FIX] web_editor: images converted to public attachments
Before this commit, since [1], when an image was pasted or dropped, it
was converted to a public attachment on save.

This was an oversight, and this commit fixes it by creating such
attachment as a private one instead, much like when uploading an image
via  the "/image" command.

Attachments created via the website remain public.

[1]: https://github.com/odoo/odoo/pull/128452/commits/1b3877191ee9d97d2c50ccacb41461827b42fd56

closes odoo/odoo#131975

X-original-commit: d939fc83ab645ebced6859e04269fb65bf47f323
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-17 18:43:08 +02:00
Rodolpho Lima ef9efcdc61 [FIX] web_editor: disable dropImageAsAttachment for mail and mailing
This commit deactivates the conversion of pasted or dropped images into
attachments through a controller within the web_editor module. This
alteration applies to mail and mass_mailing modules, as they have their
own mechanism to handle this process.

task-3457541
opw-3448851

X-original-commit: 291ca7496515701737f6940fa27c917ded205aa6
Part-of: odoo/odoo#131975
2023-08-17 18:43:06 +02:00
Nicolas Bayet 0c4a94e17d [FIX] web_editor: properly return the value of _hasICEServers
In the forward port #129226, the return value of _hasICEServers was
not properly returned, which led to the collaboration to always be
disabled.

task-3468261

closes odoo/odoo#132165

X-original-commit: e215290bd2d6091396aafadc58a93a68675d77dd
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-17 11:48:48 +02:00
FrancoisGe e3da5f1b7d [REF] *: convert legacy dialogs
The goal of this commit is to convert a bunch of legacy dialogs into owl dialogs.

closes odoo/odoo#131278

Task-id: 3453920
Related: odoo/enterprise#45484
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-08-16 16:05:12 +02:00
Louis Wicket (wil) 537b0ce712 [REM] base, *: remove binary_field_real_user from context
Formerly, using sudo() on a record had the effect of replacing the
current user with the superuser. But sometimes, knowing who the "real
user" was was necessary, so we needed to store it somewhere. This is
basically why the key `binary_field_real_user` was introduced in the
context: to keep track of who the user was before switching to sudo
mode.

Since 1e6c3bec2c, however, switching to
sudo mode no longer changes the current user; meaning that the
`binary_field_real_user` is no longer necessary.

This commit removes the remaining occurrences of the now useless
`binary_field_real_user` from the code.

* = hr, portal, web_editor

closes odoo/odoo#92032

Enterprise: https://github.com/odoo/enterprise/pull/27649
Related: odoo/enterprise#27649
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-08-16 10:23:49 +02:00
Maitri Patel b66c88df12 [FIX] web_editor: handle none value for description field
If a user gets the 'description' field None, then traceback will appear.

https://github.com/odoo/odoo/blob/907aba0f54f65788c78c1370a573fbe9b69be8c5/addons/web_editor/controllers/main.py#L50

Error: 'TypeError: expected string or bytes-like object'

Sentry-4319373991

closes odoo/odoo#131943

X-original-commit: d00a1fd4b3dbed7b55a32ce6bbd659b56dd06de2
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-14 19:28:58 +02:00
David Monjoie c8a63f2414 [FIX] web_editor: fix traceback when reconnecting
closes odoo/odoo#131896

X-original-commit: 581ec9209a2d5cc0f13de9ccb6f10e6255ba4959
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-14 13:42:36 +02:00
Jorge Pinna Puissant e338487028 [REF] *: remove owl="1" from the templates
As all the templates are now imported in the owl app, there is not need
anymore to specify the owl="1" attribute in the templates.

Part of task~3443861

Part-of: odoo/odoo#130467
2023-08-11 14:32:30 +02:00