Commit Graph
3194 Commits
Author SHA1 Message Date
FrancoisGe 39ecfcff49 [FIX] web: sort an open group
This commit solves two bugs:

1. In a grouped empty list view, if you click on a sortable column,
then a crash is displayed.

How to reproduce:
- Go to a grouped empty list view with at least one sortable column
- Click on the sortable column

Before this commit :
    A crash is displayed

After this commit:
    Nothing happens.

2. In a grouped view with at least one open group, columns that do not
have an aggregates value cannot be sorted.

How to reproduce:
- Go to a grouped list view with at least one open group.
- Click on a sortable column that does not have an aggregates value

Before this commit:
    Nothing happens

After this commit:
    The records are sorted by the clicked column.

closes odoo/odoo#102143

X-original-commit: 537bbc79fe0ce34fe8b4746bf4cc86f9ebfc8a12
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Georis François (fge) <fge@odoo.com>
2022-10-05 09:34:59 +02:00
FrancoisGe 63b8a92e9c [FIX] web: html field in list view
Before this commit, in a list view, html fields in readonly mode were
not rendered correctly. It displayed unprocessed HTML.

For the value :
    <div>Hello</div>

Before this commit, it was displaying:
    <div>Hello</div>

After this commit, we display:
    Hello

closes odoo/odoo#101253

X-original-commit: a6292c17b886996c82c797e562b725d63d4a5b7e
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-10-05 09:34:52 +02:00
Aaron Bohy d9d174efc6 [FIX] web: FormViewDialog: add "Remove" button
In the conversion of the FormViewDialog from legacy to wowl, we
forgot the feature allowing to display a "Remove" button in the
footer, and to execute a custom callback when this button is
clicked. This is used for instance by the Gantt view.

This commit restores the feature.

closes odoo/odoo#102149

X-original-commit: 3eb126d0297a7e3db0cb98cd1ad9555eefaa0cfa
Related: odoo/enterprise#32281
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-10-04 22:00:43 +02:00
Aaron Bohy 78c6c70ee4 [FIX] web: FormViewDialog: handle close attr on buttons
Before this commit, clicking on view buttons with attribute
`close="1"` in FormViewDialog didn't close the dialog once the
button action was performed. This commit fixes that issue, and
ensures we do not reload the record if we're about to close the
dialog.

X-original-commit: 32d211a6fd5c121fa5f556f1d78b79421edc6f68
Part-of: odoo/odoo#102149
2022-10-04 22:00:43 +02:00
FrancoisGe afdaf8cb4f [FIX] web: create a record with the widget "many2many"
Before this commit, creating a new record with the "many2many" widget
did not allow to use a context containing a default value
for the parentID (id of the Record containing the many2many).
This value is ignored.

How to reproduce?
- Go to a form view with a field using the "many2many" widget
 with context = {"default_parentID" = ...}
- Click on "Add a new line"
- Click on "Create" (The form view should display the parentID field)

Before this commit:
    The parentID field is empty.

After this commit:
    The parentID field contains the record corresponding
    to "default_parentID".

closes odoo/odoo#102157

X-original-commit: a52eacc5397dc2f98eb052f4cd1e362a97621074
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-10-04 20:58:07 +02:00
Mathieu Duckerts-Antoine 2c60272507 [FIX] web: ModelFieldSelector: click on popover back button
Click on the back button in the model field selector popover used to
often remove too many names in the path created via the selector. For
example, starting with "partner_id.name" and clicking on the back button
in the opened popover would give the invalid path "" instead of
"partner_id". We fix that problem.

closes odoo/odoo#102156

X-original-commit: e4a7b63c68a87d7afef987e8d036d7ba9c5b6f96
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2022-10-04 20:58:04 +02:00
Mathieu Duckerts-Antoine 7db644da96 [FIX] web: DomainSelector: operator change
In a domain selector, have a selection field and the operator "is set"
selected, then change the operator to be "=". A crash occurs. This
happens because the category of operator change and thus the function
onDidTypeChange of DomainSelectorSelectionField is called with no
parameter. The same problem can happen with DomainSelectorDateTimeField.

We fix that by calling component.onDidTypeChange with the right
parameter in any case.

X-original-commit: a01c2473d93d0d123391ba0131ad505775b3c50b
Part-of: odoo/odoo#102156
2022-10-04 20:58:04 +02:00
Lucas Perais b072e1bd5b [FIX] web: form always edit: a virtual record can be discarded
Before this commit, a virtual record in form view always had the
o_form_dirty class, which is problematic when a tour ends with a virtual record.

After this commit, a virtual non-dirty record in form view doesn't have
the class o_form_dirty, and doesn't have the o_form_saved either as that doesn't make more sense.

closes odoo/odoo#102153

X-original-commit: 0041b9fd8eb75d5b680d94d491e2b9f684b2d0c1
Related: odoo/enterprise#32282
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-10-04 20:58:01 +02:00
Julien Mougenot 5805ca28a8 [IMP] core/utils: make separate useDraggable hook in web
A new useDraggable hook is introduced and used in the various components that
use the feature.

It relies on the draggable hook builder which is a generic way to prepare
specific drag and drop features.

X-original-commit: cb1cfe5f5efe1b683d7fdffde3718bd8bf1bcd86
Part-of: odoo/odoo#102153
2022-10-04 20:58:00 +02:00
Lucas Perais 288623993a [FIX] web: Notebook: class set on pages should appear in DOM
Have a form arch containing
```
<notebook>
  <page class="myClass" />
</notebook>
```

Before this commit, "myClass" did not appear in the final DOM.

After this commit, it does.

X-original-commit: e886adcb38695bcfa8a9f741d4e496229fb199ff
Part-of: odoo/odoo#102153
2022-10-04 20:57:59 +02:00
Lucas Perais 654b47e253 [REF] web: improve ViewCompiler and FormCompiler extensibility
X-original-commit: b0897a76dbbad039043b29b248ba13bfb518f45c
Part-of: odoo/odoo#102153
2022-10-04 20:57:57 +02:00
FrancoisGe 75ca493a15 [FIX] web: click on m2o_avatar in editable/multiEdit list
The goal of this commit is to fix the behaviour of clicking on a field
with the "many2one_avatar" widget in a list view.

Expected behaviour when clicking on a field with the "many2one_avatar" widget:
- Editable list view: switch row to edit
- Multi_edit list view with selected record: switch row to edit
- Other case: open the many2one_avatar record in a form view

Before this commit, clicking on a field with the "many2one_avatar" widget always
opens the record in a form view.

After this commit, the expected behaviour when clicking on a field with
the "many2one_avatar" widget is respected.

closes odoo/odoo#102146

X-original-commit: ad597d414c59723d3c6af5dfdc1a3a41fd4f4032
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-10-04 20:57:42 +02:00
Simon Genin (ges) a36fdc43cd [IMP] web: toggling an optional field in list view do not unselect row
Toggling an optional field was unselecting the row, but didn't correctly
copy the same bahavior than legacy when it comes to the saving and
discarding of the data being edited.

However, by simply removing the line of code unselecting the row, we get
a better ux for no cost. The user can continue the record edition after
adding or removing columns.

Note that the focus will always be reset to the first column though.

closes odoo/odoo#102142

X-original-commit: 63c87eac6173af13ec84f90a7f25f07a074197f3
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2022-10-04 20:01:29 +02:00
Dardenne Florent (dafl) fc4df3c0b2 [REV] web: kanban: bottom quickCreate button
This commit is the revert of #98703.

closes odoo/odoo#102116

X-original-commit: 64c0ed09f058cff9b3cebfe5480a7efd0caa7be6
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Signed-off-by: Dardenne Florent (dafl) <dafl@odoo.com>
2022-10-04 19:04:25 +02:00
William Braeckman ee9a282c19 [FIX] web: fix file upload service event listeners
The event listeners were added to the upload object instead of the xhr
object making them being called before they were supposed to.

closes odoo/odoo#102061

X-original-commit: 804467d7b0a583ab36a47212d482b41d29ca2203
Related: odoo/enterprise#32247
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2022-10-04 17:01:29 +02:00
Habib (ayh)andJohn Laterre 805d2c0820 [FIX] web: monetary formatter in readonly ignores currency_field in field definition
Steps to reproduce:

Select a company whose currency is USD.
Create an invoice in EUR.
Go to the "Journal Items" tab.
The amounts in the "Debit" and "Credit" columns are correct, but the currency symbol is € (invoice currency) instead of $ (company currency).

This should not happen since both of these fields have `currency_field='company_currency_id'` in their definition:
https://github.com/odoo/odoo/blob/702adc878e897461c4c9976110cee84d397ff4af/addons/account/models/account_move_line.py#L90-L99

But since those fields fulfill the conditions in `canUseFormatter`:
https://github.com/odoo/odoo/blob/702adc878e897461c4c9976110cee84d397ff4af/addons/web/static/src/views/list/list_renderer.xml#L228-L229

`currencyField` remains undifined in the `formatOptions` when going through `getFormattedValue`:
https://github.com/odoo/odoo/blob/702adc878e897461c4c9976110cee84d397ff4af/addons/web/static/src/views/list/list_renderer.js#L722-L734

Which is why the current fix looks at `options.field.currency_field` before falling back to `currency_id` when setting `currencyField`.

A test is also added to make sure the issue does not creep back in again.

closes odoo/odoo#101995

X-original-commit: a860370b8ed73c192c652b4a97ac0aa1d1c23936
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Co-authored-by: Habib (ayh) <ayh@odoo.com>
Co-authored-by: John Laterre (jol) <jol@odoo.com>
2022-10-03 21:23:03 +02:00
Mathieu Duckerts-Antoine c57f839721 [FIX] web: list: do not always keep offset
Have a list view with more records that can be displayed with the current
limit. Go to next page and group by some field that produces fewer groups
that the current offset. Before this commit, no group is shown because
the offset is kept when the list reload. The same thing can happen when
the domain is changed.

We fix that bug by setting the offset to be zero when the list reload.

closes odoo/odoo#101975

X-original-commit: bda0bd21c8e6772cbfb0680a2b8b497dbbcfd628
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2022-10-03 18:20:03 +02:00
Michael (mcm) d1d9a5f2de [FIX] web: reload correct record after print
Before this commit, printing an invoice which is not
created yet reloaded the view with a new record.
Now, the view reloads with the current record.

closes odoo/odoo#101947

X-original-commit: 0bad6ae4185d9b25684d0c47c9cee7c098053707
Related: odoo/enterprise#32191
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2022-10-03 17:18:26 +02:00
Simon Genin (ges) 76e7dbb532 [FIX] web: kanban groups t-foreach key is always unique
Currently, the keys passed through the t-foreach for looping over the
groups has a flaw. It comes from a method that works as below:
It checks the group has a value => provide a key as group_key_{value}
if not => group_key_{i} where i is the iteration index
But the {value} is acutally just an id of some model. So in some cases,
with low ids (empty DB, tests, ...), you can run into situations where
the keys are duplicates, making owl crash.

This comit fixes the function to make sure it has no duplicates.

closes odoo/odoo#101925

X-original-commit: aadb38e259c25cea69d54c3c62b21d8e747f9b87
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2022-10-03 16:18:55 +02:00
Denis Ledoux 99a9cce9ba [IMP] base, web: set can_create/can_write only on editable nodes
Setting the attributes `can_create` and `can_write` in views
which are not editable is useless as you cannot edit the record
in these views.

This allow to gain some KB when serving the view to the web client,
as well as making the view cleaner.

e.g. the graph view in the CRM > My Pipeline menu

Before:
```xml
<graph string="Opportunities" sample="1">
    <field name="stage_id" can_create="true" can_write="true"/>
    <field name="user_id" on_change="1" can_create="true" can_write="true"/>
    <field name="color" modifiers="{&quot;invisible&quot;: true}"/>
</graph>
```

After:
```xml
<graph string="Opportunities" sample="1">
    <field name="stage_id"/>
    <field name="user_id" on_change="1"/>
    <field name="color" modifiers="{&quot;invisible&quot;: true}"/>
</graph>
```

This revision takes the opportunity to port the `editable` concept
from the server to the web client MockServer,
in order to be able to test the removal of these attributes from the views
in the QUnit tests.

The `_editableNode` JS function added here is the translation of the
existing `def _editable_node` method in `addons/base/models/ir_ui_view.py`

https://github.com/odoo/odoo/blob/f5edde3624f4fe40f87cc7fed7dcfc4bbce1f19f/odoo/addons/base/models/ir_ui_view.py#L1282-L1301

closes odoo/odoo#101902

X-original-commit: f0beddf534a57e972ac3a7bef6afa1caae1dcff3
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-10-03 15:18:55 +02:00
Mathieu Duckerts-Antoine b6a0e89371 [FIX] web: list: care about allow_order option
Some overrides of search might allow to sort on non sortable fields like
my_activity_date_deadline on crm_lead. An option allow_order was used
to indicate that to the legacy list view. The new list view introduced
with https://github.com/odoo/odoo/commit/bc0a0cead62edd1e0b299fb9a90cd21792814618
no longer consider that option and consequently the Pipeline list view
of crm can now longer be sorted by my_activity_date_deadline. The same
happens in some other views.

In this commit, we reintroduce the use of that option in the list view
and fix that problem.

closes odoo/odoo#101837

X-original-commit: 52481d55ef857ffc1004d27216cbf6b81a527b14
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-10-02 13:11:47 +02:00
Joseph Caburnay af12d17b9d [REF] web: port timezone_mismatch to wowl
closes odoo/odoo#101811

X-original-commit: 1666d7625e19ed37184a72e625db8b89c8d10bf0
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-10-02 13:11:44 +02:00
Mathieu Duckerts-Antoine fecde580d5 [FIX] web: tree found in action views
Before this commit, open an act window action asking for a tree view
would cause a crash. We fix that.

closes odoo/odoo#101831

X-original-commit: fa6fd8b079ad3347f3571654f07bf9751834654d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-10-01 17:04:48 +02:00
Aaron Bohy dac7511153 [FIX] web: SelectCreateDialog: onCreate default behavior
Before this commit, with its default props, the SelectCreateDialog
displayed a "Create" button in its footer, but clicking on it does
nothing.

This commit simply opens a FormViewDialog to create a new record
of the given model, like in legacy. This default behavior can still
be overridden thanks to the props "onCreateEdit".

X-original-commit: 3afaad687e8ca8cb34a7bf7121e75a5a583762ed
Part-of: odoo/odoo#101819
2022-10-01 14:52:27 +02:00
FrancoisGe 23e7052861 [FIX] web: delete a record in a grouped kanban
Before this commit, in a grouped kanban view, when the "delete" button
of a card is clicked, the card is deleted but a "Load more..." is
displayed in the column.

Why is this?
The group counter is not correctly decremented when the record is deleted

How to reproduce :
- Go to a grouped kanban view with a delete button on its cards
- Click on the delete button

Before this commit:
The record is deleted and "Load more..." is displayed in the record column.

After this commit:
The record is deleted.

closes odoo/odoo#101817

X-original-commit: c97551a5aac6eaa0ca3d750039a65e3e03a453da
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-10-01 14:52:22 +02:00
Aaron Bohy 40df434b2d [REF] web: remove legacy calendar view
The calendar view and all its extensions have been converted to
owl, so it's time to get rid of the legacy implementation.

closes odoo/odoo#101816

X-original-commit: 681a6a98c9919021c2f688609e5e4263a9cf4d14
Related: odoo/enterprise#32130
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-10-01 14:52:16 +02:00
Michael (mcm) 9087b3c2d8 [FIX] web: display "Oh snap" dialog when needed
Before this commit, the "Oh snap!" dialog could be displayed anytime
a server validation error was returned by an RPC. Also, clicking
on the "discard" button in this dialog always triggered an `historyBack`
even when we open a new action.

Now, this dialog is only opened on error while saving and does not
`historyBack` anymore.

closes odoo/odoo#101802

X-original-commit: 31c6ecb7f9ad68d337cbc7f0fd3b4d682c088b85
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-10-01 13:01:50 +02:00
Aaron Bohy 96c590504b [REF] web: remove toggle_button field from registry
This field widget is no longer used in form, list or kanban views,
so it hasn't been converted to owl. This commit removes its legacy
implementation from the registry, s.t. we ensure nobody use it
again. Moreover, we adapted a new view test using it to use another
field widget instead, to remove the dependency and ease the removal
that should happen soon.

closes odoo/odoo#101787

X-original-commit: 68cfd4b08bc9ab0305ae9033e42820370b52bdf3
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-30 18:42:37 +02:00
Aaron Bohy 91e7dfd63a [FIX] web: FieldTooltip: display component description in debug
In debug, we want to see the field component description in its
tooltip. For instance, for a many2one: `Widget: Many2one (many2one)`,
`Many2one` being the `displayName` attribute of the Component, and
`many2one` the key in the registry (to use with `widget="many2one"`
in archs).

X-original-commit: 39fbb4620b5e846cd597ecbbfefdbda8bc4cb8e1
Part-of: odoo/odoo#101787
2022-09-30 18:42:37 +02:00
luvi 909a510120 [FIX] web: add a send email button to field in edit mode
This commit brings back the functionality to send e-mails when using
the EmailField in form views. Since they are displayed in edition by
default, the link was no longer available and the feature was missing.

A test has been adapted to assert the presence of the button.

X-original-commit: dbaa1c1083803f31d932445fed8d6324c5191c4b
Part-of: odoo/odoo#101786
2022-09-30 18:42:31 +02:00
luvi e8a9868605 [FIX] web: add a Go to URL button to UrlField in edition
This commit adds a Go to Url button next to the UrlField input. Since form
views are always set in edition mode, it was no longer possible to open
URLs by clicking on the link. Now, a button has been added directly after
the input to bring back the original feature.

Tests assert the right behavior regarding this button.

X-original-commit: e97215e78500a7b36aa0da073c767f5f96198d3f
Part-of: odoo/odoo#101786
2022-09-30 18:42:31 +02:00
luvi aea8a49a35 [FIX] web: adapt Call button for PhoneField
Since form views are always visible in edition mode, it was no longer
possible to click on the phone number to start a call. Now, a button
is displayed next to the input, allowing the call to start despite
the state of the view.

Tests have been adapted to assert the presence of the button.

Enterprise PR: https://github.com/odoo/enterprise/pull/31954

X-original-commit: 4ac2f17ce6279aa745b1a930f52b86635a04753c
Part-of: odoo/odoo#101786
2022-09-30 18:42:31 +02:00
Bruno Boi 7e1304c137 [FIX] web: color edition of many2many_tags_field
Before this commit
Can display the color list picker event if no color_field has been set.
This could lead to a traceback if a color is selected.

After this commit
The field does not allow to show the color list without a color_field.

closes odoo/odoo#101679

X-original-commit: 160ba4b4edfde052d9881a23294ceafc0ceec278
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-30 09:32:18 +02:00
luvi 8912bb4dfb [FIX] web: add binaryFormatter for files
This commit fixes the display of files in list and in the BinaryField,
which was displaying the complete file value instead of a human readable
size.

A new formatter has been added, and the isBinSize utils has been added
to its own utils file instead of depending from the field.

A test has been added to verify the correct visibility of a file in a
list view instead of showing the file content.

closes odoo/odoo#101673

X-original-commit: ff8485b2289a1157cdae608bd4223012fc67b77c
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-29 20:51:18 +02:00
Aaron Bohy f026c8a4d4 [FIX] web: convert iframe_wrapper field to owl
This field has been forgotten in the PR converting all web fields
to wowl.

closes odoo/odoo#101661

X-original-commit: 2e1c78b3818cdcb97afe4cd1496e0da6f8bac1b7
Related: odoo/enterprise#32041
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-29 20:51:07 +02:00
Aaron Bohy 85bbbd2381 [FIX] web: re-introduce many2one_reference field and formatter
This field type has been forgotten in the PR that converts web
fields to wowl, probably because it wasn't tested. This commit
defines a Component and a formatter to use for that field type,
in wowl views, s.t. we no longer rely on the legacy implementation.

X-original-commit: 540e113d107b59af23dc9726a55f5b8376248247
Part-of: odoo/odoo#101661
2022-09-29 20:51:06 +02:00
Aaron Bohy e81c93380b [FIX] web: convert CopyClipboardButton field to owl
There are several versions of the CopyClipboard field (char, text,
url). There's also the version where the field's value isn't
displayed (only the copy button is), aka `CopyClipboardButton`.
This one has been forgotten during the owl conversion. This commit
restores it.

X-original-commit: 3dfbfb5b9568b72ebbe7c376cd56ebf056a86c75
Part-of: odoo/odoo#101661
2022-09-29 20:51:05 +02:00
Brieuc-brd 929769ecdd [REF] web: FormView, replace tables with grids
This commit replaces the FormView group tables with css grids.
Part of the overall v16 SCSS optimization/restyle, task-2704984

task-2918464

X-original-commit: a2b894989ea33364dd29a7d412e4bd4260c1f5ef
Part-of: odoo/odoo#101655
2022-09-29 19:54:49 +02:00
William Braeckman 286eee3320 [FIX] web: prevent selecting an invalid scale in calendar
By pressing the date in the calendar's date picker, a function computes
a new scale to be used depending on the previous focused date and scale,
for example clicking on the focused date in month scale will switch to
week and so on.
However it bypasses the scales that are available on the calendar's
definition.
It is now prevented.

X-original-commit: a9059b0bee02f635d563b45ee94f04bab5532fe4
Part-of: odoo/odoo#101603
2022-09-29 15:27:05 +02:00
FrancoisGe f360965dc2 [FIX] web: group a list view with a date field
Before this commit, in a grouped list view, if a date field is between
two fields with an operator_group then the view crashes.

Why is this?
The view will try to format the aggregated date value but the date does not have one.

Solution:
Use the value false if there is no aggregated value for a field.

closes odoo/odoo#101573

X-original-commit: c9485ea3dd377f486fb7543fc1092175006fc987
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-29 13:23:09 +02:00
Achraf c120f43905 [FIX] web: Allow users to enable list view with group_by_no_leaf
- Go to accounting/Report/Invoices Analysis
- Open studio
- enable list view
- empty view

This code bellow compute count_field as `__count` because group_by_no_leaf
is in the context.

But in the basic_model we don't consider this case.

https://github.com/odoo/odoo/blob/5797fd80a63309269f15bcbe4948d4429a53eec2/odoo/models.py#L2798-L2802

opw-2980923

closes odoo/odoo#101570

X-original-commit: bde2985959ef8914da4b8aca96efc5772262d0c0
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-29 13:23:01 +02:00
Pierre Paridans 7fbc49d486 [FIX] web: ListView colspan for empty lines
Before this commit, empty lines on non-editable form's list are 1 column
too long and breaks the list's layout (ie. squish other columns and
empty space on non-empty columns).

This commit fixes it by properly calculating the number of columns and
their application on the empty lines' colspan. It also fixes an assert
in the list view's tests which mistakenly required that list's records
should be editable in a non-editable form.

Steps to reproduce:
- Open a Contact
- In the notebook, choose the Accounting tab
=> The Bank Accounts list has broken layout

closes odoo/odoo#101550

X-original-commit: 543134e215200bafd89edc1303032a210a4206cf
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2022-09-29 12:17:12 +02:00
Aaron Bohy 23e93f9341 [FIX] web: Mutex: do not fork rejected promise
Have a many2one field in a form view, and try to quick create a
record. If the name_create returns an error (e.g. ValidationError
in the model), the many2one field opens a form in a dialog (aka the
slow create). It thus properly handle the error.

However, before this commit, the error returned by the RPC was also
displayed in its own dialog (behind the form dialog).

This was due to a mistake in the Mutex, which forks the promise
returned by the registered action. When that promise was rejected,
the forked one was thus rejected as well, and it wasn't caught.
That later promise is only used to unlock the mutex, so we can
safely catch it.

closes odoo/odoo#101549

X-original-commit: fe9e044b9e03ac7fff5d314e6e207921a15c8965
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-29 12:17:09 +02:00
Dardenne Florent (dafl) 9a132ba95f [FIX] web: many2many_tags_field: fix mobile placeholder
Before, in mobile, the placeholder for `many2many_tags_field` when in mobile
was the text "props.placeholder".

Now the placeholder text is dynamically set.

closes odoo/odoo#101513

X-original-commit: b7fe9f2cf2b04b1172ec2ecbb3998328976f4960
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-29 09:09:09 +02:00
Julien Mougenot e8124d2e38 [FIX] web,*: Fix style in sample data views
This commit defines new rules to disable elements in views using sample
data.

Previously, this was done by setting a 'o_view_sample_data' class on the
view and then setting another class 'o_sample_data_disabled' on elements
which had to be disabled.

Now, the logic determining which elements are disabled has been moved to
each view's SCSS file to avoid polluting the templates with redundant
class assignations. A mixin (o-sample-data-disabled) has been defined in
the SCSS utils to have the same rules on these elements.

closes odoo/odoo#101485

X-original-commit: 3e413c96ff2dff60de22e1d5e1fed7070ac2943d
Related: odoo/enterprise#31960
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-28 21:26:32 +02:00
Julien Mougenot 05d361d383 [REF] web: Rename legacy sample view class
This commit renames the 'o_view_sample_data' class to
'o_legacy_view_sample_data' in legacy views to allow new views to use
different sets of rules.

X-original-commit: 05ae053dc94f9ce91c099d74f6740604e3e376c3
Part-of: odoo/odoo#101485
2022-09-28 21:26:32 +02:00
std-odoo 9e2a3ff662 [IMP] web: clean the code about property attributes reset
Purpose
=======
When changing the type or the model of a property, the name is
re-generated, so the others record values are reset. If we change back
to the original model / type, the original property name is restored.

This is a super important behavior of the properties component and
it should be fully tested.

Reset the model and model description when changing the type.

Now that the form view is always in edit mode, even if we changed the
model / type of a properties, then save, we are able to restore the old
properties as long as we don't refresh the page.

Task-2965523

X-original-commit: 54ae82974b836a0badab3c4c767916a1daf88f76
Part-of: odoo/odoo#101487
2022-09-28 19:31:50 +02:00
std-odoo a631a333b0 [FIX] web: fix the properties field test about many2many
Purpose
=======
The many2many properties have "res.users" as model, but the model and
records were missing in the test data.

Task-2965523

X-original-commit: 974999d32e14fcfca94b327fb8d6efa06d6bf06e
Part-of: odoo/odoo#101487
2022-09-28 19:31:50 +02:00
Renaud Thiry 0553e16dbd [FIX] mail, web_editor: dialog file update event
An event was not called on uploading files in a media dialog.
This meant the parent of html field didn't know of the new attachments
which resulted in attachments being linked to no record at all
and  not being garbage collected later.

This adds a reference inside the media dialog file input so that it can
trigger that event on behalf of the html field.

The attachments newly uploaded in media dialog are uneditable
to prevent users from unlinking attachments
that are still used in the body of the composer (causing the same issue)

Task-2860761

closes odoo/odoo#101405

X-original-commit: f4dd1eb3f25672e7309759c347e2b552c5652b2f
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-09-28 14:19:11 +02:00
Aaron Bohy a076fc14e2 [REM] web: remove two unused field widgets
closes odoo/odoo#101351

X-original-commit: 577e9898029b84a70c85f2eefa68d02e265dd4fd
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-27 22:03:00 +02:00