Commit Graph
1201 Commits
Author SHA1 Message Date
Martin Trigaux 60134be18d [FIX] web: correct count of day
Introduced at 2f67881d45

Taken an event with
start_date: 2020-10-01
stop_date: 2020-10-02
allday: True

The date was displayed as "01/10 - 03/10 (2 days)" instead of "01/10 -
02/10 (2 days)"

closes odoo/odoo#60254

X-original-commit: 5eed28cf927bc504b103cc872712ab0e49830a38
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-10-19 10:50:39 +00:00
nie 54e116269c [FIX] web: Find key in stringified JSON
Steps to reproduce the bug:
- In Projects, switch to the calendar view
- Click a task

Bug:
Traceback here: https://github.com/odoo/odoo/blob/7ba47e7215df69b6556a848532e4f33ef4243e83/addons/web/static/src/js/fields/basic_fields.js#L2181

TypeError: Cannot use 'in' operator to search for 'invisible' in {}

Explanation:
We could change the inherited model of CalendarView from AbstractView to BasicView but it would be adding 400 lines of code to every calendar view. So, for now, and to keep it simple, we just parse the modifiers where it's needed to.

opw:2352436
opw:2352890
opw:2354039

closes odoo/odoo#59876

X-original-commit: 422c52a0823b1a53eeb974e76d08a44cacf4ea0a
Signed-off-by: backspac <backspac@users.noreply.github.com>
2020-10-15 10:04:59 +00:00
Lucas Perais (lpe) 54260b1dd0 [FIX] web: fetching reference fields' name_get batched in grouped list
Commit e10fd34682 introduced batched reference fields name_gets
across groups but was also buggy as follows:

Have a grouped list view showing at least 2 groups
Have a reference field with different values showed in the list for each record

Before this commit, the name_get of those reference fiels were fetched only for the last group

After this commit, the name_get are fetched in a batched fashion (by model) for each group
and display correctly

closes odoo/odoo#59910

X-original-commit: bbb608a1eff638040f0fc7b951fedf1579cc15b2
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-10-13 16:21:34 +00:00
db39211b46 [REF] web: owl graph renderer
We convert the GraphRenderer widget to an OWL component.

Task ID: 2090967

Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Florimond Husquinet <fhu@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
2020-10-12 07:43:43 +00:00
Martin Trigaux 2683184aa6 [FIX] *: fix all the typos
And other reported English mistakes in source string
Courtesy of Transifex translators

And remove leftover from gengo

closes odoo/odoo#59022

X-original-commit: 26efc84c5cac47a2cc83d7b084f8b71528fec6c7
Related: odoo/enterprise#13781
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-10-05 09:36:34 +00:00
Jorge Pinna Puissant d27b07e565 [FIX] kanban: adding context when editing column
Before this commit, when editing a column in a kanban view, in project
for instance, the translations weren't loaded.

Now, the translations are correctly loaded.

opw-2340125

closes odoo/odoo#58984

X-original-commit: e95ed1253817beccb76d1fbd55b1318b3d65cfe5
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2020-10-02 11:35:26 +00:00
Aaron Bohy 6d99a50012 [FIX] web: no export button if user not in export group
PR #45400 disabled the export feature for those who were not in
group 'base.group_allow_export'. However, it only considered the
'Export' link in the actions menu. In list view, an export button
was still displayed in the control panel (next to 'Create'),
whether the user was in the group or not.

This commit fixes this issue.

Task 2348571

closes odoo/odoo#58920

X-original-commit: 7925e30482ad0df4b2a004c223c3eb87f3ce725f
Related: odoo/enterprise#13730
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-10-01 07:20:56 +00:00
Aaron Bohy 36da1799b5 [FIX] web: list: call mounted on subcomponents at reload
Issue was spotted in list views containing the "badge" widget with
decorations (e.g. in the Purchase Order list view). At first, the
decorations were correctly applied, but they weren't anymore after
a reload (e.g. after toggling a filter).

They weren't because the list renderer didn't called
'on_attach_callback' on its subwidgets at reload (thus, 'mounted'
wasn't called on its subcomponents, and the decorations are applied
in the mounted hook).

This commit moves the logic from the FormRenderer to the
BasicRenderer, so that it applies on List, Kanban, and Form views.

This commit also removes the transition scss rule on the badge
field widget as it caused a flickering at reload.

Task 2336440

closes odoo/odoo#57766

X-original-commit: 713bce22e8f412f2c26e663b9e30fdd64933ff0c
Signed-off-by: Michaël Mattiello <mcm-odoo@users.noreply.github.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-09-16 05:59:27 +00:00
Mohammed ShekhaandDhruv Patel 8c2eda42f9 [FIX] web: blank value in many2many_tags for multi_edit popup
Let's assume a list that is multi editable and contains a m2m field
displayed with widget many2many_tags. Moreover, there are enough
values in the comodel s.t. the 'Search More' option is available
in the many2many_tags dropdown, and field 'display_name' isn't
in the list view that opens in dialog.

Enter multi-edition, edit the many2one field to add a value
(click on 'Search More', and pick a value from the list): the
picked value isn't correctly displayed in the confirmation dialog.

The issue occurred because we didn't wait for the display_name to
be fetched before opening the dialog.

Task : 2150384

closes odoo/odoo#57483

X-original-commit: ccf5834045d8b4fff9af7ddf60814c3a640e8318
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Dhruv Patel <dhp@odoo.com>
2020-09-11 08:56:11 +00:00
f12751aee3 [FIX] web: no more double discard dialog
This issue only occurred in community.
Steps to produce:
1) Create/Edit any record.
2) Change the menu using menu switcher
3) You will get the discard dialog at the instance and after some
   time it will also display another duplicate discard dialog.

So, we have one extra redundant discard dialog on menu switching.
It is working fine when we have dirty form and then click on the
breadcrumb or click on any internal child menu.

Task : 2312437

closes odoo/odoo#57359

X-original-commit: df37ce50e847e3489eb43d1ef6fc1bac6d6af333
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
2020-09-09 13:16:39 +00:00
Aaron Bohy 4e61415994 [FIX] web: kanban quick create: fix raise condition
Let's assume a kanban view using a custom form view to quick
create record:
  <kanban on_create="quick_create" quick_create_view="view_ref">

Before this commit, there was a raise condition that could lead
to a crash. For instance, click to quick create a record in a
given column, and while the form view is loading, fold the column.

Issue reported on task 2323196

closes odoo/odoo#57322

X-original-commit: 9fed69b9e0e13652fd17e9a7c7c8dd838e2f22ed
Signed-off-by: Michaël Mattiello <mcm-odoo@users.noreply.github.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-09-09 07:59:13 +00:00
Lucas Perais (lpe) 68ef4b6eb7 [FIX] web: avoid displaying noContentHelper after kanban quick_create
Have a kanban with a filter
Quick create a record in one column that won't match the domain

Before this commit, the noContent helper was displayed. This was because
the count of the group was reset to zero after the web_read_group call.

After this commit, the noContent helper is not displayed.

Note that in the quick_create situation, the records are not re-fetched
i.e. there is no search_read after the read_group.

Task-id 2251734

closes odoo/odoo#57247

X-original-commit: 0e12fa135882cd5095dbf15fe2f64231c6a84336
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-09-08 11:12:03 +00:00
Mohammed Shekha 47b0c0d2d4 [IMP] web,calendar: display attendance status widget in calendar popover
before this commit, widgets which has specialData attribute
e.g.many2manyattendee were not supported in calendar popover, as widgets with
specialData attribute are meant to be supported in form view.

after this commit, widgets with specialData attribute can be added in calendar
popover, specialData method is called explicitly from calendar_popover to fetch
special data required to render such widgets.

with this commit we also did miscellaneous improvement in many2manyattendee

- many2many_attendee status widget bullet not aligned with attendee name, with
this commit bullet is aligned with attendee name.

- if many2many_attendee does not have status value then do not display status
else blank space is displayed before attendee name.

- in community tentative status color in many2many attendee tags widget has
o-brand-secondary color which is almost light grey, so due to badge light grey
color and tentative status light grey color status is not displayed. To fix
this issue, set tentative status color to simple grey which is bit dark then
badge background color.

task-2058767

closes odoo/odoo#46396

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-09-07 13:06:41 +00:00
Aaron Bohy 7c7b478220 [FIX] web: list: do not call on_attach_callback at reload
Before this commit, the ListRenderer's on_attach_callback hook was
called each time the view was reloaded, even though the renderer
was already in the DOM. As a consequence, sub components were
mounted several times, which could lead to issues.

For instance, go to Inventory > Operations > Transfers, create a
new one. Change the Operation Type to a Receipt, and change again
to a Delivery: it crashed.

Task 2315149
Closes #56701

closes odoo/odoo#57101

X-original-commit: 78f361fb5382e4c7aed9a4e705e20f8d8757300d
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-09-04 13:40:44 +00:00
Aaron Bohy 56be6fa612 [FIX] web: form: Archive action when field not in view
Before this commit, when being in a form view without active field
(the field is defined on the model, but not present in the view),
the action "Unarchive" was available in the Actions menu, even
though the record was actually active.

The issue has been introduced by [1]. This commit restores the
previous behavior: when the active field isn't in the view, the
Archive/Unarchive action isn't available in the Actions menu.

[1] 220eb4db39

closes odoo/odoo#57041

X-original-commit: 97b70aab69b491443d862847fbff69c4e29274af
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-09-03 14:22:23 +00:00
Mohammed Shekha 75f6dcb8b1 [FIX] web: do not display nocontent help if empty
Have an action which help field has the value:
```
<p></p>
```
Display an empty list or kanban

Before this commit, the nocontent helper was displayed even though there was
nothing to display.

After this commit, an empty html tag is the same as an empty string,
so the helper is not displayed.

task-2320318

closes odoo/odoo#56883

X-original-commit: 3d6bdc5b01a4a94de9baa9bae230e6b34f38dbc9
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-09-01 12:14:05 +00:00
Mohammed Shekha 954fd0e75e [IMP] web: do not resize quick create form on window resize
The quick create form view is explicitly given the o_xxs_form_view
class at initialization but resizing the window sometimes changes that
class on form element in enterprise.
To avoid this in the quick create case, the method _applyFormSizeClass
has been overriden in QuickCreateFormRenderer in order to do nothing
when the window is resized, so that the class and the related style stay
the same as expected.

Task ID: 2317807

closes odoo/odoo#56521

X-original-commit: f9c605ea578267de17e6c1dcc69dfd179d5d95fe
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-08-25 13:45:01 +00:00
Hardik PrajapatiandMohammed Shekha 9879f738f5 [FIX] web: open list optional fields dropdown position to right place
before this commit,
when there are too many fields on list view and list view has horizontal scroll
opening optional dropdown does not open on right place, instead it opens bit
left side from the right.

this commit fixes the issue by appending dropdown div inside table element, as
scrollbar comes inside table element, so appending dropdown element inside
table just after dropdown toggler.

task-2307248

closes odoo/odoo#56516

X-original-commit: 5a044593ba1f8f08f72de502d77823a8dd5175a0
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-08-25 13:02:29 +00:00
Damien Bouvy be9ea60d07 [IMP] web: support custom create_name_field in calendar view
Until now, the quick creation dialog of the calendar view assumed that
the underlying model used a 'name' field for quick creation, with a
graceful degradation if it was not the case (redirect to the form view).

This prevented quick creation of models created through customizations
(for example).

This commit adds a `create_name_field` attribute on the view declaration
(similarly to many2one field) that allows to specify the field to use
during quick creation.

Task-2185423

closes odoo/odoo#48122

Related: odoo/enterprise#11242
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-08-24 11:50:15 +00:00
38b7462dcf [REF] web: BasicModel: combine default_get and onchange
This commit adapts the BasicModel to combine calls to `default_get` and
(first) `onchange`.  When creating a new record, we now only call
`onchange`, which thus return default values and potential onchange
values.

Tests (and the MockServer) have been adapted accordingly.

NOTE 1.  If the `default_get` within the `onchange` returns a value for
a field that is not in the view, we ignore it, and it won't be saved.
Before, that value was kept and sent upon save.  This change in behavior
may prove problematic, although the overall risk is small.  Decision has
been made to keep heavy comments and code snippets if we were to revert
back somehow to the previous situation.

NOTE 2.  Putting a context on a many2one field may change the value
returned by `name_get` for that field.  By default, the calls to
`name_get` are done by `onchange`.  If the context on a field must be
used for `name_get`, one has to set the option `always_reload` to `True`
on the field.  In that case, every `onchange` that changes the value
will trigger an extra `name_get`.

NOTE 3.  Suppose that a one2many field has a list view with field A, and
a form view without field A.  When adding a line, we now send all known
fields (main view and inline views) to the `onchange`, which may return
a default value for A.  The value will appear on the list view, but not
in the form view.  The former behavior was to call `default_get` with
the fields that occur in the form view only, and therefore field A would
be left to value `False`.

NOTE 4.  A test surprisingly adds an extra call to `read`.  The test was
actually wrong before.  With the changes in MockServer, we now correctly
receive a command `[6, false, [1]]`, whereas before we received `[1]`,
which isn't a valid command, and which was ignored.  As a consequence,
an extra `read` is done, whereas the test asserts it shouldn't.  But it
already didn't work before (I checked by sending the correct command).
This needs to be bugfixed elsewhere (task-id-2323491): in a o2m with a
onchange and default order records on an other page than the first
should not trigger a `read`.

Task 2261084

Co-authored-by: Raphael Collet <rco@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
2020-08-20 13:39:25 +00:00
ce69db55f8 [IMP] web: set focus to first visible page when active page invisible
Before this commit: if there are modifiers based on field which hides
one page and show another and if active page get invisible then instead
of first page second page gets focus, consider following example,

`<form>
    <field name="boolean"/>
    <page name="page1" attrs='{"invisible": [["bar", "=", false]]}'></page>
    <page name="page2" attrs='{"invisible": [["bar", "=", true]]}'></page>
    <page name="page3"></page>
</form>`

Consider the initial boolean value to be true; initially the first page
will be visible. But when "bar" is unchecked then page1 will be hidden
and page3 will get the focus as page2 is still not visible: it will be
after the computaion/application of all modifiers, which is currently
done after the rendering of a tab page.

Now: the first visible tab is focused on rendering (same as before) but
also after all modifiers have been updated.

closes odoo/odoo#56209

X-original-commit: 10365572aa3629e9b19d2b29726b351275de9f52
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Ipsita Borisagar <ibo@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
2020-08-20 12:37:36 +00:00
Julien Mougenot 7be346d637 [IMP] web: Improve kanban quick create keynav
The "quick create" form now renders the kanban quick_create buttons on
its own. This means that the form handles them as regular form buttons,
hence including them in its keyboard navigation.

Part of task: 2314864

closes odoo/odoo#55787

Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
2020-08-18 14:22:09 +00:00
Dhruv Patel c6b0876fa6 [FIX] web: search panel: keep good active values
In saas-13.4, if a searchpanel_default_XXXX value was found in the
context to be used as the default value of a searchpanel category
(select="one" field), then the value shown to be active for that
category would always be that value even if another value would have
been selected at some point. This was due to the fact that the
activeValueId was reset at each reload of the category to be that
default value.

In saas-13.5, the problem has been solved by 7ff2e5822f.
The present commit is simply the forward port of a test that covers the
situation described above.

closes odoo/odoo#56042

Task: 2259602
X-original-commit: bdf4fe44652668274030bb6fda25cb564f15c3a6
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
2020-08-18 12:26:08 +00:00
Jérémy Hennecart 2c21301d31 [IMP] web: manage invisible fields in graph and pivot view
PURPOSE

Be able to remove some measures from graph / pivot views. Currently fields
are automatically added but some of them make no sense.

SPECIFICATIONS

Add the possibility to not display some fields in the measures dropdown for
the graph and pivot views.

When a field is not displayed in the measures of a pivot views we remove them
also from the list of groupable fields.

LINKS

Task ID-2288381
Community PR #54774
Enterprise PR odoo/enterprise#11970
Upgrade PR odoo/upgrade#1519
2020-08-18 08:56:48 +00:00
Harpritsinh SisodiyaandMohammed Shekha 88608c605f [IMP] web: kanban: archive last column records
Before this commit, the action helper (if any) was not displayed when
archiving all records of the last non empty column of a kanban view
(making empty that view).

With the present commit, the action helper is now correctly displayed in
that situation.

Task ID: 2247788

closes odoo/odoo#50557

Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-08-17 13:21:16 +00:00
Nicolas LempereurandMathieu Duckerts-Antoine 7cf8f6f40e [FIX] web: pivot non-persistant on null value
In pivot view, a cell data is determined by his row/column key which
are the value chain of field values to get to that row/column.

If you had a grouping with value in a cell and then close the grouping,
you could somehow get the old value back wrongly on next grouping
operations.

This happened because:

- the key was computed based on the value (eg. for relational field the
  record ID) but without the field name.

- succeeding read_group only fill existing values.

eg. If on pivot view we had a salesperson with same ID as product
category, if we closed salesperson grouping then opened product
category grouping, we could possibly get the cell value to the product
category that has the same ID as the salesperson.

With this changeset, we clear the cell data corresponding to a grouping
that has been closed.

Added test without the fix would fail by displaying data of a previous
read_group that should have been cleared inbetween.

opw-2262306
closes #55129

closes odoo/odoo#55936

X-original-commit: f1df73adca4955561814d4b8e90a62d7d50c1c33
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-08-14 12:31:50 +00:00
Mathieu Duckerts-AntoineandAaron Bohy 3da3ae1178 [FIX] web: pivot: avoid to toggle invalid measure
Before this commit, click on the divider in the menu 'Measures' of the
pivot control panel would cause a crash. The present commit fixes that
situation.
We also bring another small correction: the menu won't close if one
clicks on the measure list but not exactly on a menu item or the
divider.

closes odoo/odoo#55902

X-original-commit: aad9f3fd7499ef8b660cc25fea840a34d70f75a6
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-08-14 07:52:49 +00:00
Sébastien Theys c2918c139b [IMP] web, *: improve mock server and replace most mail mockRPC
Improve mock server:

- add support for mocked `fetch`
- add support for `active_test`
- add support for x2m `in` in domains
- add support for default values computed from a function
- implement a more natural "next id" compute
- allow initial data without ids
- ensure write and x2m commands integrity
- improve bad data/bad commands error messages
- always warn for failing RPC, not only in debug mode
- fix all existing tests that had inconsistency data

Other changes done in mail (or dependents) that are not just related to tests:

- remove `direct_partner` from formatter result
  ->`correspondent` can be computed from other keys, especially `members`

- fix `livechat_visitor` convertData
  -> only process if there is value

- add `current_partner` and `current_user_id` as `init_messaging` result
  -> easier to mock than session

- remove usage of `need_moderation`
  -> that was just a search indirection to `moderation_status`

- adapt `partner_id` -> `res_partner_id` key in `_notification_format`
  -> to be consistent with field name

- add name in result of `mail_partner_format`
  -> sometimes display_name is not the same

- remove usage of `is_moderator`
  -> that was just an indirection to `moderation_channel_ids`

Enterprise counterpart: https://github.com/odoo/enterprise/pull/11523
task-2287171

closes odoo/odoo#55854

X-original-commit: 7ba3fecb3377a720d1eb70e7515a0c45da73836d
Related: odoo/enterprise#12391
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-08-13 16:26:35 +00:00
Aaron BohyandMathieu Duckerts-Antoine e219aac56a [IMP] web: sample data in pivot view
A previous commit has paved the way for displaying sample data in the
reporting views. The present commit brings the required changes to have
sample data in pivot views.

Task ID: 2282196

Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-08-12 08:52:20 +00:00
Mathieu Duckerts-AntoineandAaron Bohy ae58021255 [IMP] web: sample data in graph view
A previous commit has paved the way for displaying sample data in the
reporting views. The present commit brings the required changes to have
sample data in graph views.

Task ID: 2282196

Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-08-12 08:52:20 +00:00
Mathieu Duckerts-AntoineandAaron Bohy fd6182443f [IMP] web: sample data in reporting views (preparatory work)
The present commit brings the global changes necessary to have sample
data in the reporting views. This includes several modifications/
fixes of the sample server (many of them for better visual results).

Task ID: 2282196

Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-08-12 08:52:20 +00:00
Julien Mougenot c00e76b67c [FIX] web: Filter with domain disables category counters
Before this commit, the search panel was subject to some inconsistencies
when dealing with a category having enabled counters and with a filter
defining a "domain" attribute. Indeed, the counters could be in an
incorrect state if the right filters/categories were not loaded first,
with no simple way in doing so.

The search panel being complex enough as it is, we decided to disable
all categories' counters in the presence of a filter having a "domain"
attribute regardless of said domain.

closes odoo/odoo#55734

X-original-commit: e78f777bd8ccb314b85451cbc8d1dd9109997d7a
Related: odoo/enterprise#12341
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-08-11 10:12:15 +00:00
Michael Mattiello (mcm) 0f4acfa13f [IMP] web: remove popup on click
This commit adds a event listener on window to close
calendar popup when click anywhere outside this popup.

Task: 2193921
2020-08-11 12:32:54 +00:00
Michael Mattiello (mcm) 1e11249c93 [IMP] base,web: add scales param to calendar
This commit adds the parameter `scales` in the calendar view's template.
This parameter can be used to choose which mode(s) is/are allowed.

This commit also refactors the way we manage calendar scales.
Before scales were defined in model and renderer, now it's defined
in the view and given to model, controller and renderer by params.

Task: 2193921
2020-08-11 12:32:54 +00:00
Michael Mattiello (mcm) 441d9f65b3 [IMP] base,web: add year scale to calendar
This commit adds a new year scale to the calendar view.
It comes with a new view in the calendar, this view displays a
4x3 grid which cells are month views.

Task: 2193921
2020-08-11 12:32:54 +00:00
1e2e0f663e [FIX] web: MEASURES button disappearing when switching back to graph
before this commit, when change view from graph view to pivot view or any other
view and come back to graph view, Measures button disappear, it's only
appearing if we refresh the page.

after this commit, restore previous view state when switching back to graph
view, this was because measures button is rendered in fragment and when
switching between views, as graph view element was destroyed and re-rendered
so measures button will be mounted in fragment as update method of
ComponentWrapper will render it from previous mountArgs, so to avoid this issue
push measures element in DOM.

task-2250051

closes odoo/odoo#55666

X-original-commit: 40c709fb0abe7721d1650af9bd1d17dc8453895a
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-08-10 08:35:10 +00:00
Julien Mougenot 3178fb21b4 [FIX] web: Deep copy state exported by search panel
Having maps in its state, the search panel has to serialise its state
before sending it via exportState. Before this commit, this was done
on the state object in place, causing issues if the model was restored
without an imported state (no re-serialisation hence having a wrong
state).

Now, the exported object is deep-copied from the original state.

Task 2312131

closes odoo/odoo#55393

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-08-04 14:04:56 +00:00
Michael Mattiello (mcm) faab9ee9f6 [FIX] web: form: prevent from calling mounted twice
With this commit, the FormRenderer no longer directly extends
the WidgetAdapterMixin. It doesn't need to as its parent class
(the BasicRenderer) already uses it. Worse, they both called
WidgetAdapterMixin.on_attach_callback, and thus mounted
was called twice on Components in form views.

closes odoo/odoo#55401

X-original-commit: 4c627abd310a131a4828e9ee6be451aeee4708db
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-08-05 11:54:42 +00:00
Julien Mougenot 2524c7aaac [IMP] web: Do not store search panel categories
This commit handles two things:

1) Move the local storage logic of the search panel into the documents
module.

2) This allows for a variety of optimisations now that we do not have to
constantly wait for a potential default value hidden in the storage.
This is why this commit also introduces a way for the search panel model
extension to sometimes return its query informations sooner than after
being completely loaded.

Task 2284207
2020-08-04 12:46:27 +00:00
Lucas Perais (lpe) 49d9771c56 [IMP] web, base: action buttons in list's controlPanel
This commit introduces a new semantics to define action and method buttons
in the list view.
The aim of this feature is to be able to do some actions on selected records, or on the entire
records' domain with the help of buttons located in the controlPanel, much like the form view header buttons.

To define such buttons, one must add a `header` node in the list view's xml definition
```
<tree>
  <header>
    <button type="action|object" name="actionId|methodName" string="button's text" context="{}"/>
  </header>
  <field name="fieldName" />
</tree>
```

task-2246383
2020-07-29 08:59:42 +00:00
Hardik Prajapati 7aafa20509 [FIX] web: list: hide export button when list empty
Before this commit, at first rendering, the export button was
displayed in the list view even if the list was empty.

The issue occurred because at first rendering, the buttons aren't
moved inside the control panel yet (this is done in the 'mounted'
hook of the control panel). As we render in a fragment, the hook
is called later on, when everything is ready and inserted into the
DOM.

We'll get rid of these painful manipulations as soon as everything
will be converted to OWL.

Task 2294306

closes odoo/odoo#54307

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-07-27 12:54:57 +00:00
Michael Mattiello (mcm) 27d47d1435 [IMP] web: change list view's groups style
This commit changes a bit the style of groups in list view
* reduced padding-top/bottom of group headers to 5px
* increased the padding-left by 2px of carets to align
  them with selection checkboxes (in enterprise)

Task 2301397
ENT PR: https://github.com/odoo/enterprise/pull/11955

closes odoo/odoo#54736

Related: odoo/enterprise#11955
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-07-24 09:55:08 +00:00
Julien MougenotandMathieu Duckerts-Antoine d3dd7b24b0 [IMP] *: adapt tests to Owl search panel
Adaptation of the tests to the changes regarding the refactored search
panel and model.

Part of task 2228968

Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-07-23 08:21:10 +00:00
Aaron Bohy 11857adec0 [IMP] web,barcodes: speed up form view rendering
Large form views (containing a lot of fields), e.g. the crm.lead
form view, take a while to render (~ 250 ms). Most form views
contain several (sometimes a lot) invisible fields (invisible="1"),
whose only purpose in the view is to be fetched, so that they can
be used to evalute domains and contexts.

This commit implements a trivial optimization of the form renderer,
which consists in skipping the rendering of those invisible fields.
With this change, we gain ~25% of rendering time on the crm.lead
form view.

closes odoo/odoo#54368

Related: odoo/enterprise#11875
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-07-16 09:19:46 +00:00
Aaron Bohy 12cc5fd0cc [IMP] web: benchmark: revive benchmark suite
The benchmark suite has been broken for a while, by several
refactorings (e.g. use of native Promise). This commit makes it
work again. We do not use it much, but maybe we should as it can
be useful to track changes (mostly in view renderers) that impact
performances.
2020-07-16 07:03:05 +00:00
Aaron Bohy 11b1b82c09 [FIX] web: list: do not crush text fields
Before this commit, it might happen that text field columns in list
views were completely crushed, to let space to the other columns.

This commit fixes the issue by preventing text fields from being
wrapped during the ideal column widths computation. Doing so, text
fields will take space they deserve according to their content.
They will then be wrapped if necessary, so that they aren't trimmed,
unlike e.g. char fields.

Task 2275747

closes odoo/odoo#54664

X-original-commit: 5c54111127bd99eedb4e0331aba5a0200feb461c
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-07-17 11:58:27 +00:00
Julien Mougenot 669c2ebaec [IMP] web: improve eval context dates
This commit handles 2 things:

1) the merging of the `py_utils.context()` into the evaluation context
returned by `BasicModel._getEvalContext` to access the same time-related
keys,

2) the addition of 2 new keys into the `py_utils.context` (thus
transmitted to the basic model): `today` (an alias for the already
present `current_date`) and `now` which represents the current date and
time value.

Task 2269697
2020-07-14 09:10:32 +00:00
Aaron Bohy 9d99e75453 [FIX] web: list: don't squeeze button columns
Adjacent buttons are not displayed in a single column. When the
table overflows, we try to squeeze largest columns to make it fit
into its container (in this case, text may be clipped and an
ellipsis is displayed). Button columns didn't get away from this.

As a consequence, now that a cell may contain several buttons,
some of them may be clipped and replaced by the ellipsis, which
isn't what we want for buttons.

This commit removes the button columns from the list of columns
to squeeze, so we let the browser reduce them as much as it can,
and we keep them as they are.

Task 2282470

closes odoo/odoo#54258

X-original-commit: e00960daa3ed3d1fd3a7572b2acedd3d2fb0448e
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-07-09 08:54:28 +00:00
Aaron Bohy e55ee0bb1b [FIX] web: kanban: drag column with sample data
Before this commit, in a grouped kanban view with sample data (e.g.
crm.lead), one could toggle the 'settings' dropdown menu of a
group, and then drag&drop the group by clicking on the muted "Fold"
item in the dropdown.

After this commit, dragging a column is only possible by clicking
on the column title (but not on the 'config' or '+' icons, nor the
config dropdown).

Task 2290197

closes odoo/odoo#54179

X-original-commit: 58c38a024c96eba3469c142a8422b7bd0ab54ea4
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-07-07 10:14:54 +00:00
Julien Mougenot cd1d339763 [FIX] web: Make sample server tests deterministic
Before this commit, there were a few tests in the "sample server" suite
that asserted that every group resulting of a "read_group" would contain
at least one record, while there was actually a slight chance of it not
happening.

Now, the sample server used in the tests has been rendered deterministic
and these kind of issues are completely avoided.

closes odoo/odoo#54164

X-original-commit: a6d32ff46558b68ce3f19458f29c311ee5c658fd
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2020-07-07 08:33:28 +00:00