Commit Graph
18015 Commits
Author SHA1 Message Date
abd-msyukyu-odoo 62ca95f0fd [IMP] mail, web: create FileModelMixin for FileViewer
Extract basic props needed by the `FileViewer` for `files` instances in a
reusable `Mixin`.

task-3172056

Part-of: odoo/odoo#127021
2023-10-13 07:33:52 +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-Yves Dufays 35d5342887 [IMP] {test_}mail, various: generalize activity plan + activity batch schedule
Generalize the hr.employee activity plan to any model, allowing to create
activity plan that can be launched on any model.

The activity can now be created in batch by selecting multiple record in the
list view and then clicking on a "clock" icon in a row similarly to the batch
records update (selecting multiple records allows to change for example their
name in batch in the list view). We implement also that functionality for the
plan, allowing to launch a plan on multiple records at once.

We also centralize the launching of activity or activity plan through either
the  "Activities" button in the chatter or the "clock" button in the view list.

Scheduling activity is now taken in charge by a wizard that can schedule a
single activity as well as a plan. We add/update tests for checking that the
wizard is launched with the right record selection (on a single record or a
batch) and add tests for checking the wizard itself.

The plan can be defined through an added menu in the technical admin menu but
also through configuration menu added in the module crm, project.

Technical notes:
In the added wizard, to determine that there is a error, we introduce the
has_error field because we cannot use easily the error field for that. Indeed,
to determine that there is no error, we have to compare it to "<p><br></p>"
(more precisely &lt;p&gt;&lt;br&gt;&lt;/p&gt;) which is not handy and may
change in the future. This is because when we write False on field error and
read it after, we get "<p><br></p>". Instead, we centralize this weird
comparison in the model in the compute method of has_error.

The ActivityListPopover still displays the activity of the record on which it
has been triggered but the button to schedule activity will launch a wizard
that create activities in batch for the selected records if more than one was
selected. For that, the ActivityListPopover component receives now an
additional prop: resIds (selected records) on top of the resId prop (record on
which the popup has been triggered). Note that when the line that trigger the
popup is not selected, the batch mode is disabled to avoid confusion.

Test are updated because the wizard is opened instead of the activity form to
schedule a new activity and as the form view is only used to edit already
existing activities, default_res_id and default_res_model are no longer passed.

We defines date_deadline and date_plan_deadline in the schedule wizard because
those date are managed differently (default value, required or not, ...).

Task-3390865

Part-of: odoo/odoo#137969
2023-10-12 16:12:09 +00:00
Pierre-Yves Dufays ed4f6d3dbe [MOV] web, mail: move filterable selection
We move the filterable widget from loyalty to web to make it more widely
accessible to other applications. It will soon be used in the new activities
plan feature.

Following the move of the filterable selection widget to the web module, we do
some light cleanup.

Task-3390865

Part-of: odoo/odoo#137969
2023-10-12 16:12:09 +00:00
Julien Carion (juca) 18819bdb4b [IMP] web: remove jquery from database_manager
This commit removes usages of jquery in database_manager and adapts the
code accordingly. Also improve the alert messages.

task-3508327

closes odoo/odoo#137670

Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-10-12 16:12:08 +00:00
Pierre ParidansandAdrien Dieudonné b75a66af1a [IMP] web,crm: remove extend for text colors
task-3546717

closes odoo/odoo#138467

Related: odoo/enterprise#48830
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Co-authored-by: Adrien Dieudonné <adr@odoo.com>
2023-10-12 14:44:57 +00:00
FrancoisGe 9211a6f33f [FIX] web: calculate specialData when record is updated
The goal of this commit is to cause a recalculation of specialData when
this depends on a record value.
Currently, specialData are only calculated during onWillStart and
onWillUpdateProps. But the specialData of certain fields do not depend
only on the props, they can also depend on the values present in the record.
We therefore want to recalculate them when the value of the record changes.

How to reproduce:
- Go to a form view with a field "x" and
  a field with specialData dependent on field "x".
- Edit the field "x"

Before this commit:
    The specialData have not changed

After this commit:
    The specialData have been recalculated.

closes odoo/odoo#138372

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-12 14:44:50 +00:00
Romeo Fragomeli b49a5d1b01 [FIX] web: improve useSortable when no placeholder is not a clone
Sortable uses the "enter" and "leave" events to handle the move of the
placeholder in the container. When the initial drag element is cloned,
the algorithm is more simple as the placeholder takes the same size as
the original one. When we use a custom placeholder (in our case, a small
line) and the placeholder change position, it triggers an "enter" and
"leave" events in loop due to the smaller size of the placeholder.

This commit ensures the placeholder to move only one time per pointer
event move ("enter" and "leave") and avoid flickering when we move one
element on the first/last element.

Note: a better solution to avoid this complexity is to use pointer
"move" event instead of "enter" and "leave".

closes odoo/odoo#138350

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-10-12 13:16:48 +00:00
FrancoisGe c5b87e130b [FIX] web: update properties field
The purpose of this commit is to resolve two issues relating to the properties field:

Issue 1:
========
In a list view, when you edit a property and then select another field
in the same record, the edition disappears.

How to resolve:
--------------
Do not delete the changes linked to the property in record.update.

How to reproduce:
----------------
- Go to a list view with a properties field containing a property char
- Insert a value in the char property
- Click on another field in the same record

Before this commit:
    The inserted value disappears

After this commit:
    The inserted value is still present

Issue 2:
========
The fields/activeFields only take into account properties received
during the initial web_read and not those added by an update or an onChange.

How to resolve:
--------------
Generate property fields and activeFields during parseServerValue
(web_read and onChange) and during an update.

How to reproduce:
----------------
- Go to a form view with a properties field
- Editing a field with an onChange
- The onChange returns a new property for the properties field

Before this commit:
    A crash is displayed

After this commit:
    The new property is displayed correctly

closes odoo/odoo#137989

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-12 13:16:44 +00:00
Xavier Morel 57984131f7 [REM] web: pwa registration success log
odoo/odoo#136944 removed the log from website_event_track, but despite
noting the discontinuity I missed that *a new instance of the log line
had been added in 16.1* and that is likely why 16.1 was suddently
spammed with that: website_event_track (likely) only installs its PWA
when opening an event on website, but since odoo/enterprise#35322 the
web client tries to install its PWA *every time it's loaded*, which
can be up to once per test for qunit tests (if they need a webclient).

In odoo/odoo#133560 this registration was moved from enterprise to
community, so needs to be nuked here as well.

Follows the removal of this log line in odoo/enterprise#48831.

closes odoo/odoo#138469

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-10-12 11:20:36 +00:00
MerlinGuillaume af73206892 [FIX] web: add help tooltip from form view on fields
The help defined on a field via Studio is only visible when debug mode
is enabled

Steps to reproduce:
1. Install Contacts and Studio
2. Go to Contacts, open a contact and toggle Studio
3. Add a field in the form view and add a message in the Help Tooltip of
   the field
4. Close Studio
5. Without debug mode, the small question mark is not displayed next to
   the field so we cannot see the help tooltip

Solution:
First use the help defined on the field in the view, then the help
defined on the field in the model

Problem:
The tooltip help can also come from the view

opw-3511121

closes odoo/odoo#138416

X-original-commit: a70639b790471aec781c50274abbda78bf5bea7d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
2023-10-12 11:20:34 +00:00
MerlinGuillaume 3463c48cad [FIX] web: limit width of search bar favorites
With long favorite names, the search menu overflows to the left of the
screen

Steps to reproduce:
1. Install any app with a search bar (e.g. CRM)
2. Open the app and save the current search as a favorite, enter a
   really long name (200 characters or more)
3. The search left side of the search bar is not visible anymore

Solution:
Limit the width of the search bar menu and of the favorite menu. The
purpose of the maximum width on the search bar menu is for a correct
display in mobile view. We also take into account the comparison menu
(that can be displayed if you add a filter on creation date)

opw-3442705

closes odoo/odoo#138415

X-original-commit: 107f496b5e67ca3293e2c63a273cf8c491187fb5
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
2023-10-12 11:20:33 +00:00
Julien Carion (juca) f99efb0173 [IMP] web: domain field: Add condition in folded domain field
This commit adds the recently removed add condition button to the folded
domain field so the user can unfold the domain and add a new rule in one
click.

Task-3525269

closes odoo/odoo#137663

Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-10-12 09:49:45 +00:00
Michael (mcm) 7ebd785764 [IMP] *: rename quick_add into quick_create
This commit renames calendar's attribute quick_add to quick_create
to be more consistent with other views.

closes odoo/odoo#138042

Related: odoo/enterprise#48677
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-11 17:02:07 +00:00
Michael (mcm) 3846472e96 [REF] web,calendar: split calendar quick_add attr
Since the PR [1], quick_add can be both a boolean and an id:
0 = without quick create
1 = with quick create and simple dialog
other number = with quick create and custom form view dialog

This is not great to have both behavior in a same attribute so this
commit split them back in two attributes as it was before [1].
It's easier to understand when we want a quick create and which view
to use in the dialog.

[1]: https://github.com/odoo/odoo/pull/122923

Part-of: odoo/odoo#138042
2023-10-11 17:02:07 +00:00
Adrien Schoffeniels 2d7a49dab1 [IMP] web: move properties field's "add a property" btn in the cog menu
Purpose:
--------
When the property field is added into a form view, the "add a property"
button is shown by default.
However, most of the time the users won't add properties when opening a
form view, making this button take up space for nothing.

To alleviate this issue, commit [1] added an option that allows to hide
this button, and added actions to allow adding properties from the cog
menu instead.

Now that properties are being added into several views, one would like
this "add properties" button to be hidden by default, and show an entry
in the cogmenu allowing add properties by default, without needing to
create an action for every view using a property field.
Therefore, a new static action "Add Properties" has been added in the form
controller that is available if a properties field has been encountered
during the parsing of the form view's arch.

The "hideAddButton" has been changed into "showAddButton" and now allows
to show the "Add a Property" by default.

Task-3458627

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

Part-of: odoo/odoo#137589
2023-10-11 17:02:02 +00:00
Aaron Bohy dc2be03dba [IMP] web,*: lazy load jSignature lib and extension
The jSignature lib is only used by the NameAndSignature component,
which is not accessible on a many screens. This commit thus
removes the lib and its extension from the bundles, and makes the
NameAndSignature component load it on demand.

Part of task~3439226

closes odoo/odoo#138054

Related: odoo/enterprise#48633
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-10-11 08:18:46 +00:00
Aaron Bohy 4bf1384e8b [REF] web,sale,portal: adapt SignatureForm to owl
This commit converts the SignatureForm widget into a Component.
This allows to remove the last usage of the legacy NameAndSignature
widget, which we thus remove.

Part of task~3439226

Part-of: odoo/odoo#138054
2023-10-11 08:18:46 +00:00
Aaron Bohy 634409188c [IMP] web: url utils: add redirect function
This function must be used to safely redirect to another url. It
ensures that we stay on the same origin, and thus that the url is
safe.

Part-of: odoo/odoo#138054
2023-10-11 08:18:46 +00:00
Pierre Pulinckx (pipu) daecbbac50 [REM] web: redundant escapeHTML function
In a6fea37, escapeHTML was introduced to replace the corresponding
underscore.js function. It is very similar to the widely used escape
function, except it additionally escapes single (') and double (")
quotes.

The additional escaping is not generally harmful, and is necessary to
safely inject values into attributes. As escapeHTML is almost unused,
remove it and update escape to include quotes.

taskId : 3522892

closes odoo/odoo#137216

Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-10-10 14:07:09 +00:00
Rémy Voet (ryv) 0782ec07e7 [FIX] web: display_name "New" fallback should only target new record.
There is a fallback in the control panel
(https://github.com/odoo/odoo/blob/c22cb6bbadd38ecb050f6d4dc14672868beda20b/addons/web/static/src/search/control_panel/control_panel.xml#L137)
if the display_name of the record is empty.
But it is never actually used because there is another
fallback in the form_controller ("New"). This latter fallback
should only be used for new records, not for existing ones.

closes odoo/odoo#138061

Signed-off-by: Raphael Collet <rco@odoo.com>
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2023-10-10 12:35:01 +00:00
Rémy Voet (ryv) 56bd53d81f [FIX] web: take in account false as a valid display_name
The previous commit reverts the ORM fallback of `display_name`. Then the
`display_name` can legitimately be `False` again. But the `Many2one` and
`Many2XAutocomplete` components don't handle this case (and generate a
traceback see task-3424154).

This commit adds the same fallback ('Unnamed record') for these two
problematic components; one when the name_search returns `False` as
`display_name` (autocomplete for Many2Xfields) and another when we read
the many2one `display_name`. This name is not user friendly, but for
the business model it shouldn't happen anyway. It is also better than
the empty string which is confusing with no value. Note that there is
already a fallback for `display_name` that is used in the broadcrumb
(https://github.com/odoo/odoo/blob/50b2a24f22cb470bcc1a9befe677cf794211d7b2/addons/web/static/src/views/form/form_controller.js#L282).

Part-of: odoo/odoo#138061
2023-10-10 12:35:01 +00:00
William Henrotin b05b4f3f7a [FIX] web: mock barcode service
Some Qunit tests (in stock_barcode module) need to mock the barcode
service in order to be executed correctly.
This commit adds a new helper function that simulate the barcode service bus.

closes odoo/odoo#136236

Related: odoo/enterprise#48054
Signed-off-by: Steve Van Essche <svs@odoo.com>
2023-10-10 12:34:59 +00:00
Kartik ChavdaandKamlesh Pathekar e3bc974ea4 [IMP] base,** : make error message user friendly
Before this commit error messages in odoo are boring and
not much attractive to user. Those were like odoo is preventing
them from doing something user want to do.

In this commit, we have modified the message to be a more friendly
and humorous tone, making it less tedious and more enjoyable. It
aims to enhance the user experience and ensure that interactions
with any application are both pleasant and informative. As a result,
the messages have been clear, short, easy to understand and informative.

task-3356114

Part-of: odoo/odoo#124820
Co-authored-by: Kamlesh Pathekar <kpt@odoo.com>
2023-10-10 12:34:56 +00:00
Aaron Bohy c659d10126 [REF] web,crm: remove tempusdominus scss customization
The tempusdominus library has been removed by [1]. This commit
removes scss customizations of the library that have been forgotten.

[1] 910897fc97

closes odoo/odoo#138129

Related: odoo/enterprise#48657
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-10-10 11:07:56 +00:00
Thomas Becquevort (thbe) da89bbe07c [IMP] web: No quick filter available message replacement
Description of the issue/feature this commit addresses:

When opening a view with the quick filters available with a domain which
returns no data, a message shows up saying that no filter is available for
the data that has been retreived and tells the user that updating the filters
will allow him to display more records and maybe make the quick filter
available. This message is displayed in a way which is not so great for user
experience as it is written in a very thin column making the text being
written one word per line. The example used to point out that problem is using
the mexican localization, going in the accounting app, in the tax report
and clicking on any value equals to zero.

Desired behavior after the commit is merged :

This commit replaces that message with a "All" button like it would be if the
domain had returned data and some filters were available. Only this time, no
filter is available under the button as there is still no data to filter.

Adding this fix, there is no messy message showing up in the quick filters
column when the query was not able to rertrieve any data with the given domain.

task-3462024

closes odoo/odoo#138060

X-original-commit: 262b71aad23296f059938496a740ba61e71daea8
Related: odoo/enterprise#48636
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Signed-off-by: Thomas Becquevort (thbe) <thbe@odoo.com>
2023-10-10 08:19:36 +00:00
Aaron Bohy b3972b26a1 [REF] web,*: remove legacy service provider
This service was used to redirect legacy service requests to the
wowl service infrastructure. It has been incrementally simplified
with the codebase getting converted. It now only allows to redirect
calls to the effect service, which doesn't seem useful anymore.
This commit thus removes it.

Part of task~3439226

closes odoo/odoo#138120

Related: odoo/enterprise#48654
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-10-10 07:15:47 +00:00
Abdelouahab (abla)andJulien Castiaux 5dd1efe3d8 [FIX] auth_oauth: missing user in signin endpoint
Install auth_oauth and via the /web/login, click the "Log in using
Odoo.com" button. You are redirected on odoo.com which ask you for your
odoo.com login and password. When the login form on odoo.com is
submited, you are redirected back on your local database.

The problem is that, in case a new account was created on-the-fly, then
the login fails with a cryptic error. The actual error is that
`request.env.user._is_internal` fails because `user` is an empty
recordset where it should had been the just-authenticated user.

The problem is an inconsistent transaction state between the cursor of
the request, the cursor used with `auth_oauth` (which created a new
user) and the cursor used with `authenticate` (which authenticated the
new user). Yes, there are 3 cursors. The newly created user just isn't
present in the transaction of the request's cursor.

Here is the lifetime of the 3 cursors:

* request.env.cr, it begins when the http request enters Odoo, it is
  commited when a http response exits Odoo.
* /auth_oauth/signin, it begins roughly at the beginning of the
  controller, it is commited once after the user is created (so before
  the authenticate transaction begins but AFTER the request transaction
  begun), it is commited again when the controller exits.
* authenticate, begins when authenticate is called, is commited when it
  returns.

Because the request transaction started before, it cannot access user
created by /auth_oauth/signin.

Because the route is `auth='none'`, if system administrators append the
`auth_oauth` module via `--load` (cli) or `server_wide_modules` (odoorc)
then the controller can be accessed without database. This is the reason
for the explicit registry/cursor/environment inside this controller, we
needed to make sure we are connected to a database, we cannot rely on
request.

The new approach used in this work is to benefit from `ensure_db()`, the
function that is used by various web `auth='none'` controllers such as
/web and /web/login. It makes sure that the database we want to connect
to is already present on the request, otherwise it repeats the request
but this time connecting it to the database. Using this approach we can
have a `auth='none'` controller whose request.env is guaranteed to be
connected on the right database. We can avoid to create explicit new
registry/cursor/environment within the controller and just use request's
ones.

Because the /auth_oauth/signin controller now simply use the request
transaction, the above point:

> Because the request transaction started before, it cannot access user
> created by /auth_oauth/signin.

just doesn't stand anymore as the user is created within the same
transaction. The extra `cr.commit()` must still be present for
`authenticate` to see the newly created user.

opw-3421701

closes odoo/odoo#138051

X-original-commit: e165568f9795af213c8467a7f17948ed781b0799
Signed-off-by: Olivier Dony (odo) <odo@odoo.com>
Co-authored-by: Julien Castiaux <juc@odoo.com>
2023-10-10 01:59:48 +00:00
Romeo Fragomeli 5f454f0ccb [IMP] web,web_editor,website_slide: sortable service for frontend usage
This commit removes the module sortable from jQueryUI and adds instead a
sortable service to use the sortable code already used by the backend.

The service can be called using `this.call("sortable", ...)` and the
sortable listeners are added when the `enable` function is called.
This function (`enable()`) returns an object that contains the `cleanup`
function (`cleanup()`).

```javascript
// start / setup
const sortable = this.call(
    "sortable",
    "create",
    {
        ref: { el: document.querySelector(".list") },
        elements: ".items",
        handle: ".drag-icon",
    },
);

// on attach callback / on mounted
const sortableInstance = sortable.enable();

// on destroy / on willUnmount
sortableInstance.cleanup();
```

Also, it adds some new property to the useSortable:
* clone: the placeholder is a clone of the drag element
* placeholderClasses: classes added to the placeholder element
* applyChangeOnDrop: on drop the change is applied to the DOM
* followingElementClasses: classes added to the element following mouse

task-3439226

closes odoo/odoo#137527

Related: odoo/enterprise#48371
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-10-10 01:59:35 +00:00
Romeo Fragomeli 9c970b13b7 [REF] board,web: adapt useSortable to be used natively
This commit removes Owl hooks from the sortable hook builder file and
introduces a new parameter attribute (`setupHooks`) to specify which
functions must be used to set up, update and tear down the draggable
hook.

This has been done to allow using the hook function in environments
where Owl is not available.

Part-of: odoo/odoo#137527
2023-10-10 01:59:35 +00:00
Romeo Fragomeli 917f5f29ce [REF] web: avoid magic number
Part-of: odoo/odoo#137527
2023-10-10 01:59:35 +00:00
Julien Mougenot 8349f8f2a8 [REF] web,*: make draggable hook builder independant from Owl
This commit removes Owl hooks from the draggable hook builder file and
introduces a new parameter attribute (`setupHooks`) to specify which
functions must be used to set up, update and tear down the draggable
hook.

This has been done to allow the draggable hook builder function to be
used in environments where Owl is not available.

Part-of: odoo/odoo#137527
2023-10-10 01:59:35 +00:00
Aaron Bohy daf05d48ac [IMP] *: views: deprecate active_* keys from evalContext
This commit aims to simplify the evaluation context used to
evaluate expressions used in views (invisible, required, readonly,
domain and context attributes). For now, the evaluation context is
typically the current record (there's a key for each field in the
view). In addition to that, there're static keys (that may conflict
with field names): uid, allowed_company_ids, current_company_id,
active_id, active_ids and active_model.

The motivation of this commit is at some point to get rid of the
3 active_* keys, because they are misleading and basically useless.

The notion of active_* exists, but it is something else: when you
are in a form view (let's say the form of a partner) and you open
its opportunities (by clicking on the stat button), the list view
of opportunies shows up and in the context, there're 3 keys
active_*, referring to the record from which we came. One can
easily access those information with context.get("active_*"), in
python or in view archs.

However, almost all `active_id` found in archs were actually used
to refer to the id of the current record. Indeed, for now, in the
evaluation context of a record, the value of the `active_id` key is
always the id of the record. So this commit adapts them to
directly use `id` instead. There was no use of active_ids, and
a single use of active_model which was removed (active_model is
the res_model of the view, so it isn't really necessary).

This commit doesn't drop the support of those keys, it deprecates
them. They will be removed for v18. A warning will be displayed if
they are used.

closes odoo/odoo#136665

Related: odoo/enterprise#47917
Signed-off-by: Raphael Collet <rco@odoo.com>
2023-10-10 00:54:04 +00:00
Lucas Lefèvre 25eec6820b [IMP] spreadsheet: export views with contextual domain
Purpose
-------
Currently, views with a contextual filter/domain are not well managed: e.g.

Today Activities
=> domain=[('my_activity_date_deadline', '=', context_today().strftime('%Y-%m-%d'))]

My pipeline
=> domain=[('user_id', '=', uid)]

Currently, 'context_today().strftime('%Y-%m-%d')' or 'uid' would be replaced by
their values when the view is inserted into a spreadsheet.
If the view is inserted on the 1st June 2023, the date "01/06/2023" is
hard-coded in the spreadsheet.

Specification
-------------
Preserve the domain dynamic parts when inserted into a spreadsheet.

Implementation note: I force the readable format at export just to be sure it
exported that way, no matter the domain origin.

closes odoo/odoo#131874

Task: 3414027
Related: odoo/enterprise#45748
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-10-09 13:25:23 +00:00
Pierre Rousseau bd0f2c6d79 [IMP] web: introduce MultiRecordSelector and RecordSelector
This commit introduces two new components, MultiRecordSelector and
RecordSelector, which are used to select multiple records and a single
record respectively.

The MultiRecordSelector component is used to display the selected
records with a tag-like style. It also allows to add new records by
typing/selecting a valut in the input field.

The RecordSelector component is used to display the selected record and
allows to select a new record by typing/selecting a value in the input
field.

These components are created from the DomainSelectorAutocomplete and
DomainSelectorSingleAutocomplete components, which are now an extension
of the MultiRecordSelector and RecordSelector components respectively.

This commit also add tests for these two components.

Part of task-id 3433922

closes odoo/odoo#137650

Related: odoo/enterprise#48423
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-09 07:00:06 +00:00
Pierre Rousseau 176d3be297 [IMP] web: add support for domain and context in DomainSelectorAutocomplete
This commit adds support for domain and context in DomainSelectorAutocomplete.
This is a step towards the simplification of the Record component.
We would like to remove the case where the Record component is used with
fake resModel/resId only to display a Many2ManyTags or a Many2One.
Instead, we could simply use the DomainSelectorAutocomplete or
DomainSelectorSingleAutocomplete to achieve the same result.

Part of task-id 3433922

Part-of: odoo/odoo#137650
2023-10-09 07:00:06 +00:00
Guillaume (gdi) b3a1d0f9d0 [IMP] website, *: use BS mixin to have responsive font sizes
*: auth_totp_portal, event, portal_rating, web, web_tour, website_blog,
   website_event, website_event_booth, website_event_sale,
   website_event_track, website_event_track_quiz, website_payment,
   website_sale, website_sale_comparison, website_slides,
   website_twitter

This commit allows to have responsive font sizes on all the Odoo
frontend. It is based on the Bootstrap mixin `font-size` which
calculates the font size based on the viewport width.

task-1958098

closes odoo/odoo#129469

Related: odoo/design-themes#673
Related: odoo/enterprise#44578
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-10-08 22:12:13 +00:00
abd-msyukyu-odoo d464ba7c7e [IMP] web: add download error management util
As `download`, the `downloadFile` util is able to perform an `XMLHttpRequest`
(`GET`) if it is provided with only an url. Change the return value of
`downloadFile` in that case to a `Promise`, to match the behavior of `download`.
Previously, the `XMLHttpRequest` was returned to allow the caller to modify the
headers of the request, but that feature was not used.

Extract the configuration of the `XMLHttpRequest` for `download` to a separate
function so it can be used for both `download` and `downloadFile`. It will set
the `responseType, onload, onerror` properties.

Tracking:
- usage of `downloadFile` in Knowledge introduced in [1].

[1]: https://github.com/odoo/enterprise/pull/47056

task-3517796

closes odoo/odoo#137893

X-original-commit: 787f207f9882807598273c34296d0c1d8081f1b5
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Damien Abeloos (abd) <abd@odoo.com>
2023-10-08 11:52:07 +00:00
Brieuc-brdandqsm-odoo 24a4cb1ce4 [IMP] web, website_sale: review active light buttons
Prior to this commit, toggle inputs using light color had no active
color.

This commit adds an active state in order to match the other active
colors.

task-3097005

Part-of: odoo/odoo#120302
Co-authored-by: qsm-odoo <qsm@odoo.com>
2023-10-08 10:45:45 +00:00
stefanorigano (SRI)andBrieuc-brd a2c496c4a4 [IMP] web, website: review pagination design
In the context of the website's theme redesign, this commit adapts the
pagination component design.

task-3097005

Part-of: odoo/odoo#120302
Co-authored-by: Brieuc-brd <brd@odoo.com>
2023-10-08 10:45:45 +00:00
0d96be06fa [IMP] website, *: improve the default theme
*: web, web_editor, portal, theme_default, website_sale

The goal of this commit is to improve the overall style of the default
website theme mostly by overriding Bootstrap variables with a bit of
customization for more advanced changes.

task-3097005

Part-of: odoo/odoo#120302
Co-authored-by: Brieuc-brd <brd@odoo.com>
Co-authored-by: Antoine (anso) <anso@odoo.com>
2023-10-08 10:45:45 +00:00
tsm-odoo a97abef2d2 [IMP] im_livechat, mail: allow livechat visitors to upload attachments
Since [1], live chat visitors are using the mail guest system for
authentication. With this change, visitors are allowed to reach the
attachment upload routes (even if nothing allows it in the frontend
for now). This commit restricts attachment upload for guest and portal
users with the `allow_visitor_upload` field that can be toggled.

At the same time, this commit enables file upload when authorized
on the frontend and for cross origin live chats.

[1]: odoo#129770

task-3332628

closes odoo/odoo#137574

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-10-06 18:18:29 +00:00
Pierre Pulinckx (pipu) 844448320d [FIX] web: fix bus of loading indicator
We do not clean the event handlers properly (because we do .bind()).
So we have another version of the handlers and they are not unbinded.
In this commit, to remedy this, we use the useBus function which
resolves this problem.

closes odoo/odoo#137885

X-original-commit: 7e2e2e0b257d44ce051a3ee8f60e9e03f5d14739
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-06 17:11:27 +00:00
Aaron Bohy 9e46a8a58c [REF] web,*: remove owl.App.validateTarget override
The motivation of this commit was to remove the override of owl
that disables the validateTarget check, which we believed was
necessary for the renderToString function.

Fun fact: renderToString doesn't seem to need the override, as
validateTarget is only called when mounting an app and when
completing a fiber, which renderToString doesn't do. It was instead
probably necessary for the legacy compatibily layers that have now
been removed.

So this commit removes the validateTarget override.

This commit also simplifies the setup of the renderToString fn by
lazy creating the app itself, instead of requiring the application
setup to set the main app as renderToString app (e.g. main.js in
web).

Part of task~3508223

closes odoo/odoo#137807

Related: odoo/enterprise#48514
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-10-06 14:33:45 +00:00
Martin Trigaux 22ab49e343 [IMP] *: use file_path and file_open
Replace all the calls to get_resource_path to the better file_path or
directly use file_open when not needed

Doing both a get_resource_path and file_open means checking twice that
the file exists.
Doing a simple path concatenation before a file_open is safe.
If given to another method (e.g. etree.parse), calling file_path is
the prefered method.

Note that get_resource_path used to return False when the file does
not exists while file_path/file_open raises a FileNotFoundException

closes odoo/odoo#135607

Related: odoo/upgrade#5187
Related: odoo/enterprise#47475
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-10-06 14:33:43 +00:00
FrancoisGe e1f71525ee [FIX] web: create record with properties in Calendar
Before this commit, creating a record in Calendar view that has a
properties field in its form view causes a crash.

How to reproduce:
----------------
- Go to the Project app
- Go to a task
- Add a property
- Go to the Calendar view of the project
- Create a record

Before this commit:
    An error is displayed

After this commit:
    The form dialog opens so that you can create the record

closes odoo/odoo#137828

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-06 13:09:02 +00:00
FrancoisGe 2e735d2832 [FIX] web: mockServer onChange should only return fields from view
Before this commit, when calling onchange, the mockServer returned all
the changes present in the onchanges functions defined on fields.
The expected behaviour is to return only the changes required by the view.

Part-of: odoo/odoo#137828
2023-10-06 13:09:02 +00:00
FrancoisGe c830d9bc9d [FIX] web: Record.update with onChange
The goal of this commit is to resolve:
=====================================
1. When you edit a Char or Boolean field with an onChange that returns
   the value before editing, you must display the value of the onChange.
2. In the model, html fields are always Markup fields. But when we evaluate
   a modifier containing an html field, we use the server value (a string or false).
3. When we edit a field and its onChange returns an server error, we want to
   revert its value to the valuea before edition.

Solution:
=========
1. Always render when applying a change, even if the value does not change,
   because onChange returns the initial value. To do this, we'll apply
   the changes to record.data, then apply the changes from onChange.
   The value will therefore change, which will cause all the components
   observing the value in record.data to render.
2. When we update an html field, its value will always be markup and
   we'll store it as a string in _textValue so that we can evaluate the
   modifiers without the markup. For changes coming from the onChange, we
   will store the value in _textValue and apply markup on it for record.data.
3. When an onChange returns an server error, we will apply the changes and then
   revert them directly. This will have the effect of triggering a rendering
   on all the components observing to the record.data corresponding to
   the changes and so displaying the values before editing.

How to reproduce:
=================
Case 1:
------
- Go to a form view containing a boolean field with an onChange
- Check the boolean field
- The onChange returns with the value false

Before this commit:
    The boolean field is always checked

After this commit:
    The boolean field is no longer checked

Case 2:
------
- Go to a form view containing an html field and an field "x" with
  invisible ="not html_field" and an onChange
- Edit the field "x"
- The onChange returns the value false for "html_field".

Before this commit:
    The field "x" is always displayed

After this commit
    The field "x" is no longer displayed

Case 3:
------
- Go to a form view containing a char field with an onChange
- Edit the field
- onChange returns a server error

Before this commit:
    The field is marked as invalid and contains the value after editing.

After this commit:
    The field contains the pre-edit value

closes odoo/odoo#136924

Related: odoo/enterprise#48515
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-06 09:39:24 +00:00
Julien (jula) 41d135d860 [FIX] web: use correct date in py_date.js
__Current behavior before commit:__
When `context_today()` is in a domain, UTC is used. However this is not
consistent with [the legacy method](https://github.com/odoo/odoo/blob/81183495a07eb5928b29ae56f3f86671234d602c/addons/web/static/src/legacy/js/core/py_utils.js#L232) used before OWL migration.

This has the consequence that filters with this method in their domain
will not behave correctly and use UTC date instead of the actual date
of the user.

__Description of the fix:__
Switch the UTC methods calls to regular ones.

__To reproduce:__
(Reproducible only in Odoo 16, since the old method is still used in 15)
1. Change computer date and timezone so that UTC date is not the same as
your date (e.g. if timezone is CEST, set the hour to 1am)
1. On any record, schedule an activity with the due date to today.
1. In the Activities notifications panel, click on **1 Today**
1. The page display nothing because it will filter by the previous day.

opw-3423316

closes odoo/odoo#137798

X-original-commit: e41dcde8d66c74c8ad114c76ea6ed9c607e04455
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-06 07:12:21 +00:00
nikj-odoo 093b2f56fb [FIX] web,sale: Add domain & show action helper when there is no data
In this commit, show action helper when we had not data show in graph view.
same as we have in pivot view.

- add domain for cancelled records to not showing in reporting.

task-3500508

closes odoo/odoo#137735

X-original-commit: a50e73a2ae04fac9fcfea77cbab27e0b5de66fcc
Related: odoo/enterprise#48473
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-10-06 06:14:13 +00:00