Commit Graph
543 Commits
Author SHA1 Message Date
71c81e605b [IMP] *: expression edition
The PR https://github.com/odoo/odoo/pull/104741 have recently modify how the modifiers required, readonly,
invisible, and column_invisible are defined. They are now given by Python
expressions instead of domains. In this PR we introduce two main new
components ExpressionEditor and ExpressionEditorDialog that allow to
edit/view a Python expression in a way similar to what is done in the
DomainSelector/DomainSelectorDialog. For this we have extracted the main
logic found in DomainSelector and moved it to a new component TreeEditor
that is used by both ExpressionEditor and DomainSelector. For this we had
to add a new type of leaf we call "complex condition" that allows us to
represent indecomposable (sub)expressions, i.e. expressions we cannot
(or don't want) to express as conditions of the form (path, operator, value).

The main mappings allowing to transform trees, domains, expressions into
one another (when possible) are to be found in
@web/core/tree_editor/condition_tree.js.

closes odoo/odoo#136258

Related: odoo/enterprise#48512
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Carion <juca@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: Pierre Pulinckx <pipu@odoo.com>
2023-10-20 11:22:05 +00:00
Arthur Detroux (ard) 7594d71ca8 [IMP] *: remove jQueryUI draggable and droppable
*: mass_mailing, test_website, web, web_editor, website, website_event,
   website_sale

This commit removes jQueryUI draggable and droppable component to
instead use our own implementation of the feature. This replaces the
last use of the lib: the web_editor drag and drop. This takes advantage
of the code that was already written for other features of the backend.

task-3079246

closes odoo/odoo#136793

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-10-19 22:01:48 +00:00
Guillaume (gdi)andqsm-odoo 194f73a9bb [IMP] website, *: prevent hardcoded font sizes
*: web_editor, mass_mailing

This commit changes the way the font size selector works. Before this
commit, the font size selector applied a hardcoded font size using the
style attribute of the selected element. The purpose of this commit is
to change this to apply a class on the selected element, making it
responsive and customizable.

In all Odoo applications, the font size selector will now apply a class
on the current selection. An exception is made for mass mailing where
the class would not make much sense as not related to the custom heading
sizes (probably needs to be refactored in the future to use the standard
font-size classes) and fonts cannot be responsive in mails anyway (so
there would be a difference between preview and sent mail).

Those classes are:
- `display-N-fs` with N in [1 => 4]. The sizes are stored in the
`$display-font-sizes` map.
- `hN-fs` with N in [1 => 6]. The sizes are stored in the
`$hN-font-size` variables.
- `small` for the small font size. The size is stored in the
`$small-font-size` variable.

The font size selector shows the value of the class (which is dynamic)
that will be applied.

In the website application, the value of each class is configurable
thanks to a previous commit. The user can choose the size of each font
size class in the website settings.

Note that many alternatives were considered for this feature, this is
the chosen compromise. For the record, here is a very short summary of
the alternatives:

- Doing nothing: voted as the worse idea. Users see a font-size selector
  they will use it one way or another. The font-size won't be
  responsive, breaking their mobile website. And there are real use
  cases you could not do: a big "promotion" paragraph on your product
  page? Not possible: you either break your mobile page (using the font
  size option) or possibly hurt your SEO (using the font-style option
  and turning your paragraph into an h1).

- Removing the font-size selector: we did not want the loss of the
  feature as there are correct usecases to use it (as mentioned above).

- Using the Bootstrap hN and display-N classes instead of making new
  ones. Closed to be the chosen idea but discarded because those classes
  comes with colors (that the user can configure) and it would feel
  weird to have the color change when changing the font-size. Also, in
  the end, we also did not want the line-height, margins, etc of those
  classes (only the font-size).

- Instead of X new classes, have only one: o-fs, which would be applied
  alongside a bootstrap hN or display-N class, when chosen by the user,
  to cancel the unwanted style of those. It works but it forces us to
  always have an added `<span>` to apply the font-size, which we don't
  want in the future (mainly because of display-N classes, see next
  commit). It is actually very needed to be able to use proper
  line-height when reducing the font.

- Using a combination of an inline `em` font-size + a class to clamp it
  on mobile. Was probably the best next idea but rejected for several
  reasons. The main one probably being the inconsistency when changing
  the whole size of a title/paragraph (not part of it) and later
  changing the related theme size later. E.g. have an `<h1>` followed by
  a `<p>`. The h1 is 40px, the paragraph is 20px. Force the title to
  20px, because you want it smaller, same size as the paragraph. Real
  use case but also users could simply use the font-size controls by
  mistake. We would thus apply 0.5em to do that. Later, change the theme
  font-size of h1 to 36px (small change). The 0.5em one is now 18px,
  smaller than the following paragraph. Preventing that would require
  more checks which would "break" other things / possibilities.

- Probably others that were forgotten.

In the end, there was no good or bad answer. "Anything works", as long
as the feature "I want this text smaller/bigger" is there. The
surrounding features are always compromise (some users would expect some
behavior, some users would expect others). This commit focused on
solving the unresponsiveness of those custom font-sizes, which was a
problem for many users.

task-1958098

Part-of: odoo/odoo#129791
Co-authored-by: qsm-odoo <qsm@odoo.com>
2023-10-19 19:08:11 +00:00
Brieuc-brd 538fdab99b [IMP] *: fine-tune app icons
The aim of this commit is to improve the impact and rendering of app
icons in bright and dark mode. It also reduces the size of svg files.

To achieve that, this commit updates the colors to flat colors. This
change will make the icons stand out and improve their readability.

task-3072562

X-original-commit: 667a19162b74fb6554a2389ba9c6e69de4ff5113
Part-of: odoo/odoo#138279
2023-10-16 09:21:17 +00:00
Mathieu Duckerts-AntoineandMathieu Notté 6428aef678 [IMP] *: improve domain selector edition, dom, and style
We improve various aspects of the domain selector:

- We make the domain selector be able to display all domains accepted by the class Domain (domain.js)
- We improve the edition/selection of values, e.g. for the operators in/not in
- We improve/simplify the style/dom

Task IDs: 3507123, 3508940

closes odoo/odoo#128680

Related: odoo/enterprise#48324
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Mathieu Notté <mano@odoo.com>
2023-10-13 06:27:42 +00:00
Pierre Pulinckx (pipu) d2462d8627 [FIX] mass_mailing: add markup to preview mobile dialog
This fix is only a missing of the commit 7f5a0ccf9e5fdf3f7fece8a9.
As a reminder, in 7f5a0ccf9e5fdf3f7fece8a9, we check that the content of
the dialog is markuped. If not, we escape it.
So in this commit, we add the markup to the "props.preview".

closes odoo/odoo#138494

Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-10-12 17:20:42 +00:00
Nicolas Bayet fac09ae974 [IMP] web_editor,mass_mailing,website: lazy load wysiwyg
In order to improve the loading time of the odoo backend, only load
the wysiwyg before starting an html_field.

task-3493014

Part-of: odoo/odoo#134464
2023-10-12 13:16:42 +00:00
dht-odoo e542cca69e [IMP] mass_mailing: improve mailing form view design
- Before this commit, it could happen sometime that the time for
  which mailing was schedules has passed, but user was still
  getting the same ribbon that mail was scheduled for a particular
  time (which is a bit confusing). And also in the case of
  schedule_type equals to now we are displaying the next_departure
  datetime in ribbon.

  This commit improves the behavior and in such cases, displays a new
  ribbon message saying "This mailing will be sent as soon as possible."
  and has as refresh button next to it, which reloads the page. Once
  the mailing is sent, this ribbon will also be hidden.

  For that, we introduce a new compute boolean `is_past_departure` which
  will be true only if the scheduled time is in past and the mailing is
  still in queue.

  And for the case scedule_type equals to now we are displaying
  a new message on ribbon with refresh button.

- Re-arranges the model container part of the form view of
  a mailing in order to utilize the horizontal space.

  It moves domain next to the model / filter related fields so that
  everything is in a single row, and thus reducing vertical space.

TaskId-2702607

Part-of: odoo/odoo#82107
2023-10-12 08:09:25 +00:00
Pierre Pulinckx (pipu) 13b3f8af4b [REF] website, mass_mailing: remove getBundle usages
In this commit, we remove three usages of the getBundle function from
@web/core/assets.js. The final goal is to remove it totally to simplify
the understanding of assets's API. To replace the use of getBundle in
mobile preview dialog, an xml template has been created on the server
side and then called by http requests. During the request, we retrieve
the list of assets (server side getbundle) to inject these into
the xml template.

taskId : 3266441

closes odoo/odoo#138055

Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-10-11 17:02:09 +00:00
Thibault Delavallée b4d7eda6e0 [REF] mass_mailing: improve feedback, add reasons
PURPOSE

Globally improve usability and features given by mailing portal about exclusion
list and opt-out management.

SPECIFICATIONS

Messages and notes are improved to have a better wording and links to contextual
records when possible (mailing, mailed records, contacts, ...).

Add opt out reasons when updating subscriptions or block list status. This
allows to better report on common causes.

For that purpose we introduce a new model allowing to store those reasons.
A boolean flag allow to trigger the usage of the feedback textarea in portal
page.

Task-2150462 (Mass Mailing: Improve subscription management)

Part-of: odoo/odoo#86084
2023-10-06 06:13:53 +00:00
Thibault Delavallée d27797dd9b [REF] mass_mailing: add a 'my' page to handle subscriptions
PURPOSE

Globally improve usability and features given by mailing portal about exclusion
list and opt-out management.

SPECIFICATIONS

Currently mailing portal is usable only through dedicated links added in
mailings. Those use a hash token based on mailing, document_id (if mailing
ran on business documents) and email of the recipient. However this is not
convenient, especially for users that want to update their subscriptions
manually.

Purpose of this commit is to add a generic page in mass mailing allowing
to manage subscriptions to mailing lists as well as blocklist status directly
from portal. That way people don't need to come from a given email mailing
link.

A new page is added. It is located on ``mailing/my`` and has the same
capabilities as the unsubscribe pages, except it works outside of a given
mailing contact. Page (html, js) and behavior are shared among the various
use cases.

This page is available for logged user, both internal and share. Other people
should come through existing unsubscribe links using email, document id and
hash token.

Access control is updated so that it is now possible to use mailing routes
without requiring always email / document_id / hash_token. User can be used
instead.

A tour is added allowing to test this new feature.

Task-2150462 (Mass Mailing: Improve subscription management)

Part-of: odoo/odoo#86084
2023-10-06 06:13:53 +00:00
Thibault Delavallée be3c92d805 [REF] mass_mailing: improve portal subscription management page
PURPOSE

Globally improve usability and features given by mailing portal about exclusion
list and opt-out management.

SPECIFICATIONS

Purpose of this commit is to cleanup and improve the portal subscription page
that allows to manage subscription to mailing lists and blacklist status.

Main features updated or added

  * allow to give a feedback when unsubscribing from mailing not related to
    mailing lists. It was previously limited to mailings done on mailing lists.
    Now the feedback is allowed in all cases and posts it on the related
    document;
  * clean display of opt-in and opt-out lists;
  * display all public lists, even if not already join. This allows to opt-in
    to new lists, which was not possible before;
  * switch on a neutral name for non public lists (as they may contain
    marketing hints);
  * give UI feedback to customer when using buttons: add confirmation of
    block list addition / removal, of updated subscriptions, ...
  * globally improve wording;

Unsubscribe from a document now uses the same layout as unsubscribe from
mailing lists. Indeed the first one blacklists the email while the second
one opt-outs from mailing lists. But overall form is the same and options
are also the same. After all previous cleaning we can now keep a single
page for everything.

Task-2150462 (Mass Mailing: Improve subscription management)

Part-of: odoo/odoo#86084
2023-10-06 06:13:53 +00:00
Thibault Delavallée 11e813d7f3 [REF] mass_mailing: cleanup subscriptions update (optin / optout from lists)
PURPOSE

Overall cleaning of subscription and exclusion management code from portal.
This code comes mainly from v12 and can now benefit from cleaning and update.

SPECIFICATIONS

Purpose of this commit is to cleanup code that manages chosen lists from
portal and updates opt-in and opt-out accordingly.

Code is now located on mailing list model. When opting-it, new subscriptions
have to be created for mailing lists so that email is part of the list. When
opting-out we just have to toggle the opt_out flag on subscription model.

Logged messages are also improved. We log on contact model the updated
mailing lists for opt-in or opt-out.

Task-2669037 (Mass Mailing: Refactor js/portal for subscription)

Part-of: odoo/odoo#86084
2023-10-06 06:13:53 +00:00
Thibault Delavallée 32e3917b35 [REF] mass_mailing: rewrite subscription management JS
PURPOSE

Overall cleaning of subscription and exclusion management code from portal.
This code comes mainly from v12 and can now benefit from cleaning and update.

SPECIFICATIONS

Purpose of this commit is to get rid of old declarative javascript used in
mass mailing. It is still using old fashioned JS, not using widget or any
standard way of doing JS-based behavior in Odoo.

In this commit we introduce a main widget that manages the subscription page.
It has 3 sub widgets to manage parts of its features

  * blocklist management: add or remove current email from exclusion list.
    Adding an email in exclusion list is doable only if activated in settings;
  * feedback: allow user to give their feedback. It currently logs on target
    model, based on a hardcoded search on 'email_normalized' field. This is
    strange as not all models have a normalized email field, but who am I
    to judge anyway ?
  * subscription management: allow to opt-in and opt-out from mailing lists;

This commit mainly keeps the current behavior, just rewrites the JS part.
Some further feature or UI update will move into sub-widgets in subsequent
commits.

Some Markup issues are also fixed in this commit, as code is already updated.

Task-2669037 (Mass Mailing: Refactor js/portal for subscription)

Part-of: odoo/odoo#86084
2023-10-06 06:13:53 +00:00
Thibault Delavallée a2872cb981 [IMP] mass_mailing: add tests for unsubscribe mailing portal
Purpose of this test is to add tours and tests about the portal in mass mailing
that allows to unsubscribe from mailing list and to use the exclusion list.

This is done using small tours called from unit tests. Two type of tours are
added. The first one targets mailing done on mailing lists. As it targets
contact model unsubscription click opts-out the contact from the mailing
list. The second one targets mailing done on other documents. When clicking
on unsubscription link the document's primary email is directly added into
the exclusion list.

Some other additional tests are added to cover various use cases and features
of mailing controllers.

Task-2150462 (Mass Mailing: Improve subscription management)

Part-of: odoo/odoo#86084
2023-10-06 06:13:53 +00:00
Jorge Pinna Puissant ef424a9dc2 [REF] *: remove owl from linter's accepted global variables
Before this commit, owl was in the linter's accepted global variables.
This allowed  direct access to owl global object.

For instance, to use xml from owl, you could do :
`const { xml } = owl;`
or you could use it directly:
`owl.xml`

Now, owl is not accepted on linter's global variables anymore, so to
import xml, now you need to use a proper import:

`import { xml } from "@odoo/owl";`

task-id 3498859

closes odoo/odoo#137517

Related: odoo/enterprise#48364
Related: odoo/design-themes#709
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-10-05 10:21:53 +00:00
Xavier Luyckx (xlu) 2650d402af [FIX] mass_mailing: alert margin issue
Before this commit, in a Email Marketing form sheet, there was a
margin-left spacing on alerts and unnecessary old CSS rules.

This commit addresses and corrects that spacing issue.

task-3488229

closes odoo/odoo#137469

X-original-commit: 390fbed6b4c978de076887f755427d0f7c538c64
Signed-off-by: Xavier Luyckx (xlu) <xlu@odoo.com>
2023-10-04 08:39:17 +00:00
Brieuc-brd 3d1974543f [FIX] mass_mailing: adapt first/last drop zone position
Prior to this commit, the first drop zone at the top and the last one at
the bottom were half hidden.
This commit adapts their position in order to be fully visible.

task-3368793

Part-of: odoo/odoo#132653
2023-10-03 12:52:33 +00:00
luvi b91f4034ab [IMP] *: improve documentation of options in fields metadata
*: analytic,  base_automation, loyalty, mass_mailing, project, web, web_editor, website

This commit adds many new documentation of options and their usage for
fields. This makes them more usable and customizable in Studio, and adds
documentation for developers to know the type of expected option.

Some options that might lead to issues or that are too technical have
been removed, as they are not relevant and not required in most use cases.

task-3469741

closes odoo/odoo#134858

Related: odoo/enterprise#47148
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2023-09-27 14:57:03 +00:00
Michael (mcm) 7422eb643c [IMP] *: remove legacy rpc
This commit removes the files ajax.js and rpc.js then adapts all the
places where their exports were used. For most of the changes, it's a
replace of `this._rpc({...})` by a new `useService("rpc|orm")` like
pattern in the widgets.

closes odoo/odoo#136271

Task: 3439226
Related: odoo/enterprise#47775
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-27 11:33:01 +00:00
FrancoisGe d682871a8b [FIX] *: Wrong usage of onWillUpdateProps in Field
Since the new model (PR: odoo/odoo#114024), updating a record no longer
triggers a deep render and therefore no longer triggers the onWillUpdateProps
for Field components.

The goal of this commit is to adapt the usage of onWillUpdateProps
in Field composents in order to fix the bugs introduced by the RelationalModel

closes odoo/odoo#135842

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-22 11:55:55 +00:00
Pratik Raval (PRRA) 6ed7d952c4 [FIX] marketing_automation: fix mailing_filter widget
Before this commit:
The `mailing_filter` widget used to take the 2nd occurrence of a
many2one(selection) field and hide it in certain conditions, as it was assumed
that it is the field having the widget. Thus when there is more than 1
occurrence of a many2one field in the form view (before the field with the
widget), it used to hide random fields instead of targeted field.

After this commit:
The `mailing_filter` widget will only target the field with the widget, hence
solving the issue at hand.

Task-3430510

closes odoo/odoo#136094

X-original-commit: 4f5b8c47be4077cdaf7837062f518b7aef529d71
Related: odoo/enterprise#47678
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-09-21 20:38:02 +00:00
Aaron Bohy 0d7acf60b4 [REF] *: remove legacy Markup
Use owl.markup instead.

Part of task~3439226

closes odoo/odoo#134793

Related: odoo/enterprise#47124
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-11 19:13:59 +00:00
Michael (mcm) 36061a4ab0 [IMP] web: simplify owl_compatibility
This commit tried to remove owl_compatibility completely but its last
uses are either in refactoring or a bit complex to migrate. Instead of
removing the helpers completely, this commit simplifies them a lot and
makes them more readable and safe.

closes odoo/odoo#134295

Task: 3439226
Related: odoo/enterprise#46899
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-08 11:12:39 +00:00
Michael (mcm) 290a9b9055 [IMP] web_editor,*: use dialog service
*: mass_mailing,website,website_sale

Before this commit, the ComponentWrapper was used to mount some
components which then render a dialog. This commit replaces these cases
by using the dialog service.

Task: 3439226
Part-of: odoo/odoo#134295
2023-09-08 11:12:39 +00:00
Pierre Pulinckx (pipu) 038169ee9f [REF] web: simplify assets loading
In this commit, the loadXML function has been removed. We use registry with
xml_templates to load XML templates for OWL Apps.
The goal of task is to remove loadXML and getBundle from assets to simplify
the understanding of assets api.

task-3266441

closes odoo/odoo#134520

Related: odoo/enterprise#47001
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-09-07 09:00:28 +00:00
Damien Bouvy 180de8afe6 [IMP] web, *: replace view all with search more
This partially reverts commit da50ce31ae825ef9f4b527553a2e2caec970d290.

Whilst the behavioral changes done in the task are correct, the wording
is not optimal and was better understood by users before this change.

Task-3483936

closes odoo/odoo#133511

Related: odoo/enterprise#46503
Signed-off-by: Florent Dardenne (dafl) <dafl@odoo.com>
2023-09-04 17:10:05 +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
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
miad-odoo 2e3b13c040 [FIX] mass_mailing: fix phone preview
This commit fixes an issue introduced in #118966.  For the mobile preview
feature of email marketing, styles used to be loaded by rendering an "empty"
template with the necessary styles.  These styles, however, are no longer
imported in a template, but instead in mass_mailing's manifest.

The fix is to manually load the bundle and create the link tags to add the style
to the mobile phone preview.

Task-3465776

closes odoo/odoo#133400

X-original-commit: b2796d8016be83a1d08f28ef48e98db90c07da69
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-08-29 07:48:16 +00:00
Antoine Guenet 5996d98e66 [FIX] mass_mailing: hide the Mail Debug tab
The Mail Debug tab is confusing for users and should only be used by
people who know what can or cannot be expected from it. It is not
providing a good preview of the e-mail's rendering since the HTML it
displays is not meant to be rendered by a browser but by all sorts of
e-mail clients. This means that some things that render properly in it
won't necessarily render properly in some e-mail clients, but also
likewise that some things that don't render properly in it will in fact
render as expected in e-mail clients. This is why it's only available in
debug mode but since many users routinely enable debug mode to get
access to hidden features, this is not enough to prevent them from
reporting issues that are not issues.

closes odoo/odoo#133208

X-original-commit: 240ee9deb898f4346a9bc66548c881fc69e8b117
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-25 18:50:07 +02:00
Nicolas Bayet 4cca73816f [FIX] mass_mailing: fix indeterminist test mass_mailing_code_view_tour
The tour `mass_mailing_code_view_tour` indeterministically fails:

When clicking on save in the mass_mailing form, it trigger multiple
call to `MassMailingHtmlField.commitChange`. The expression
`await this.props.record.update({[fieldName]: inlineHtml});` will
subsequently temporarily add the class `o_form_dirty`, after the steps
of `stepUtils.saveForm` have been consumed by the tour.

When a tour finishes, some python code (see
`ChromeBrowser._handle_console`) check that there is no
`.o_form_dirty` element in the DOM. As the class `o_form_dirty` will
temporarily be in the DOM:
- if the check happen before the class is added or after it is
removed, the test will succeed
- if the check happens right before the class is removed, the test
will fail
As the timing is indeterministic, the test is indeterministic.

This commit uses `discardForm` rather than `saveForm` (to avoid having
`.o_form_dirty` from being temporarily added upon save)

Using `discardForm` can make a traceback occurs because a `setTimeout`
callback is called trying to use a selection that is undefined because
the document has been removed at the time of the call.

For this reason, this commit also check that the existence of the
selection.

runbot-23605

closes odoo/odoo#132983

X-original-commit: f34d87ecb7772417f1dd8f3d8836c89ddb903de8
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-25 12:20:58 +02:00
Antoine Guenet 6f560990b1 [FIX] mass_mailing: remove sidebar from conversion iframe
When converting an email for compatibility with email clients, we move
the contents of the editor iframe inside a new iframe, keeping only
what's in the iframe target element. But we failed to remove the sidebar
and other UI utils elements, which are irrelevant to the conversion.
Additionally, failing to remove the sidebar from the conversion iframe
made the snippets' images load again when committing changes.

task-3323894

closes odoo/odoo#126845

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-24 18:36:57 +02:00
Antoine Guenet d1a9e049f7 [IMP] mass_mailing: do not load images on add sidebar and commitChanges
Images in mass_mailing are not lazy loaded, which is deliberate for the
mailing itself and its conversion, but when we load the sidebar we add
the HTML to all the snippets and hide it so if these images are not lazy
loaded, they all get loaded along with the sidebar, which is slow and
unnecessary.

This loads the images only once we add them to the mailing, which is
when we remove the lazy loading attribute.

task-3323894

Part-of: odoo/odoo#126845
2023-08-24 18:36:56 +02:00
Nicolas Lempereur 7c035c4bd1 [FIX] mass_mailing: save codeview to style-inline
Scenario:

- edit a mass mailing while in debug mode
- switch to codeview
- do a change
- click on save

Issue:

The body_arch is updated (making it seems like our change are taken into
account), but the body_html is not and the outdated version will be sent.

Solution:

With this change, when we commit the changes and have the codeview
opened, we will first update the wysiwyg editable to the current
codeview value, before updating body_html.

related to opw-3103549

closes odoo/odoo#132129

X-original-commit: 576bee4b7e426f45c7bf418b9762a46407f66549
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2023-08-22 18:59:18 +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
Gorash 0d99f4b9d9 [REF] base,all: Update modifier syntax: adapt JavaScript
closes odoo/odoo#104741

Related: odoo/enterprise#35255
Related: odoo/documentation#3523
Related: odoo/upgrade#4884
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2023-08-18 09:49:16 +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
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
Jorge Pinna Puissant f956e83c74 [REF] *: remove qweb.render
This commit removes the qweb.render method, instead it will use the owl
render engine (renderToString or renderToElement).

Part of task~3443861

Part-of: odoo/odoo#130467
2023-08-11 14:32:28 +02:00
Jorge Pinna Puissant 7b1d82aa9b [REF] *: add t-key when needed on the template
As all the templates are now imported in the owl app, the templates must
comply to owl.

t-key is mandatory when using a t-foreach

Part of task~3443861

Part-of: odoo/odoo#130467
2023-08-11 14:32:27 +02:00
Louis Wicket (wil) f1722c7334 [IMP] *: unify sprintf and gettext
Improve gettext to directly handle value injection within translations,
removing the need for sprintf.

closes odoo/odoo#123932

Related: odoo/enterprise#45370
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-08-10 18:14:04 +02:00
Nicolas Bayet f5405d61e7 [FIX] web_editor,mass_mailing: remove unnecessary loading of html2canvas
Since #119325, html2canvas is not used for the toInline process anymore.
Loading the script was still done in the web editor and mass mailing,
which is not needed anymore.

task-3446888

closes odoo/odoo#130862

X-original-commit: e3c9d3c4fb013124faf6d132297171a34854f991
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-08-09 01:53:07 +02:00
Pierre Pulinckx (pipu) b1ebe3b6f4 [REF] *: Replace core._t imports
In this commit, _t import from import { _t } from
"@web/legacy/js/services/core" and from
 web/static/src/legacy/js/core/translation.js are replaced by
@web/core/l10n/translation.js.

task-3292454

closes odoo/odoo#130865

Related: odoo/enterprise#45270
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-08-09 00:13:08 +02:00
Michael (mcm) 00d8aef1c7 [REF] web, *: remove legacy patch
This commit removes legacy patch/unpatch functions and adapts their use
by using the modern patch. There was also a custom patch function used
in tests which has been replaced too.

closes odoo/odoo#130867

Related: odoo/design-themes#685
Related: odoo/enterprise#45271
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-08-07 10:58:48 +02:00
Renaud Thiry e7635bc705 [FIX] mass_mailing: toggle fullscreen once
In 16.0 and up, when toggling full-screen mode on the mailing editor
the iframe content is not properly made scrollable.

This is due to the toggle method being triggered 4 times
which effectively cancels the effect.

The reason for it being triggered 4 times is that the check that would
prevent multiple event listeners from being set on the button compares
an existing jquery object to a new one on the same element.
As these are two different references to the same element
they are still different objects and thus the listener will be added
even if they reference the same iframe.

The fix is simply to compare the html elements directly, if they exist.
We also add the expected state of 'full screen' to the class toggle
as it may avoid other inconsistencies from blindly toggling.

task-3446768

closes odoo/odoo#130853

X-original-commit: 30f27563868af4b247c96c24135c1003aa191cef
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-08-04 15:02:38 +02:00
Antoine (anso) 59828459ad [IMP] mass_mailing: restore sheet
This commit restores the sheet layout in mass_mailing for consistency
reasons.

The chatter was extracted from the tab it was in and moved back on
the right side.

This commit also fixes an alignment problem when an alert is displayed
and the alert was vertically bigger that the buttons of the status bar

task-3355071

closes odoo/odoo#130616

Forward-port-of: https://github.com/odoo/odoo/pull/126646
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-08-03 19:31:36 +02:00
Aaron Bohy 3fac03b7f4 [REF] web,*: remove legacy Domain, Context and pyjs
This commit removes the legacy implementations of Domain, Context
and the pyjs library. All of them exist in the new codebase, and
the few pieces of code that were still using the legacy ones have
been adapted.

Part of task~3439226

closes odoo/odoo#130647

Related: odoo/enterprise#45129
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2023-08-03 18:02:55 +02:00
Michael (mcm) 9d6b380a24 [REF] *: adapt patches after new patch function
In the commit [1], the patch has been refactored to support the
native keyword `super`. The current commit just adapts the codebase
to that change.

task 3410198

[1]: 19ea1ac08043e22a811630968e44715cc3bfc495

Part-of: odoo/odoo#125716
2023-08-02 17:29:05 +02:00