Commit Graph
16499 Commits
Author SHA1 Message Date
Ivan Yelizariev 85f5006018 [FIX] web: fix export m2m fields on using group_by
Export tool is based on ORM method `_export_rows`. The method has special
processing of m2m fields when user checked *Import compatible* option [1].
Before this commit the negative value of `import_compatible` parameter wasn't
passed when data are exported in grouping mode. This led to empty values in m2m
fields.

STEPS:
* Order some products via website and pay via wire transfer
* Open Orders menu in backend
* group order by any field
* expand group with the order
* add field *Transactions/Acquirer/Display Name*

[1]: https://github.com/odoo/odoo/blob/b28c44a38698018ebbbc420f6567c17b2b97c279/odoo/models.py#L894-L914

opw-2864737

closes odoo/odoo#110151

X-original-commit: 6647ac83467207f4f4ef23aac96ebaf5333b967b
Signed-off-by: Ivan Elizaryev (iel) <iel@odoo.com>
2023-01-17 16:47:24 +01:00
Jorge Pinna Puissant 4af6fcd779 [FIX] web: kanban view flickering unfiltering columns
Before this commit, when unfiltering a column in a kanban view, a
flickering occurs and the show more button is visible for a moment.

closes odoo/odoo#110130

X-original-commit: 0cd9c7dbba12e362a6445f47d52b43c48dffdb61
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2023-01-17 14:16:59 +01:00
luvi b6612fca69 [FIX] web: fix ids to export with selected domain
This commit fixes the export when all records are selected (full domain).
Since many records ids might be present when an entire domain is selected,
the request should contains 'false' instead of a list of ids. As a limit
is set in session.active_ids_limit, not all the records were considered.

This means that only the limit was actually exported instead of the full
list that is present. As the legacy implementation of the ExportDialog
allowed to export all records, the behavior has been fixed.

A test has been added to verify the correct parameter during the download
call.

closes odoo/odoo#110126

X-original-commit: 7200e1c5875bc148fb64187fd67d58a7d6c13c7c
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-17 14:16:54 +01:00
luvi 6a74bfae9f [FIX] web: fix export templates list filtering
Before this commit, exporting templates were not filtered as
expected. It means templates were visible even on other domains,
polluting the list of templates of a model.

This restores the legacy behavior by filtering the domain in the
rpc and only displaying the desired template list.

A test has been modified to verify the presence of the domain
filter in the parameters of the rpc.

task #3127779

X-original-commit: 30a673c044e53bfb1edc1e6733b2c83c67e0232c
Part-of: odoo/odoo#110126
2023-01-17 14:16:53 +01:00
Renaud Thiry 9828ce96d0 [FIX] web: handle falsy m2m_tags
Before this change, if a user left a string value in a m2m_tags
and removed it afterward without selecting a tag, the update method
of Many2XAutoComplete would be called with false.

As the update method for m2m_tags expects a record or record list
this caused a traceback.

The fix is to simply skip the update in that case.

task-3109811

closes odoo/odoo#110123

X-original-commit: 14f314feb7594dc888de6af4e4ad23a948044854
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-01-17 14:16:47 +01:00
Jorge Pinna Puissant e54d00f832 [FIX] web: kanban: concurrency issue with animated numbers
Before this commit, in the kanban view, if we click the progress bar to
filter the column multiple times, the count of records number's could
show an incorrect value. This occurs because when removing the filter
from the progress bar, an animation is done to the number (to increase
the value until the correct number of records). Contrariwise, when
activating a filter, the number of records is set directly without
animation. When we remove and add again a filter quickly, the animation
to increase the value of the number finishes when the filter is already
apply and the value shown is the old count of records (without the
filter).

To avoid this, in this commit, we stop the animation when the count of
record changes.

Unfortunately, testing this is very complicated (because it involves
animation frames and Date.now()), and as the cost/reward ratio is very
low, we didn't add a test of this behaviour.

closes odoo/odoo#110121

X-original-commit: 4c8bb53df6ad6382c5b168532c8493ddbb1f7252
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-17 14:16:45 +01:00
fdardenne e554f5688c [FIX] web: list view: make the scrollbar above the thead in safari
Since odoo/odoo#107631, in Safari (version tested 15.6.1),
the scrollbar stayed below the list view thead and thus looked glitchy.

Now, the scrollbar stays above the sticky thead. The fix applied is
documented in this stackoverflow thread
The fix applied is described in this stackoverflow thread:
https://stackoverflow.com/questions/20832531/mobile-safari-positionfixed-z-index-glitch-when-scrolling

closes odoo/odoo#109773

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-17 14:16:25 +01:00
Samuel Degueldre 76a44b29f5 [FIX] web: improve performance in list views with date/datetime fields
When rendering the list view, we evaluate the evalContext for each field
so that we can give it infos such as readonly, required, invalid or
empty. In doing so, date and datetime feels are serialized and added to
the evalContext, but serializing dates can be slow, especially when not
using the default English locale. Internally, luxon checks whether the
locale is English which instantiates an Intl object which can be slow
and this is compounded by the fact that the method is called hundreds of
time in a single render.

This commit caches serialized dates and datetimes in a WeakMap, as the
luxon Date objects are immutable, this is safe, and because these
objects are not recreated often, it also eliminates a lot of the calls
to luxon's toFormat. In the quotation list view, this brings the render
time from ~1100ms to ~270ms. While this is still slow and further work
will be undertaken to make the evalContext lazy (so that only
date/datetimes which are actually used are serialized), it is a good
first step and brings the performance back to a level where the list
view is reasonably usable.

closes odoo/odoo#110103

X-original-commit: 64eeeef4d3d93a9b2753520e0067aa7996988d4c
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-17 12:58:59 +01:00
Bruno Boi 204a9cef02 [FIX] web: shortcuts usermenu entry for Mac users
Before this commit:
> The command palette displays a footer tip about shortcut overlays.
> The tip is false for MacOS users.
> They cant see overlays with "ALT" key, they need to press "CONTROL".
> They do not need to do "ALT + CONTROL" in order to trigger a shortcut,
> only "CONTROL" is enough.

After this commit
> The tip is good for MacOS users too.

closes odoo/odoo#110050

X-original-commit: 65dda569f45401c002fc34fb12718de709847bf0
Signed-off-by: Georis François (fge) <fge@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-01-17 10:20:56 +01:00
Aaron Bohy 057f281f20 [FIX] web: RelationalModel: find previous group with date
When a list or kanban view is grouped, at each reload, we try to
match the fetched groups with the previously created Group
datapoints, such that we can restore/keep the state of each group
(for instance, the fact that it is folded, the limit of the inner
list...).

Before this commit, this didn't work when the view was grouped by
a date or datetime field, because in those cases, the value of the
group was a luxon instance, and strict equality between two
different luxon instances, even if they represent the same value, is
always false.

This commit fixes the issue.

Issue reported in the feedback pad after migrating odoo.com to 16.0.

closes odoo/odoo#110046

X-original-commit: 80fa8f187939d78ea644a49ec17c112bcc97b32b
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-17 09:14:52 +01:00
Romeo Fragomeli dcf06d45cb [FIX] web: settings control panel's layout on small screen
The custom control panel for Settings form view has radically changed
and the old CSS rules (`.o_settings_title`, `.o_setting_search`) didn't
apply anymore, so we remove it.

Note that the form view uses a custom control panel `FormControlPanel`
but the settings form view uses the normal one: `ControlPanel`.

In this commit, we adapt the CSS to reflect the normal control panel
(e.g. the one used by the Kanban view)

Also note the differance between the old version and now:
* before (< Odoo 15.2) the input search was focused when the app was
opened and there wasn't any title
* after (>= Odoo 16) we have harmonized the search to match the other
control panel, so we have to click on the magnifying glass to show
the search input.

Steps to reproduce:
* Open Odoo on a small screen (e.g. on Mobile)
* Open the Settings app => BUG the magnifying glass isn't at the right
position.

closes odoo/odoo#110043

X-original-commit: 91ab277ef66a2ca6b34c13fcba7197f18c50aab0
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
2023-01-17 09:14:47 +01:00
Victor Feyens 1a1ce16265 [IMP] core,*: check routes decorators
When overriding an existing controller route, developers can
easily c/p the route definition and call super() in the overridden method
when the route attributes are automatically deducted by odoo from the parent route.

Removing those redefined attributes simplifies the routes definition,
clearly highlighting what's changed by the override.
Also reduces unexpected behavior when modifying the base route without
noticing/considering the redefined attributes in a overridden route,
which overrides the changes made to the base route when the sub-module is installed.

This commit adds a test to catch routes attributes redefinition, and clean existing routes.

closes odoo/odoo#108512

Related: odoo/enterprise#35176
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-01-16 19:45:57 +01:00
FrancoisGe a61cd4b322 [FIX] mass_mailing: action_import add default_mailing_list_ids
The goal of this commit is to fix the problem introduced by the PR 106519.

How to reproduce the problem:
- Go to the "Email Marketing" app
- Go to the "Mailing Lists" menu
- Click on a "Mailing List"
- Click on the "Recipients" stat button
- Click on the "Import" button

Before this commit:
A dialog opens and no mailing list is selected.

After this commit:
A dialog opens and the mailing list we are in is selected.

closes odoo/odoo#106732

Related: odoo/enterprise#34453
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-16 10:32:06 +01:00
FrancoisGe 469577ac2f [IMP] web: add buttons in control panel in kanban
This commit adds the possibility to define buttons that are always
present in the arch of a kanban view.

Purpose:
Several customisations of the kanban view consist in adding an always
present button in the control panel that performs an action/calls a
model's method.
We want to support this feature directly in the framework to remove
these customisations.
The task 3082303 has added the same functionality to the list view.

Solution:
Add a "display" option that lets you know when to display a button.
The different values that can be assigned to "display":
- "selection": the button is only displayed if at least one record is selected.
- "always": the button is always displayed.
The default value of "display" is "selection".
Currently, only the value "always" is implemented because it is not
possible to select a record in a kanban. The selection of a record in a
kanban view will be implemented soon, so we decided to use the same API
as in the list view.

Exemple:
<kanban>
    <header>
        <button name="to_do" type="object" string="Do" display="always"/>
    </header>
    ...
</kaban>

Taskid: 3082390
Part-of: odoo/odoo#106732
2023-01-16 10:32:05 +01:00
Michael (mcm) 11caf332ab [IMP] web: remove title attr from navbar items
This commit removes the title attribute on navbar items.
The title was only repeating the content so it was useless.

closes odoo/odoo#109230

Task: 3097276
Related: odoo/enterprise#35562
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-13 16:27:49 +01:00
Michael (mcm) 65e43dd881 [IMP] web: make kanban group header sticky
This commit makes the kanban group header sticky, it means that when
the user scrolls the headers will still be visible on top of the view.

closes odoo/odoo#109060

Task: 2050014
Related: odoo/enterprise#35611
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-13 16:27:43 +01:00
Julien Castiaux bf4c5015ce [IMP] core: make some cookies expire on logout
Some cookies were left around even when the user logged out

The next user should log into the default company instead of the company
of the last user.

task-3077421

closes odoo/odoo#108998

Related: odoo/enterprise#35685
Signed-off-by: Julien Castiaux <juc@odoo.com>
2023-01-13 16:27:35 +01:00
Ivan Yelizariev c37c9850fe [FIX] web: convert python/js bool values in read_progress_bar
Because of an issue with converting bool values, read_progress_bar didn't work
on grouping by bool fields (e.g. Active).

Related tests worked fine because mocked server responses were different from
real server responses. So, we need to adjust mocked server too.

opw-2870937

closes odoo/odoo#103926

closes odoo/odoo#104613

X-original-commit: e6ca3ef1b38dec964dab416c6058d4c1b7161614
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2023-01-13 16:27:08 +01:00
Lucas Perais 475f8aa2c6 [IMP] web: add a onRecordChanged prop to the Record component
Before this commit, there was no way to instanciate a Record component and be
able to handle changes occuring in that record.

After this commit, a simple props is added, making this use case possible.

closes odoo/odoo#109846

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-13 14:00:04 +01:00
Aaron Bohy 5d060079f0 [FIX] web: fix test failing on split builds
Before this commit, test "click on the progressBar of a new column"
deterministically failed on split builds. It only passed with all
addons installed, and passed by chance with all addons installed.

The reason is that the flow of quick creating a record in a grouped
kanban with progressbars wasn't concurrency proof at all. Commit [1]
simply added a hook at the end of the `_save` function of the model,
which highlighted the problem: the progressbars were updated before
the group's count was incremented, so if the quick created record
was the only record of the group, the progressbar was still empty
after the quick creation.

This commit makes the quick create code more robust.

We couldn't find a way to write a qunit test for this, but it still
fixes an error in nightly builds.

[1] a882b725bb

closes odoo/odoo#109818

X-original-commit: cbfad9c36f4e52309903702f21cea457acc55ecb
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-13 09:18:53 +01:00
Aaron Bohy ad0bbb395a [FIX] web: list: pager issue after applying a filter
In a list view containing n records, apply or remove a filter.
Then edit the pager to reduce the limit to m, with m < n.

Before this commit, the pager was indeed updated, but the list
still contained the same number of records as before applying the
filter.

This was due to a kanban specific logic to handle the "load more"
feature. We stored the number of loaded records, and forced the
limit to be at least that number.

This commit fixes the issue by changing the way the "Load more"
works. Instead of loading the "limit" next records (i.e. with a
limit and an offset), we now reload the previously loaded records
+ the "limit" next ones (i.e. we leave the offset to 0, and
increase the limit).

This also prevent potential weird behaviors where the same record
appears twice, or records are skipped, when the recordset changes
between the first load and the first load more, or between 2 load
more.

closes odoo/odoo#109693

X-original-commit: 217d1191750d03918055610ba0e61f0f7522f475
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-13 09:18:43 +01:00
Adrien Dieudonné 434abe3478 [FIX] web: settings: add spacing for fa icons
Before this commit, there was no space between the label and
the icon. It's because since [1] we doesn't have a margin-right
after labels anymore (Grid to the job).

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

Closes https://github.com/odoo/odoo/pull/109102

Task-3117722

closes odoo/odoo#109821

X-original-commit: 64c5c324e86b56e59947659c8269bf355799729e
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
2023-01-13 00:51:50 +01:00
Romeo Fragomeli 9420f68282 [FIX] web: misalignment title of dialog on Mobile
The title is aligned to the right on mobile. This is the result of the
two rules of Bootstrap:
```css
.modal-header {
  display: flex;
  justify-content: space-between;
}
```

To avoid this we add `margin-inline: start`, to force start alignment of
the title.

Steps to reproduce:
* Open Customer (on small/mobile screen)
* Create a new Customer
* Click on Tags field => BUG title of dialog on the right

Note: on desktop there is no problem as there is the close button on
the right.

closes odoo/odoo#109796

X-original-commit: 7809abb1dcf1b0d384c0cad4065cdf15adf56081
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
2023-01-12 23:48:59 +01:00
Antoine (anso) b4b390d410 [FIX] web: duplicated color management for tags
Tag color is already handled in tags_list.scss
Also, `$min-contrast-ratio: 2.2` was creating contrast issues and was
therefore dropped

part of task-3085081

closes odoo/odoo#109740

X-original-commit: 5517e41663ece74e5dc13d9ab4edf9938cfe5c4b
Related: odoo/enterprise#35701
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-01-12 16:30:16 +01:00
Aaron Bohy 509132f46b [FIX] crm,web: no crash when quickly d&d records in pipeline
Before this commit, there was a crash if you quickly dragged&dropped
twice the same record from a column to another (i.e. before the
first write was done). This was because we couldn't find (yet) the
record from the column we were dragging it.

This commit prevent the crash from happening.

closes odoo/odoo#109694

X-original-commit: b57238b577342d9a4c824b90eb7fa2a4b8e00a8e
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-12 10:05:49 +01:00
Pierre Paridans 85c6f0b9aa [IMP] web: theme-color matches community theme
This commit sets the theme-color to match the Community brand color
instead of the Enterprise one.

task-3063485

closes odoo/odoo#109181

Related: odoo/enterprise#35322
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-01-11 22:42:56 +01:00
Pierre Paridans 3664e1c0c6 [IMP] web: remove unused Android icon
This commit removes link to an Android specific icon.

Also this icon has been overriden by the favicon since
odoo/odoo@fa2cc58ef3.

task-3063485

Part-of: odoo/odoo#109181
2023-01-11 22:42:56 +01:00
Pierre Paridans ec4bb75dec [IMP] web: cleanup Apple's web-app related meta tags
Deprecated tags in favor of WebManifest.

Also this icon has been overriden by the favicon since
odoo/odoo@fa2cc58ef3.

task-3063485

Part-of: odoo/odoo#109181
2023-01-11 22:42:56 +01:00
Pierre Paridans dcae6d7afc [IMP] web: remove deprecated msapplication-* meta tags
Windows 8 tiles and superseeded by WebManifest support in Windows
10/Edge 79+ (Chromium based).

Also this icon has been overriden by the favicon since
odoo/odoo@fa2cc58ef3.

task-3063485

Part-of: odoo/odoo#109181
2023-01-11 22:42:56 +01:00
luvi 9e46fbd332 [FIX] web: fix ExportDataDialog issues
Since the rewrite of this dialog, some inconsistent behaviors were
present compared to the legacy implementation. This commit fixes some
of them.

First, many2many fields couldn't be expanded as it was the case before.
Secondly, the export list generated by default was wrong, and it has been
fixed by this commit. The defaultExportList that was computed in the as
expected for the direct export is now also used to display the right
fields from the right pane as it ignores the fields that are explicitly
not exportable.

Finally, minor UI issues have been fixed, like a wrong title.

Tests have been added to assert the correct behavior of the dialog when
selecting records.

closes odoo/odoo#109670

X-original-commit: 86b634a120de0843fbd90079e9e457818fd4acde
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Luca Vitali <luvi@odoo.com>
2023-01-11 17:58:47 +01:00
Samuel Degueldre b34429b984 [IMP] web, test_lint: forbid private class fields
We don't want private class fields to be used in Odoo because they limit
how classes can be patched from the outside, extensibility is one of
Odoo's biggest strength and we do not want to limit it.

This commit adds the `no-restricted-syntax` rule to eslint configs with
a rule that forbids private class fields.

closes odoo/odoo#109664

Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2023-01-11 17:58:41 +01:00
Bruno Boi 3a814f50ba [FIX] web: back to same action w/ pending changes
Before this commit, when a user was on a form view with pending changes
and would click on the browser back button. If the previous action was
the same action, the user would be redirected to the form view but a
traceback would be raised because the form view was not able to handle
the pending changes "in time".

Here "in time" means before the form view is rendered. The form view
when rendered will try to update its display name through its controller
config, but as the new controller will be in fact the same as the
previous one, its config is currently being changed while the previous
form view is still using it. This leads to a traceback.

This commit fixes this issue by making sure that the changes are
properly commited before changing the config for the new controller.

The same kind of issue has been fixed in the action service for the
restore function, but there are no sensible ways to test this particular
use case.

closes odoo/odoo#109653

X-original-commit: e8a95c37e4e9ee4e4a65a3bfb216d3fa55544933
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-11 15:39:08 +01:00
Ivan Yelizariev 4ca947c092 [FIX] base,web: fix address widgets in reports for RTL
This reverts following commits
1. a63f616c280ff464e331e3ba97265a8c29a86871
2. 5b7c3805a0

Instead of aligning address to left, we use default aligning, i.e. align to the
right for RTL langugages.

Commit n.1 was an attempt to finalize idea of the commit n.2, but it turned out
that left aligning looks just too bad for rtl users. So, this commit reverts
both of them, but keeps span/div changes in commit n.2

opw-3053457

closes odoo/odoo#109634

X-original-commit: 4af9fcf99f118e5dd85fb59d2e63f5b817233f07
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-01-11 14:31:03 +01:00
luvi b31daf2f7b [REF] web, *: improve view scale selector style and behavior
*: hr_holidays, hr_work_entry_contract

The commit introduces a new standard view component made to implement
in a consistant way the scale/select the appropriate period to display
in a view. This component is currently used by the Calendar view.

Tests have been added for this new component, as its behavior specs must
remain comprehensive. When there is no options or only one, the button is
removed from the view to keep space available, as its purpose is reduced.

This component gives the opportunity to keep the same style and behaviors
for views implementing it (eg: Calendar, Gantt) and should be used in
other views as well as soon as they are converted to Owl.

Other modules have been adapted to use the component name in xpath instead
of the span with the o_calendar_scale_buttons element. Tests have been
adapted as well.

A scss file has been modified to prevent the arrow to be misplaced on touch
devices due to a higher padding in the dropdown item element.

part of task #2867569

closes odoo/odoo#109090

Related: odoo/enterprise#35435
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-01-11 14:30:46 +01:00
Laurent Smet 7a8a712a34 [IMP] web: improve notebook
to allow for easier overriding
related to odoo/enterprise/#35426

task-3111695

closes odoo/odoo#109594

X-original-commit: 2ad805d5a88a510844fc398d089b3e3c46e5cb9d
Related: odoo/enterprise#35641
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Ayob Habib (ayh) <ayh@odoo.com>
2023-01-11 13:20:53 +01:00
JF Aubert 74c1944ea0 [FIX] web: fix product favorite tooltip
Avoid tooltip like 'Favorite: Favorite' in priority field.

Task: 3094741
Part-of: odoo/odoo#108446
2023-01-11 13:20:47 +01:00
niyasraphy f843f45700 [IMP] web: camel case lettering
currently in the db creation page in the db manager, except phone number and demo data fields use camel case lettering. this pr will make phone number and demo data fields with camel case lettering, which will unify the form.

closes odoo/odoo#108326

Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-01-11 13:20:41 +01:00
Ivan Yelizariev 64682a61bb [FIX] web: add basic support for Json fields
`fields.Json` is introduced in v16. There are just few usage of it in standard
code. It's usually used via `widget="analytic_distribution"`. However, user may
add the field to list view via a Studio. To prevent errors, this commits adds
basic formatter for the field.

STEPS:

-In the Purchase app, add a new Menu based on the existing Model "Purchase Order Lines"
-In the list view of that new Menu, add the existing field "Analytic
-Distribution"

opw-3055926

closes odoo/odoo#109573

X-original-commit: d0621a2aec9cdc4bad348804fe5ada974b75f322
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-01-11 09:38:56 +01:00
FrancoisGe e2cb2e7d23 [FIX] web: disabled button in list view
Before this commit, setting a disabled attribute on a <button> tag in
the arch of a list view was ignored.

How to reproduce:
Going into a list view with a <button disabled="1"> tag.
Click on the button

Before this commit:
The button is not disabled and a crash is displayed on click.

After this commit:
The button is correctly disabled and there is no crash on click.

closes odoo/odoo#109337

X-original-commit: c8ef3262e3aa167a520dcb0d1b229e61e5e2e362
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-11 08:29:43 +01:00
Florian Charlier b1d1856245 [IMP] survey, web: enable chaining question creation
## Survey
Due to the behavior of X2Many fields, the questions created when editing
a survey were not usable immediately after creation to be conditional
triggers for new questions. The whole survey had to be saved first, which
wasn't a smooth experience for the user.

This commit will save the survey and question at several times:

### For each new question added

Similarly to what was implemented for chatbot scripts, enables the
immediate computation of allowed question/answer triggers, permitting their
use when chaining question creation.

This also enables to check the answers "validation" fields immediately, and
activating scoring and add scores to question/answers without requiring the
extra steps of saving and re-entering edit mode for the survey.

### When rows are deleted

This will trigger the immediate removal of the triggers icons on
questions that were triggered by an answer to the deleted question.

### NOT when questions are moved

As there is no convenient way to ensure questions are properly ordered with
respect to their triggers (order dependency) without popping error messages
at every step when reordering questions, we chose to mark the misplaced lines,
missing trigger records or triggers that will be ignored (with the new
`trigger` widget).

This could have been done entirely with 'server' logic, but that would have
required additional saves and cleaning fields even more often, even during a
temporary reordering step, which isn't convenient.

### Misc
Finally, note the extra fields added on the question_and_page_ids field of the
survey form view, required to trigger these fields' update consistently
(required after reordering or removing records which sometimes doesn't occur
without these).

Tests ensuring the behavior of the X2Many (saving parent on open/edit and show
notifications on error) and the trigger widget are included.

## web
To support the functionality described above, we need to allow the caller of
'save' to catch errors to prevent default handling (here to use a notification
instead of an additional Dialog).

Task-2623482
Part of odoo#78705

Part-of: odoo/odoo#78705
2023-01-10 18:54:28 +01:00
Thomas Lefebvre (thle) c70e410050 [FIX] web: correct type of defaultPage prop
Steps to reproduce:
- go to "Link Tracker" app;
- go to "Campaigns" tab (UTMs);
- create a new campaign;
- leave and return in this record.

Issue:
A traceback appears.
Error message:
`Invalid props for component 'Notebook': 'defaultPage' is not a string`

Cause:
The `defaultPage` prop must be a string.
When the record is new, it will be `undefined`,
so it will pass props validation because this prop is optional.
But when we try to calculate it and it does not return a value,
the `defaultPage` is null.
The variable is therefore declared but it is empty
(and therefore not a string).
`null` value does not pass the props validation test.
The problem appears in the "Campaigns" tab
because there is a notebook without content.

Solution:
Test if it is possible to have a value.
If not, set the `defaultPage` prop to be `undefined`.

opw-3109327

closes odoo/odoo#109533

X-original-commit: 402b1a822c3983af33aa1d3a3c7e93d8836c60d8
Signed-off-by: Dardenne Florent (dafl) <dafl@odoo.com>
2023-01-10 16:50:58 +01:00
Romeo Fragomeli 1171432b99 [FIX] web: allow to clear a many2one field on small screen (Mobile)
Since the rewriting of the views in OWL2, it is not possible to clear a
set many2one field.

In this commit, we restore the clear button.

Steps to reproduce:
* Go to Sales (on Mobile)
* Create a new Quotation
* Select a customer
* Try to remove the selected customer => BUG

closes odoo/odoo#109531

X-original-commit: 57cb2a34c8211352baa439ee784dc370cc6abb1b
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
2023-01-10 16:50:55 +01:00
Kartik Chavda 3cd30d1531 [IMP] web: add default_group_by in list view
Before this commit it is not possible to add default
groupBy in list if users want default groupBy a list
then they have to pass default groupBy in action and
passing default groupBy in action groupBy other views
in action, so priorer to this commit users cannot add
default groupBy in list view without impacting other
view.

In, this commit add default_group_by in list view
attribute so users can add default groupBy in list
view without impacting other views in action.

task-3084850

Part-of: odoo/odoo#109281
2023-01-10 15:43:10 +01:00
Adrien Dieudonne 84bff82d76 [FIX] web, web_editor: ace widget partially hidden in read-only mode
Before this commit, the ´.ace_gutter´ overlapped the beginning
of the ace widget text content.

It only happens in read-only mode if it's a one-liner content.

Note that ´aria-hidden´ attribute is not set on BS modal. So,
it seems useless to remove it. Maybe a relicate of Bootstrap 3.

Steps to reproduce:
In debug mode,
- Open Settings
- Technical
- Scheduled Actions
- Open any

closes odoo/odoo#109519

X-original-commit: dc65d3de3a02a8f196eb22348bdfe41ede23f5d1
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-01-10 13:40:01 +01:00
Joseph Caburnay 4bf700140b [FIX] web: list column resize issue
**Issue:**

- Try resizing a column.
- Bug: After releasing the resize, the column being resized is also reordered.
  - This results to automatic resizing of the columns, not respecting
    the current resize made by the user.

**Solution:**

1. Keep the size of the columns after reordering. Better UX because any resize
   made by the user won't change when reordering the list (accidentally or purposely).
2. During resize, we track state variables - `resizing` and `preventReorder`.
   - When resize starts, `resizing` is set to `true`.
   - When the mouse pointer is released (mouseup), and before the `mouseup` event
     reaches the `window`'s `mouseup` listener, the column title handles the `mouseup`
     first, setting another state variable `preventReorder` to `true`.
   - `mouseup` will eventually reached `window` which stops the resize, setting
     `resizing` to false.
   - Then, click event happens on the column header. And since the `preventSort` is
     true, it will return early but resets the `preventReorder` to `false`.
     - If the click event happened to be in the resizer span element, we should not
       prevent it from bubbling so that `preventReorder` is properly reset.

**TASK-ID:** 3109501

closes odoo/odoo#109518

X-original-commit: 7a71a0974164277ac7fd382391684b078b71bf7d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-10 13:39:58 +01:00
Jensi Chovatiya 06b6a52648 [FIX] web: too long input placeholder
The placeholder may be too long and not fit the screen. In this
situation it would not been shown at all. Using the `text-trauncate`
bootstrap class, the end of the text is truncated with an ellipsis in
case it doesn't fit on screen.

task-id-3098157

closes odoo/odoo#109424

X-original-commit: dc7e4c90c9c28c456c1dfbdd503a4cb9095a1292
Signed-off-by: Julien Castiaux <juc@odoo.com>
2023-01-10 12:35:09 +01:00
FrancoisGe 79c89438a7 [REF] web: converted the client actions from misc.js
This commit is to convert the client actions in misc.js into the new
architecture.
We remove the client actions login and logout because they are no
longer used in the code base.

closes odoo/odoo#109332

Task-id: 3099992
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-10 12:35:04 +01:00
FrancoisGe 2587f31912 [FIX] web: search in m2o displays lost connection notification
In the PR 104415, we add the possibility to abort the name_search rpcs
which will be ignored.
Unfortunately, we forgot that xhr.abort performs a reject which will be
converted into an "XmlHttpRequestError abort" error. This error will
cause a notification "Connection lost. Trying to reconnect...".

Solution:
We revert the modifications in the abort function and in the m2o
we catch all the errors on the rpc name_search that we are going to
abort because they have no more use.

How to reproduce:
- Go to a form view with a m2o field
- Having a slow network or a lot of records in the m2o
- Enter several char in the m2o search bar

Before this commit:
A notification "Connection lost. Trying to reconnect..." is displayed.

After this commit:
There is no notification.

closes odoo/odoo#109500

X-original-commit: 7bff161ac5e916bf4d4eabe4f9ada9a147893cf2
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2023-01-10 11:23:33 +01:00
FrancoisGe 5d7136c21d [FIX] web: Incorrect navbar when leaving an invalid form view
Before this commit, when trying to change the menu from an invalid form
view, you would stay on the form view but the navbar would be modified
to dispaly the menu you had selected.

How to reproduce:
- Go to a form view
- Edit the fields so that the record is invalid
- Change the menu using the menu app or the palette command

Before this commit:
The form view has not changed but the navbar has been modified, it shows
the menu you selected.

After this commit:
The form view and the navbar have not changed.

closes odoo/odoo#109460

X-original-commit: bd7e36edcd2f9d33a72cc25b030f91c20da78387
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-10 08:14:46 +01:00
Bastien Fafchamps (bafa) ae619e6a41 [FIX] base_import: Fix filtered fields shown in select menu
During the conversion to Owl of the base_import action, the fields
mapping for each column was made incorrect.

The fields are now properly sorted between the suggested, additional and
relational categories and the subfields are also correctly handled (no
more duplicates and correct labels).

closes odoo/odoo#109416

Signed-off-by: Luca Vitali <luvi@odoo.com>
2023-01-09 20:08:48 +01:00