Commit Graph
13487 Commits
Author SHA1 Message Date
Priyanka Kakadiya c50210f7c7 [IMP] web: default cursor on search panel header
PURPOSE

hovering searchpanel section titles should have the default cursor
rather than selection cursor

SPECIFICATION

show default cursor on hovering search panel header

LINKS

PR https://github.com/odoo/odoo/pull/51639
Task 2259683

closes odoo/odoo#51639

Related: odoo/enterprise#10711
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-05-26 09:42:03 +00:00
Romeo Fragomeli 3e29babc3e [FIX] web: calendar: hide event span when not used
Due to commit odoo/odoo@8e48ba3eb5
a span was added to show the time before the title on a event in
month view.

DOM of event
+---------------+
| SPAN FOR TIME |
+---------------+
| TITLE         |
|               |
|               |
+---------------+

This commit, hide the empty span when is not needed, to avoid empty
blank space.

Steps to reproduce:
* Go in calendar app
* Go in view week (BUG)

closes odoo/odoo#51859

X-original-commit: 8456be44b1bc6746563cbca5366257a1da8b4a53
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: rfr-odoo <rfr-odoo@users.noreply.github.com>
2020-05-26 08:57:40 +00:00
Romeo Fragomeli 2adaeb589b [FIX] web: deadlines are not visible in day/week calendar views
Due to commit odoo/odoo@0150141756
when the widget calendar is initialized with date type record for
date_start and without all_day mapping events aren't shown on day/week
views. This is because all day zone isn't visible when all_day mapping
is not set.

After this commit, we show the all day zone also when the date_start is
a date type.

Steps to reproduce:
* Go to Project App
* Select/Create a project
* Select/Add a task with a deadline
* Return to project
* Select calendar view
* Select week view (of the deadline) => BUG

closes odoo/odoo#51818

X-original-commit: 1d83f4184e1b82db4dd4db54d98e509432340996
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: rfr-odoo <rfr-odoo@users.noreply.github.com>
2020-05-25 13:54:55 +00:00
Thanh Dodeur 681306d4e7 [FIX] web: add access group to the pdf js template.
This commit adds the `base.group_user` access group to the `pdf_js_lib`
template so it can be lazy loaded in the JS.

closes odoo/odoo#51804

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-05-25 12:14:57 +00:00
Samuel Degueldre f5e0727ca5 [FIX] web, *: fix keyboard overlay staying active when alt-tab/clicking
*: website

The keyboard navigation mixin was initially only used in the web-client,
because of this, some of the logic for hiding the overlay was put inside
of the web-client. We recently made keyboard navigation available on
website [1]. The handlers that would hide the overlay when alt-tabbing
or clicking on the page were not registered. This commit fixes that by
making the keyboard navigation mixin register the overlay-hiding
handlers itself.

[1]: https://github.com/odoo/odoo/commit/0b0690a3934cedcab0d5e34373e8d40c2ab25660

closes odoo/odoo#50122

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-05-25 08:41:49 +00:00
Yannick Tivisse a3d8b45891 [FIX] web: Fix column reload if toggle active returns an action
Purpose
=======

On the hr_recruitment application, when archiving an employee, a
wizard pops out to ask the reason (fired, left, ...).

When archiving all the record of a column, instead of retrieving
the dbID, you get an action targeting the wizard model.

No need to call updateColumn at that time, as this will be done
when closing the wizard.

So adding this small condition fixes the traceback and changes
nothing on the flow.

closes odoo/odoo#51609

Taskid: 2259776
X-original-commit: a5b84b807be51c46f09e2103c107f4232e446bda
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-05-20 11:48:43 +00:00
Aaron Bohy 798931fc39 [REF] web(_editor): move jquery.nearest lib to web
This lib is also used by the Gantt view, so we move it to the
common basis between web_editor and web_gantt, which is web.

Part of task 2205607

closes odoo/odoo#51606

Related: odoo/enterprise#9740
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-05-20 09:33:04 +00:00
Priyanka KakadiyaandMohammed Shekha fa00ff97be [IMP] web: graph: add bar/line chart sorting
PURPOSE

Currently, reporting views such as the bar and line charts have
their x-axis sorted either alphabetically  or according to a
sequence. When reporting, the user would be interested in sorting
the x-axis values by their measure.

SPECIFICATIONS

Add 'ascending' and 'descending' options in graph view for bar and
line charts

Task 2070103

closes odoo/odoo#49970

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-05-19 07:48:41 +00:00
Anh Thao Pham (pta) bf6c4e18ae [FIX] web: fix array values export
- Install Sales and Accounting
- Go to Sales > Orders > Quotations
- Create a new quotation
- Add a product and in Order Line form, select a tax
- Save the Order Line
- Save the quotation
- Go back to quotation list
- Select (checkbox) the created quotation
- Select "Export" in Action menu
- In export wizard, choose "Excel" format and add field "Tax amount by group"
- Validate with "EXPORT TO FILE"
An error is triggered.

The issue comes from the fact that the value of "amount_by_group" is an array of tuples
and "xlwt" cannot write that type of value.

opw-2255054

closes odoo/odoo#51480

X-original-commit: dde2ca9943362b20853ab11b15fe1504c0b8d848
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-05-18 15:35:00 +00:00
Aaron Bohy 0a4ce899c5 [FIX] web: pivot no content helper
This commit reverts [1], which fixed the no content
helper message of the pivot view, by moving the message
definition in the JS.

With Owl components, one must always use the translation
function in the env (env._t), and no longer import it from
'web.core'. Moreover, there is no valid reason to define the
message in JS here, except that there was a bug in owl, that
has been fixed by [2] (merged in Odoo by the previous commit).

[1] https://github.com/odoo/odoo/commit/c7cc672aba669175280d619ad39b14daefd7733f
[2] https://github.com/odoo/owl/commit/2af8cccd65424ea75fbaa9f0a83c6974be4b1b5d

closes odoo/odoo#51442

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-05-18 12:44:45 +00:00
Aaron Bohy f71b09725f [FIX] web: update owl to last version
This commit updates owl from v1.0.7 to v1.0.8.
2020-05-18 12:43:39 +00:00
Dhruv PatelandMohammed Shekha a591e98841 [IMP] web: list: increase hitbox area of checkbox
This commit makes easier to select records in list views, by
extending the clickable area to the whole cell, instead of the
inside of the checkbox.

closes odoo/odoo#51156

Task: 2247387
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-05-18 12:39:22 +00:00
Barad Mahendra 2e56191c8b [IMP] web: Improve the show and dropdown menu of kanban
As part of the kanban view cleaning done the below improvement

- When there is no global click on the kanban card, prevent the
'focus shadow' on card so remove the show on kanban record it
will only apply for global click class and quick create.

- On the dashboard opening a dropdown should close any other dropdown.

closes odoo/odoo#50536

Taskid: 2206372
Closes: #50536
Related: odoo/enterprise#10341
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-05-18 12:11:22 +00:00
fja-odoo 99910b526e [IMP] web, web_editor: integrate colorpicker in colorpalette
Stop using the colorpicker dialog in the colorpalette widget.
Integrate the colorpicker widget in the colorpalette widget. Of course,
the colorpicker behaviors are adapted so that no useless rerendering
of the colorpalette is made on each value change.

The 'reset color' button is now a button like the other colors, no need
for a 'color_reset' event anymore. It is removed and replaced with a
'color_picked' event with color being an empty string. The clear button
now also work on hover.

Also, the topbar colorpalette for text and text background colors now
has the exact same behaviour as the background colorpalette: adding
color preview on hover.

The colorpalette now also closes on 'enter' keypress.

Part of https://github.com/odoo/odoo/pull/46088
task-2195313

closes odoo/odoo#46088

Related: odoo/enterprise#8696
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-05-15 11:05:00 +00:00
fja-odoo a72c9adbe5 [IMP] web_editor, *: make Colorpicker a Widget
*: website, web

Move the colorpicker dialog logic into a colorpicker *widget*, which the
colorpicker dialog will now instantiate.

Part of https://github.com/odoo/odoo/pull/46088
task-2195313
2020-05-14 22:45:33 +00:00
qsm-odoo 57ec9049e2 [MOV] web: rename colorpicker_dialog.xml file
The ColorpickerDialog will become a widget, this commit is only about
renaming the related XML file.

Part of https://github.com/odoo/odoo/pull/46088
task-2195313
2020-05-14 22:44:28 +00:00
qsm-odoo 5863411437 [MOV] web: rename colorpicker_dialog.js file
The ColorpickerDialog will become a widget, this commit is only about
renaming the related file.

Part of https://github.com/odoo/odoo/pull/46088
task-2195313
2020-05-14 22:34:52 +00:00
fja-odoo 87f28adaac [IMP] web: make ColorpickerDialog smaller
Remove HSL from the color picker and make the dialog smaller.

Part of https://github.com/odoo/odoo/pull/46088
task-2195313
2020-05-14 22:34:43 +00:00
Martin Trigaux 74c1107512 [IMP] web: generate lowercase password
No more shouting master passwords

closes odoo/odoo#51327

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-05-15 10:47:55 +00:00
Martin Trigaux b334dfcbd2 [IMP] web: force a master password on insecure dbs
When creating a new database, a random master password for it is
generated and strongly suggested to be used.

The motivation for this change is to have, by default, a secure master
password set for any Odoo deployment.
Often, users do not realise that, when making an Odoo installation
accessible on internet, anyone else can also access it.

Use autocomplete="new-password" for updating the master password and
play nice with password managers
When generating a new password, use autocomplete="new-password" as
well to prevent autofill of password potentially saved in password
manager.

Make the eye click to toogle on click instead of need to maintain.

closes odoo/odoo#45117

Task-id: 2091260
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-05-14 13:45:40 +00:00
Martin Trigaux d9287caf94 [IMP] *: convert to private methods
render, render_template, load, activity_schedule_with_view,
get_website_pages should all be private:
It should not be possible to render an aribtrary template only with
its name or id

Still need to render some qweb views from js so the method
render_template is kept public.
This explains why the website editor still need read access on
ir.ui.view as we want to allow any snippet to be rendered.
2020-05-14 13:59:10 +02:00
jvm-odoo 27c3244116 [FIX] web: fix kanban tags overflow
Issue

	- Install Contacts
	- Add a tag on a contact like:
	  "LongTagName_Forcepaymentcomplement"
	  and give it a color
	- Go back to kanban view
	- Resize your window

	With some sizes, the tag gets out of
	the kanban box

Cause

	The tag is moved under the color ball
	when it is too long with some resolution

	But there is others resolutions where
	the tag is too long even if it is moved
	to the next line

Solution

	Add word-break: all which will force the
	tags to break if it is too long.

OPW-2251780

closes odoo/odoo#51243

X-original-commit: 2ac6a8f289fd498794a4e5407eace0e0cd18df4c
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-05-14 10:06:38 +00:00
Hardik PrajapatiandMohammed Shekha d58edef12a [FIX] web: resize lists in form: both lists extended
Have two x2many lists in a group in a form view. Increase the
width of a column in the first table. Before this commit, the
second table was also expanded.

task-2189968

closes odoo/odoo#47652

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-05-13 08:08:57 +00:00
efe10976a4 [FIX] web: correctly update input field after onchange
In a form view, have an x2many list with two fields A and B (e.g.
A is a many2one, and B is a char). There is an onchange on the
x2many that is triggered when the user sets A, and that sets B.

In this scenario, let's assume that the user first writes something
in B, but directly deletes it. Then, he sets A. Before this commit,
in this situation, B wasn't updated with the value returned by the
onchange.

Indeed, B's field widget was still flagged as 'isDirty', because
the user interacted with it, but it didn't commit its value, as it
hasn't actually changed. Basically, it remained flagged as 'isDirty'
forever, and thus couldn't be updated with the value returned by
the onchange.

This commit ensures that the 'isDirty' status is correctly updated
when the change is actually undone.

Task 1958793

closes odoo/odoo#51085

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: pka-odoo <pka@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-05-12 13:43:53 +00:00
Aaron Bohy e02a4b93e5 [IMP] web: add more accurate test on onchange scenario
In a form view, have an x2many list with two fields A and B (e.g.
A is a many2one, and B is a char). There is an onchange on the
x2many that is triggered when the user sets A, and that sets B.

In this scenario, let's assume that the user first writes something
in B, but directly deletes it. Then, he sets A. In this situation,
B isn't updated with the value returned by the onchange.

Commit [1] is an attempt to fix this, but it actually broke what
has been done in [2]. However, tests of [2] still passed, because
they didn't accurately reproduce what happens in practice (outside
the test environment).

An input field widget listens to 'input' and 'change' events. It
commits its value when both occur, but in the 'input' case, the
action is debounced with a large value (so that it actually only
commits the value on 'change', i.e. when the field is focusset
out). In the tests, the debounce value is 0, so fields actually
commit their value directly when 'input' events occur. This is
something we may want to change in the future, to remove this
discrepancy.

This commit adds a test with a large debounce value, so that we
accurately test what happens in practice, and we make sure that
this won't be broken in an attempt of fixing something else.

[1] cdca11db2ec207363df1d4fb3c87014d9c931d25
[2] a71f223702

Related to task 1958793
2020-05-12 13:43:39 +00:00
jvm-odoo 3a11b9e757 [FIX] web: fix statusbar option conversion
Issue

	- Install Projects
	- All Tasks > Form View
	- Edit the view
	- Set statusbar clickable to '0'

	Still clickable

Cause

	In relational_field.js we do
	`!!'0'` which returns true
	like `!!'anythingelse'`

Solution

	Add a '+' which will convert
	the value into an integer
	for a better conversion.

OPW-2235311

closes odoo/odoo#51083

X-original-commit: 53cc68fce32f46a0b4bc83a1e73a5d13a60fc995
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-05-12 08:28:27 +00:00
Mohammed Shekha c28244e4b2 [FIX] web: do not use groupbys in views not groupable
Before this commit: A problem occurs with kanban views that are not
groupable (i.e. for which searchMenuTypes does not contain 'groupBy'):
if the action has a default groupby (set in Studio for instance) then
it is still applied and causes crashes. That happens in the documents
kanban view for instance.
More generally, if a view is not groupable, some information on groupbys
can appear in the interface (in a facet) while not used/useful
for the view.

After this commit:
    - if a kanban view is not groupable, a default groupby will never be
     applied.

    - if a view is not groupable, we ensures that
        - the search query generated in the control panel has
          groupBy = [],
        - groupbys cannot be represented in a facet.

closes odoo/odoo#51041

X-original-commit: 91c80291e90127792623476d8997fd2a67569170
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-05-11 13:40:10 +00:00
Hardik PrajapatiandMohammed Shekha 73a1e7f60e [FIX] web: select date/datetime value when tabbing in
before this commit,
tabbing into the date or datetime field input it has only focus, value is not
selected.

after this commit,
navigate through a view in edit mode with the TAB key, when focus comes into
date/dateetime field input then input is focused and value of date/datetime
field is also get selected.

task-2246593

closes odoo/odoo#51062

X-original-commit: 962e4e18b559d90aa3456c77035659ac8017501d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-05-12 06:30:21 +00:00
Aaron Bohy 34413f706d [FIX] web: list: multi-edition of owl fields
Before this commit, it wasn't possible to multi-edit boolean
fields in list views. Actually, it didn't work for fields rendered
by Owl components. It only impacted boolean fields because it was
the only editable field widget that had already been converted in
Owl.

It didn't work because of three issues:
 1) there is some sort of an hack in basic renderers: we set the
    attribute '__node' on the field widgets, and this attribute is
    used for instance by the controller, when it has to handle a
    multi-edition. It tries to read it from the event's target
    (typically the field widget). However, with owl components,
    '__node' was set on the FieldWrapper (wrapping the actual
    Field Component).
 2) the original target (the Owl Component which triggered the
    event) was lost when the event went through the compatibility
    layer (for owl Component embedded in legacy widgets).
 3) the multi-edition confirm dialog didn't handle Owl field
    components.

Task 2254717

closes odoo/odoo#51044

X-original-commit: 36d23cfcdef3cea3539004ee5bb4479b859b8137
Signed-off-by: Michaël Mattiello <mcm-odoo@users.noreply.github.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-05-11 14:16:43 +00:00
Aaron Bohy 8000e895cd [FIX] web: failing quick create in m2o inside x2m
Write something in a many2one field, and click on 'Create "..."'
to quick create a record with the given value (name_create). When
the name_create fails (e.g. because there are mandatory fields in
the model), we open a form view.

Before this commit, when this happened for many2one fields inside
x2many editable lists, it crashed, since [1].

[1] 50bf8309f8

closes odoo/odoo#50948

X-original-commit: 43c513306094444ff25ad98584b426ddb8a3b525
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-05-08 15:38:06 +00:00
Jinal Patel 12c6eba844 [IMP] web: make OdooBounce bounce again
... instead of pulse.

task 2239617

closes odoo/odoo#49870

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-05-08 11:38:59 +00:00
051a094838 [IMP] web: list and kanban: highlight create button
... when there is no data and user clicks anywhere in the no content
helper.

Task 2239617

Co-authored-by: Jinal Patel <jip@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
2020-05-08 11:38:59 +00:00
Nasreddin (bon) f427a38c4e [FIX] web: Handle time select in modal with firefox
Issue

	- Install sale_renting
	- Create a rental order
	- Add a "rental" product
	- In Modal, change start or end time

	In Firefox, user not allowed to change the time;
	time select not reacting well.

Cause

	The issue seems to be that in bootstrap when
	we click outside a modal, we focus on the modal:

	https://github.com/odoo/odoo/blob/27f67bfcb903/addons/web/static/lib/bootstrap/js/modal.js#L332-L337

	and the FieldDateRange widget contains a <select/> tag
	and is added outside of the modal, so when we click
	on the select, bootstrap will focus on the modal which
	in firefox seems to lose the focus on the <select/>
	which get closed.

Solution

	not propagating focusin event when the select of the
	daterange widget is focused => in my opinion this is
	the less risky solution, this could be done with a
	code such as (in the FieldDateRange._renderEdit method):

opw-2240220

closes odoo/odoo#50906

X-original-commit: 5a1e9e32061996ca1770c9ae9b5a7e7f53c5048f
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-05-08 10:52:12 +00:00
Laurent Stukkens (LTU) 68584351e4 [IMP] web: Allow hide/show stroke in signature
In the sign application, it appeared that when using the default signature
in a signature SignItem that was higher the stroke at the bottom was doubbled.

This was caused by the fact that the bottom stroke is always added to the
template and that the default signature image had it already.

In order to solve this, we have added a setting 'show-stroke' that allows
controlling the stroke presence in the signature.

Task Id 2216067
Closes #48529

Related odoo/enterprise#9538

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-05-08 07:56:09 +00:00
Laurent Stukkens (LTU) e9230a1e94 [FIX] web: Prevent page reload during sale tour test
* A step has been added to the sale tour in order to ask the user
  to update the company data. As a page reload breaks the tour test
  we need to prevent it in such situation.

TaskID :2187222

closes odoo/odoo#46167

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-05-07 13:23:07 +00:00
Aaron Bohy c88d9fc003 [IMP] web: remove _lt from env
Having _lt in the env doesn't make much sense, as it is useless
at run time, and it would incite people to require 'web.env' to
use it (at load time). The env should never be directly imported,
it is automatically propagated from parents to children.

To sum up, in Owl components:
 - when terms have to be translated at run time (e.g. in a function
   called when the user clicks on a button), the env is available
   and env._t must be used
 - when terms have to be translated at load time (e.g. a JS module
   defining a component with a translatable static property), one
   must require 'web.translation' and use function _lt it exports.

closes odoo/odoo#50656

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2020-05-07 07:26:43 +00:00
2c102c292f [IMP] web: search panel counter changes
This commit introduces several changes in the search panel with
respect to record counts:

    - the record counts are now also available for
      the fields with select="one" attribute
      (if not disabled explicitely).
    - the record counts are better computed using the idea that
      selected values within a group should not impact the counts
      for the group values but only the counts for the other
      group values.

On the way we have changed two keys in the values returned
by the server:
    - 'count' becomes '__count'.
      It has been done to avoid a possible clash in case a model would
      have a field named 'count' and that the field values would be
      wanted for some reason.
    - 'name' (multi case) becomes 'display_name'.
      It has been done in order to make the select one and multi cases
      more similar and factorize some code.

TASK-ID: 2166814

Co-authored-by: Raphaël Collet <rco@openerp.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Alexis Lacroix <laa@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
2020-05-05 19:23:20 +00:00
Mathieu Duckerts-Antoine c19dcf3983 [REF] web: search panel goes ESNext 2020-05-05 19:23:20 +00:00
Julien Mougenot d21c412985 [IMP] web: Standardize FALSE and TRUE leaves/domains
Add four static properties on the Domain.js class: (TRUE|FALSE)_(LEAF|DOMAIN).
This increases consistency for domains using these concepts.
2020-05-05 19:23:20 +00:00
Julien Mougenot 26491fcb4c [IMP] web: add sortBy to core.utils
Add a "sortBy" helper to core utils. This function takes an array and
an optional criterion as arguments and returns a new array sorted
according to the given criterion.
2020-05-05 19:23:20 +00:00
Dhruv Patel a599f1402e [IMP] web: FieldMany2one: reword and simplify dialog
This commit improves the dialog that opens when a user clicks out
of an 'un-commited' many2one. It is no longer possible to edit
the value, and the sentence has been reworded.

closes odoo/odoo#49528

Task: 2234212
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-05-05 15:19:45 +00:00
Mathieu Duckerts-Antoine 9c2a0f1db7 [FIX] web: no confusion betweed false and 'false'
In the search panel, if a select multi was grouped by a field that can
take the value 'false' (like a char field), that value would be confused
with the value false and the group 'false' would never be
displayed (its values would be put in the group false).
This commit avoids that situation by using JSON.stringify instead of
the implicit stringification done when using a value as an object key.

closes odoo/odoo#50647

X-original-commit: 5b19e6c13b636d108e8aa1a09f01124fdb38a577
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-05-05 12:04:19 +00:00
Aaron Bohy a0c7284b66 [IMP] web: add 'label' attribute on AbstractField
If set, this value will be displayed as column name in list views.
This attribute could be used in the future in form view for the
same purpose.

Part of task 2195254
2020-05-05 10:05:12 +00:00
Aaron Bohy 59641325c7 [IMP] mail: add Many2OneAvatarUser field widget
This widget is an extension of Many2OneAvatar, designed for
many2one fields pointing to the 'res.users' model, or a model having
itself a many2one field pointing to 'res.partner'.

With this widget, when the avatar is clicked, we open a DM chat
window with the corresponding partner. If the user clicked on itself,
we open a blank chat window for the sake of consistency.

In kanban views, this widget only displays the avatar.

Part of task 2195254
2020-05-05 10:05:12 +00:00
Aaron Bohy df4693e7ff [IMP] web: add Many2OneAvatar field widget
In readonly, this widget displays the image of the related record
next to its display_name. In edit, it behaves exactly like the
regular many2one.

Part of task 2195254
2020-05-05 10:05:12 +00:00
Aaron Bohy 4f8860e503 [IMP] web: add RemainingDays field widget
This widget can be used on date and datetime fields. In readonly,
it displays the delta (in days) between the value of the field and
today. In edit, it behaves like a regular date(time) widget.

Part of task 2195254
2020-05-05 08:48:34 +00:00
Aaron Bohy a3c0d6ee71 [FIX] web: list: prevent flickering
Have a list view with "badge" field component and 'decoration-xxx'
attributes (on that field). Before this commit, it flickered when
the user refreshed the list (for instance, by clicking on the list
icon in the view switcher). The badges were displayed with a grey
background (i.e. no decoration) for a brief moment, before their
style was applied.

Their style is applied in the mounted hook, which is called by
'on_attach_callback' (legacy version of mounted). However, the list
renderer computes its column widths in 'on_attach_callback', which
produces a repaint.

This commit moves this operation to the end of on_attach_callback,
such that other processing (like applying the badges style) is done
before the repaint.
2020-05-05 08:48:34 +00:00
Aaron Bohy 1d6e4948d2 [IMP] web: add BadgeField component
This new field component displays the field's value inside a
bootstrap pill badge. Supported field types are 'char', 'selection'
and 'many2one'. The background color of the badge can be customized
by using the decoration-xxx mechanism, e.g.
 <field name="state" decoration-danger="state == 'cancel'" widget="badge"/>

Part of task 2195254
2020-05-05 08:48:34 +00:00
Aaron Bohy 56787d5878 [REF] web: field decoration
This commit refactors the way the decoration-xxx attributes are
applied to field widgets/components, in a way that it can be
overridden in a given field or component to generate the approriate
className. By default, 'decoration-x' applies className 'text-x'.

This will be necessary for the new 'FieldBadge' component, which
needs to apply 'bg-x' classNames instead of 'text-x'.

Part of task 2195254
2020-05-05 08:48:34 +00:00
Aaron Bohy a1d3e224d8 [IMP] web: list: allow to add decorations on field nodes
In list views, one can specify decoration-XXX attributes on the
arch root node. Those decorations are evaluated for each record,
and the corresponding style is applied on rows for which the
condition is true.

This commit allows to specify those decoration-XXX attributes on
field nodes as well. In this case, when the condition is met by a
record, only the field on which the attribute is set will be
impacted.

Part of task 2195254
2020-05-05 08:48:34 +00:00