Commit Graph
1270 Commits
Author SHA1 Message Date
Lucas Perais (lpe) 0195d8e7b4 [FIX] web: view_service: store the Promise in cache, not its result
Before this commit, the result of the load_views was put in the cache, so a load_views could have been
triggered multiple times before the first of them returned

After this commit, the cahce works as expected and stores the whole Promise
We always delete from the cache Promises that are rejected (to let the user re-do it in the hope the situatuion has changed)
2021-06-18 21:31:34 +02:00
Aaron Bohy 84a4859570 [REF] web,*: move legacy files
To prepare the rewriting of the webclient in owl, we move all
current js files of web in a legacy/ folder. This folder will
eventually be removed, as soon as each file it contains will be
converted to owl and moved to the proper place in the new file
structure.
2021-06-18 21:31:27 +02:00
dht-odoo 18ad07c001 [IMP] web: add isHtmlEmpty method in kanban view
In this commit we have added new method name isHtmlEmpty in
kanban view. As we are convertting text field to html field,
we will need to check html field in if conditions.

As Html field will contain tags we cannot check it every time
perfectly. So, we need this method to make sure html field is
empty or not.

Task id: 2499504

X-original-commit: 2968dcea7fb58795eeb34949f4bbfc1029938cd1
2021-06-07 05:21:40 +00:00
Aaron Bohy f46ba96ee9 [IMP] web: list: allow to multi edit daterange field
Before this commit, the multi edition of a field using the daterange
widget wasn't really handled: only the field that was used for doing
the change (i.e. only the start or end date) was actually saved.

With this commit, the multi edit feature now supports the case where
editing a field actually triggers changes on other fields. All those
changes are displayed in the confirmation dialog.

Task 2555178

closes odoo/odoo#71545

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2021-06-02 06:59:08 +00:00
Anh Thao Pham (pta) cb500aba27 [FIX] web: fix crash on editable list view when moving over a RO field
This is a forward-port of commit https://github.com/odoo/odoo/commit/970387f91fea0cb47404612f7d519ffba2c9ad3b

In editable list view, moving to next cell using TAB key crash when the
following field is becoming read-only (i.e non-focusable) and an onchange()
event is triggered.

Consider an editable tree view like this:

<form>
   <field name="o2m" onchange="1">
       <tree>
          <field name="description"/>
          <field name="date" attrs="{'readonly': [('description', '!=', False)]}"/>
          <field name="type"/>
       </tree>
   </field>
</form>

1. Edit 'description'
2. Issue a TAB keypress before 'date' becomes read-only
It will crash while calling getSelectionRange() on an empty element.

opw-2523630

closes odoo/odoo#71163

X-original-commit: 2a880a8020b55b692505846e9626359fe019dbdb
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
2021-05-21 15:09:42 +00:00
Mohammed Shekha d9f2eafdf2 [FIX] web: disale autofill on input elements
with this commit we disables autofill of autocomplete by setting
autocomplete=off, this was previously done in commit: 64293fbdb0
but it was not working because we were setting autocomplete=none
it seems that none does not work all the time.

task-2462676

closes odoo/odoo#71016

X-original-commit: 9d6ef842902e9e192924fa0caba99514e1543352
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-05-19 08:31:15 +00:00
Jorge Pinna PuissantandSamuel Degueldre f43a0814ae [IMP]*: configuration of ESLint for specific files
This commit will add the needed ESLint configurations on the JS files.
These configurations are added if the JS file uses a different
environment (serviceworker, node, etc) or if it uses a specific global
(google, ace, etc).

Co-authored-by: Samuel Degueldre <sad@odoo.com>
2021-05-04 13:32:49 +00:00
Michael Mattiello (mcm) a3b3ca9568 [FIX] web: fix bouncing edit button prevention
The PR https://github.com/odoo/odoo/pull/68799 tried to prevent the
form's edit button to bounce when quick editing.
The fix was wrong and some field continued to bounce the button.

This commit prevents the edit button to bounce when clicking on
any field by checking if we are quick editing.

closes odoo/odoo#69826

X-original-commit: 8393b3c51b38bd285acb91279cb08a28c241c9ca
Signed-off-by: Michaël Mattiello <mcm-odoo@users.noreply.github.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-04-26 09:35:30 +00:00
Jérémy Hennecart ac13964244 [IMP] calendar: improve the way calendar event are displayed
With this commit we try to improve the way the events are displayed
to the user. Now, an event is displayed for each attendee of the event
that are selected in the filter. These events are displayed correctly
based on the status of the attendee in the event.
The colors displayed for the events now represent the attendees and not the
organizer.

If an attendee edit an event, it is edited for all others attendees.
Also, when an attendee that is not the organizer try to delete the event,
then the event is now declined in place of being deleted. If the organizer
delete the event, it is deleted for all attendees.

In case of an event where all attendees have declined it but the organizer,
the organizer see now a danger icon before the name of the event and it's
outlined and not filled with color, no matter of the actual status of the
organizer in the event.

task-2196775
COM PR: odoo/odoo#55190
ENT PR: odoo/enterprise#12196
UPG PR: odoo/upgrade#1532
2021-04-15 16:07:12 +00:00
Simon Genin (ges)andjeh-odoo 0774459f5d [IMP] web: prepare calendar view to ease modifications
The calendar renderer used a template for events.
Now moved as a configurable template to ease futur calendar changes.

This commit adds also a custom event to the calendar renderer so that custom
implementations have a way to re-render the event items within the calendar
after making internal changes to the event records.

We introduce also a new option for a field "filter_field" which allows to specify
the field of the model in which we will save the status of a filter.

This is preliminary changes in order to make the calendar view able to modify
the attendance status of a meeting and refresh the events to visually display
if the user is attending or not.

Task ID 2196775
COM PR: odoo/odoo#55190
ENT PR: odoo/enterprise#12196
UPG PR: odoo/upgrade#1532

Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: jeh-odoo <jeh@odoo.com>
2021-04-15 14:05:10 +00:00
Michael Mattiello (mcm) b73545ff2a [FIX] web: no bounce button form field/label click
Since commit [1], a delay was added to "debounce" the quick edit to
check if the user did a click or a select.
Because of this delay, the edit button now bounces when clicking on
a field or label.

In this commit, we check if the user clicks on a "quick editable"
field or a label to prevent bouncing.

[1] https://github.com/odoo/odoo/commit/2939ea4dd4736e659cc3e4df2226a3b08ac8ec48

closes odoo/odoo#68835

X-original-commit: 755a02135049f22e1e8db356169b5224f00c1f92
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-04-06 13:50:07 +00:00
Mohammed ShekhaandMathieu Duckerts-Antoine 3ed1890c7a [IMP] web: use search groupbys in pivot
Before this commit: all groupable fields were offered to selection when
a user would click on a suitable pivot header. While guaranteeing maximal
flexibility, this was easily overwhelming to any new commer.

After this commit: when at least one groupby is defined in the search
arch, the selection is done in the search arch groupbys (plus eventually
some custom groupbys) via a menu similar to the "Group By" menu in the
control panel. The advanced users have still access to more options in a
"Add custom group" menu again as in the control panel. When no groupby
is defined in the search arch, the selection is done among the groupable
fields as before.
This has led to a small modification of control_panel_model_extension.js:
it has become necessary to distinguish the groupBy filters coming from
the arch from those created by the user via the "Add custom group" menu.

Task ID: 2376505

closes odoo/odoo#61572

Related: odoo/enterprise#17341
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2021-03-31 13:56:38 +00:00
Aaron Bohy c89cdcf11c [FIX] web: tests: patch form multiClickTime once for all
A lot of tests in different QUnit modules need this delay to be
patched to 0. Some of them (e.g. the 'ActionManager > Misc' module)
didn't patch it correctly. It worked before because a patch was
done in a previous test, and wasn't unpatch. The previous commit
ensures the patch is removed, so now we have at least 2 tests of
the above mentionned module that fail. This commit ensures that
the delay is patched in every tests, and allows to specify a
custom delay if necessary.
2021-03-31 09:30:07 +00:00
Aaron Bohy a3937cfde5 [FIX] web: tests: properly unpatch after test
For testing purpose, the multi-click timeout delay of the quick
edit is patched. However, in this specific test, it is patched
twice (once to set it to 0 in beforeEach, and once to set it to 50
in the test itself). A single call to unpatch removes the second
patch (50) but keeps the first one, for the remaining of the test
suite. This could lead to weird situations where the whole suite
passes, but a single test executed on its own fails.

Issue spotted in the assets revamp PR, as it alters the test order.
2021-03-31 09:30:07 +00:00
Mohammed Shekha 8b6063ac16 [IMP] web, *: discard unchanged record in editable list
* sale_product_matrix

Before this commit, if we created a new row in an editable list view,
do not "touched" it and clicked out of the list then the record tried
to be saved and threw error notifications.
Now, that flow will discard the record to make it consistent with the
form view which discards the record when we leave the form.

task-2431691

closes odoo/odoo#68382

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-03-30 10:44:25 +00:00
Nicolas Lempereur 0e004e1b7c [FIX] web: no quick edit on mouse text selection
Do not trigger quick edit when we are selection text with mouse:

- click and holding to select text
- multiple clicks selecting text

Since click on an editable field now change the edit mode, we could no
longer select the text.

With this change, quick edit is delayed by a given delay and if the edit
mode is not enabled if:

- there is a subsequent click within the delay
- there is a text selection when the click event is handled

closes #68023

X-original-commit: 2939ea4dd4736e659cc3e4df2226a3b08ac8ec48
2021-03-22 16:59:38 +00:00
yograj tandelandMohammed Shekha ef62df2bfd [IMP] web: consider FieldDependencies given on custom widget
With this commit we support adding FieldDependencies on custom widget, consider
FieldDependencies given on custom widget and add it to fieldInfo so that when
modal does calls to server to fetch data it consider those fields while reading

this will let us to design custom widget which may have some other fields in
dependency, say for example weekly recurrence widget which uses sun, mon etc.
fields, so with this we can fetch data of those dependent fields without adding
it to view.

task-2335399

closes odoo/odoo#60277

Related: odoo/upgrade#2021
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2021-03-26 12:25:44 +00:00
Mohammed ShekhaandAaron Bohy 877ef5552b [IMP] web: add support of owl custom widget
add support of <widget> tag for owl, In order to prepare the future,
we want to convert everything in Owl, in future widgets generated by
<widget> tag will also be converted to owl.

with this commit we support widget to instantiate using ComponentWrapper.

task-2337692

Co-authored-by: Aaron Bohy <aab@odoo.com>
2021-03-26 12:25:44 +00:00
Mohammed Shekha 2f6dd3d172 [IMP] web: x2many list: update all modifiers after an onchange
Let's assume an x2many list with an onchange. When a sub-record is
modified, an onchange is performed, and it may update other records
in the relation (e.g. the debit/credit case in accounting). This
commit ensures that modifiers are correctly re-evaluated in that
situation, so that they are up-to-date with the new x2many values.

task-2373929

closes odoo/odoo#61911

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-03-25 10:33:47 +00:00
Laurent Stukkens (LTU) 68d6427a2a [FIX] web: correctly set current_company_id in BasicModel
This commit fix a bug introduced in #66551 where a mismatch has been done between
session.user_context.allowed_company_ids and session.user_companies.allowed_companies.

This commit also adds the following tests:

- a JS test in order to prevent future unwanted issues regarding multi company
  in BasicModel.
- a Python test in order to ensure that session_info['user_companies'] is not
  involuntarily changed.

closes odoo/odoo#68025

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-03-19 11:29:51 +00:00
Michael Mattiello (mcm) d94a1afe69 [FIX] web: quick edit when add a line on m2m
Before this commit, clicking on the "add a line" button on a
many2many list field directly opened the dialog without
switching the form into edit mode.
This is incorrect, the form needs to switch into edit mode otherwise
the selected records are saved and cannot be discarded.

closes odoo/odoo#67919

X-original-commit: 3608e724c6099f0eff5f14cbd844e0d7507d0d1d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-03-16 09:23:51 +00:00
Michael Mattiello (mcm) c56324ea38 [FIX] web: display remove buttons in embedded list
Since the quick edit behaviour has added, embedded lists
can be edited and display the "add a line" buttons  in a
readonly form but not display the remove buttons
This commit fixes that inconsistency.

X-original-commit: 7cc17a345bc9cbe165d061300d91d1ac0e583fc1
2021-03-16 09:23:49 +00:00
Aaron Bohy 09c64c3db4 [FIX] web: do not forget to unpatch in tests
Without this commit, all tests executed after that one would use
the patched version of the FormViewDialog.

Issue spotted in the assets revamp branch, by moving form_tests.js
after calendar_tests.js

closes odoo/odoo#67887

X-original-commit: ff19ee8d8b39a719a09dd9f6060faa3afa474da3
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-03-15 16:10:59 +00:00
Aaron BohyandGéry Debongnie 1988db86aa [FIX] web: nested one2manys, onchange and no command
Let's assume the following situation. We have a form view with a
one2many field A displayed as a list. In the list, there is a
one2many field B. B can't be edited, its value is computed by
an onchange. By default, it contains a single record (i.e. the
first value returned by the onchange is [[5], [0, 0, {...}]]).
When another field (say C) changes, B's value is re-computed to
[[5]]. Moreover, there is an onchange on A.

In this form view, let's assume the following scenario. Create a
new record and add a line to A. In this new line, B already
contains a record. Change C. This triggers an onchange that
returns [[5]], and B is now empty. It triggers a second onchange,
on the main record (as field A changed).

Before this commit, in this second onchange, B's value wasn't sent
among the other values of the new line.

The spec says that for onchanges, we must send all data, not only
what has really changed. From that perspective, the above scenario
highlights an issue.

That issue had two root causes. First, commit [1] wrongly fixed
another issue, and as a consequence, when building what to send
for the onchange, we didn't generate the values for fields that
hadn't changed inside an x2many (for added subrecords at least).
This commit reverts the fix of [1], and fixes it differently by
only sending a command 1 (update) after a command 4 (link to)
when the record is dirty (i.e. when it has been modified). See
[1] for context and details.

Second, the code that generates the values to send to onchanges is
the same as the one that generates the values to save records
(write or create). However, when saving, we only send what has
really changed. The values are at some point processed to remove
empty command lists from the list of changes (as it means that
nothing changed). However, here we ignored the flag that stated
whether we want all field values or just what has changed. This
commit takes the flag into account before removing the field's
value.

[1] https://github.com/odoo/odoo/commit/3e3a244e1afc4d74920a6302a14fa2590e8b6648

Issue reported in task~2352524
  Model: account.move
  One2Many (A): account.move.lines
  Nested computed One2Many (B): tax_detail_ids
  Field triggering the onchange (C): tax_ids

closes odoo/odoo#67739

X-original-commit: a3732031d38d7c7e93565cdd3cd4fdf838ae54ec
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Géry Debongnie <ged@odoo.com>
2021-03-12 09:42:21 +00:00
Géry Debongnie 11d2e6dde5 [FIX] web: properly apply onchange in some cases
A previous commit (8dbd1efef899fb637acca3c318ae99cb23838b8f) fixed a
part of the basicmodel that used _.each to iterate on an object with
field names as keys, which does not work when a field is named "length".
To fix it, I simply used a native for ... in statement.  However, I
missed the fact that there was a second 'return' statement in the body
of the closure given to _.each, so the onchange method returned
prematurely.

The fix is to simply use the continue statement in that case.

closes odoo/odoo#67267

X-original-commit: d9834e65ee57511f4850fa2d74287eb0b67087b9
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-03-04 15:17:33 +00:00
Damien Abeloos 67c7460be1 [IMP] web: add an initial_date context key for CalendarView
* This feature will be useful when the user needs to "reschedule" an event.
  It is more convenient to open the CalendarView around the original start date of the
  event instead of "Today"

* Add a test to ensure that the context key is correctly passed to the view as the initialDate

Task ID : 2410217
PR : https://github.com/odoo/odoo/pull/63370
2021-03-03 12:25:06 +00:00
Géry Debongnie 0cf7b8fd6f [FIX] web: issue with field named "length"
The underscore (_) library has a bug in which the _.each method does not
work with object which contains a "length" property. This is because it
does look for that key and if it is a number, it will assume that it is
an array with that length value.  Nicely done...

If that length value is set to 0, then it will just do nothing, since it
thinks that it is dealing with an empty array.

Note that if the value is set to an object, _.each is smart enough to
notice that it cannot be an array, and will do the correct thing in this
case.

Usually, our _.each calls are safe, since we usually iterate on arrays,
or on object with safe keys, or on object with values that cannot be a
number.

But there was 2 unsafe calls in basic_model, which leads to strange
bugs: some code is skipped, and the form view is then confused.  The
motivation for this fix is the fact that onchanges are not applied at
all, if there is a length field set to 0.

To fix this, we can just avoid using _.each.  Note to every Odoo JS
developers reading this: new Odoo code should avoid using the _ and $
libraries, because we do not really need them, and we want to keep our
dependencies to the strict mininum.

OPW: #2465808
closes odoo/odoo#66126

closes odoo/odoo#67172

X-original-commit: 8dbd1efef899fb637acca3c318ae99cb23838b8f
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-03-03 15:36:34 +00:00
Michael Mattiello (mcm)andged-odoo 7086488064 [REF] web, *: remove patchMixin + imp utils.patch
* hr, hr_holidays, im_livechat, mail, snailmail, website,
  website_livechat

This commit removes `patchMixin` and improve `utils.patch`.
`utils.patch` now supports native classes and has a new parameter
used to patch class members.

`utils.patch` is now used everywhere `patchMixin` was and it must
be used to patch classes.

closes odoo/odoo#65967

Related: odoo/enterprise#16278
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Co-authored-by: ged-odoo <ged@odoo.com>
2021-02-26 10:39:21 +00:00
Arnaud Joset c9003f3f4b [IMP] web: calendar improvements
This commit improves the calendar behavior.

 * Before this commit, the invisible attribute were not evaluated in the calendar popover.
 * Several alignment, label, improvements

taskid: 2342252
2021-02-25 08:25:51 +00:00
Mohammed Shekha 43ada22177 [FIX] web: fix issue of notebook page with invisiblity modifier
before this commit: when there is only one page in the notebook tag and
there is a boolean field in form to show/hide that notebook page based on
invisibility attrs, if we toggle boolean field notebook hides, that's OK
but when we toggle boolean field again then notebook page is displayed but
it is not active and due to that content of notebook page is not displayed.

after this commit: when there is only one page in notebook and it has attrs
for invisibilty, when we toggle boolean field to hide/show notebook page
then notebook page as well as content is toggled.

task-2449053

closes odoo/odoo#66582

X-original-commit: a0b5ecd344d6ac79d8e4d194cfabf3d639259c73
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-02-22 08:16:18 +00:00
Mohammed Shekha 8aecb15970 [FIX] web: do not display cover images in sample data
Before this commit, in sample mode, cover images might be displayed
in kanban views. It isn't what we want as those images are real
images from the database, not sample ones, but randomly linked to
the sample records (the id of many2one fields is randomly generated).

This commit tweaks the SampleServer to always set many2one fields
pointing to model 'ir.attachment' to false.

task-2368505

closes odoo/odoo#66381

X-original-commit: f7b2a5825e3786be53d04276af4c4c403b7a293e
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-02-17 15:00:12 +00:00
Aaron Bohy 7f2a1c487e [FIX] web: list: correctly evaluate groupby modifier with m2o
Let's assume a <groupby> node in a list view containing a button
with an invisible modifier referencing a many2one field, e.g.

```
 <tree>
   <groupby>
     <field name="m2o" invisible="1"/>
     <button string="do it" attrs="{'invisible': [('m2o', '=',
False)]}"/>
   </groupby>
 </tree>
```

Before this commit, the m2o field was correctly read, but it's
value wasn't processed by the model, so the modifier wasn't
correctly evaluated.

Issue reported on PR https://github.com/odoo/odoo/pull/65316/

closes odoo/odoo#66330

X-original-commit: fa7a185663f21c1c4060765c8c137b296df3a350
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-02-17 09:57:44 +00:00
Lucas Perais (lpe) 717112f28d [FIX] web: multiedit in a grouped list view: enable fetchBatchedM2O and References
Have grouped list with reference a m2o or a reference field

Select some records, edit them

Before this commit: the names of the reference fields and m2o disappeared

That was because the saveRecords function did not take into account a grouped list

manual forward port of #65999

After this commit: it works as expected

closes odoo/odoo#66043

closes odoo/odoo#66175

X-original-commit: 8b6e86927941dce2018ea93f191b59856ea67e4b
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2021-02-15 13:46:45 +00:00
Lucas Perais (lpe) f31c34356e [FIX] web: list multi edit: prevent force save
Have a list with multi_edit enabled
Have a widget boolean_toggle displayed on some field
Select some records to be in multi edit mode

Before this commit, the record on which the boolean toggle button was clicked was written
and then the multi edit feature was triggered and wrote on all the records
The first write is unnecessary and counter intuitive

After this commit, only the write with all the multi edited records is done

X-original-commit: 23fcaeda6830f2dc0de17337f9c3da8faf0338ce
2021-02-15 13:46:44 +00:00
Lucas Perais (lpe) 97756072bb [FIX] web: list_test: an assert was not triggered, now it is
follows #59830

X-original-commit: e1fc6707ed4ddfe7c62e6beead8617e5fbe6ea9b
2021-02-15 13:46:43 +00:00
Francois (fge)andSimon Genin d29666c04c [IMP] web, *: adapt some JS files to new module system
The previous work on adding support for native JS modules needs to adapt
some existing files, which have an incompatible name (with a '/').

Also, we convert a few JS file in /web to the native JS module system,
to show that it can work.

Part of PR 63177

Co-authored-by: Simon Genin (ges) <ges@odoo.com>
2021-02-15 10:18:11 +01:00
Michael Mattiello (mcm) e403729572 [FIX] web: fix quick edit on CopyClipboard fields
Before this commit, clicking on the copy button on a
CopyClipboard field triggered the quick edit.
Now, clicking on the copy button won't trigger the quick edit
but clicking on the field's value will.

task 2455358

closes odoo/odoo#66035

X-original-commit: 050efe415ba7821305390be125ab3a9b059f3273
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-02-12 10:19:28 +00:00
Julien Mougenot 78e44a23c9 [FIX] web,mail: Call on_attach_callback when appending content
Before this commit, the form renderer would call "on_attach_callback"
only when the whole _render process was over. The problem was that this
process is asynchronous and this callback should be invoked as soon as
the widgets are appended.

As such, any asynchronous operation is performed before appending the
content in a new function "__renderView".

Task 2346540

closes odoo/odoo#65991

X-original-commit: 953fb092636b9919aaa6c6a6cfaffd003ba951d5
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-02-12 06:36:41 +00:00
Michael Mattiello (mcm) 3b0b448408 [FIX] web: prevent quick edit in non-editable forms
Before this commit, non-editable forms could switch to edit mode
when clicking on a field or a label.
Now, the edit right is checked when the quick edit is triggered.

task 2456324

closes odoo/odoo#65964

X-original-commit: 298746a3cce3d241417bcf62f4deeeb8f3d3ca92
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-02-11 12:53:30 +00:00
Michael Mattiello (mcm) 18780e9e5a [FIX] web: fix click on field label
Before this commit, clicking on some field labels threw an error.
This was because we were searching for the associated field by its id
to get the name.
Now, we don't search the associated field anymore, we use
`fieldIdsToNames` to get the name from the id.

task 2456348

closes odoo/odoo#65838

X-original-commit: ad97c32b236d92afd4a0b6d7b39e137448b0a9a5
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-02-09 16:04:36 +00:00
Michael Mattiello (mcm)andAaron Bohy 54ea956490 [FIX] web,base: save when tab/browser closes
PR [1] introduced the auto save feature (changes in form and list
views are automatically saved when the view is left, e.g. with
the pager, breadcrumbs, stat buttons, menus...).

However, there was one case that had been left aside: when we close
the tab or browser. This commit ensures that we also save the
changes in this case.

The record is saved only if it is valid, otherwise the changes are
simply lost (we don't block the tab/browser from closing itself).

Moreover, the beforeunload handler must be *almost* sync (a few
ms setTimeout seems ok, but definitely not an rpc roundtrip). For
that reason, we cannot wait for onchanges to apply before saving.

part of task 2330101

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

closes odoo/odoo#65561

X-original-commit: 9949ea14e4f27ca8c0fc84d726ad0434e2e216b8
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
2021-02-04 15:46:28 +00:00
ijas ahammed 2689915e3f [IMP] web,sms: limit the clickable area for email/phone/url widgets
The 'o_text_overflow' class whlie provided on any field, is used to
have classic ellipsis (...) for very long string. However, it is
implemented the way that it occupies the available width for the field
tag it even if the the string is small.

The same class is also utilized in some field widgets like  email, phone,
URL etc. But it has a small side-effect due to full width occupancy.

Because the above widgets rendered an anchor tag, the clickable area is on
the whole available width instead of simply on the content provided in anchor
tag. So even if user clicks on the empty area of that field, the click
action is performed (for example, in email field widget, default mail client
pops-up) which should not happen. It should behave like clickable m2o fields
where the action is performed only when clicking the content and not on the
empty area.

With this commit, we wrap the anchor tag, within a container div tag. Here,
the overflow class will be on the container div which will do it's job to
prevent the long strings from breaking the UI, and the anchor tag being its
child, will not be the full width, thus limiting the clickable area. This
commit also makes the related test cases more robust by checking proper
classes for particular widgets.

TaskId - 2345974

closes odoo/odoo#63735

Related: odoo/enterprise#15777
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-01-15 13:05:54 +00:00
Odoo's Mergebot 985688c50c [MERGE] generic improvements from UserTesting in Project App
Generic improvements have been made to improve the Project App and its onboarding.

## Web module

- kankan examples modal: change the 'use this for my kanban' button into 'use this for my project'. To do this, a small change is made in the web module to use the options variable called `applyExamplesText` to change the label of the button in project app.
- A private method called `_getFavoriteIcon` is added in `FavoriteWidget` to easily change the icon based on the boolean value when we override this widget in another module.

## Project App

For project.task model:
  - the label of the priority label has been changed from "Priority" to "Starred".
  - the user_id field should not be clickable in form view.

For project.project model:
  - the fa-star icon has been replaced by the fa-bookmark and fa-bookmark-o icons in the kanban view.
  - When the user is the 'Project User', the 'share' button and 'project overview' stat button are hidden in the project form view.
  - the 'sales order' stat button is only visible to users who have at least the `sales > all documents access right level` in project form view.

task-2440564

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

closes odoo/odoo#65095

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-02-03 10:38:43 +01:00
Xavier BOL (xbo) 1361d0720e [FIX] web: customization of text in button for kanban example never used
Before this commit, the customization of text in button to apply kanban
example is never used because the variable which contains the text is
missspelled and thus is always undefined. That's why, we always have the
default text in this button.

This commit changes the `options.applyExampleText` to
`options.applyExamplesText` to get the text customization in project
module for instance and adds a test in order to check that the text
is well rendered.

Co-authored-by: Laurent Stukkens (LTU) <ltu@odoo.com>

task-2440564
Closes #65095
2021-02-01 13:48:00 +01:00
Achraf (abz) d70e1263f2 [FIX] web: Show create button on multiEdit + unit test
What are the steps to reproduce your issue ?

    1. Install project
    2. Open any project
    3. Switch to list view and display by Stage
    4. Open categoryA and select some records
    5. Open CategoryB

What is currently happening ?

    The button create is not displayed

What are you expecting to happen ?

    Don't hide create button

opw-2423701

closes odoo/odoo#65266

X-original-commit: 813b9fc42f5d0cc4e35afb642291200b90d1f545
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-01-29 11:56:03 +00:00
Michael Mattiello (mcm) 2c3ac6b254 [IMP] web: add quick edit behaviour
This commit adds the quick edit behaviour.
The quick edit allows to click on fields in readonly form view to switch
into edit mode. After switching mode, the clicked field is automatically
focused.
A few fields have a custom quick edit behaviour after mode switched:
  - checkboxes automatically toggle.
  - radio buttons are set to the selected value.
  - one2many list's cell are focused.
One2many list fields now show the "add a line" in readonly mode.

task 2330101
2021-02-02 12:40:23 +00:00
Michael Mattiello (mcm) d1c56ec7c4 [IMP] web, base: auto save
This commit adds the auto save for editable list and form views
but not for settings.

Now with auto save, changing the pager, going back in the breadcrumb,
going to an other action or clicking on a menu item won't ask to
confirm changes if any but will automatically save them.

In settings, the confirm dialog has been revamped.
We can now decide to "Save" or "Discard" the changes or "Stay Here" to
do nothing.

task 2330101
2021-02-02 12:40:22 +00:00
Mohammed Shekha cf922b7a12 [IMP] web: debounce list buttons on click handler
before this commit: listview buttons on row can be clicked twice due to which
action may trigerred multiple times.

after this commit: listview row button handler is debounce with 500 miliseconds
so that even if user clicks same button multiple time too quickly action is not
trigerred multiple time.

task-2391298

closes odoo/odoo#62217

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-02-02 06:16:25 +00:00
Romeo Fragomeli 3552d46037 [FIX] web: restore disableQuickCreate on calendar event
Since commit odoo/odoo@ebce7719b6
the disableQuickCreate parameter was lost during the process.

Note: there is no steps to reproduce as this feature was never used.

Related Task ID: 1891957
2021-01-28 13:55:50 +00:00
Mohammed Shekha 536c004967 [IMP] web: graph: improve measure labels
before this commit: when graph measure field has string attribute and apply
that field as measure then graph measure label uses field definition string
instead of view string, due to this measure dropdown and graph measure label
has different strings.

after this commit: when applying measure graph measure label will display
field string defined on view first else field definition string will be
displayed.

task-2264636

closes odoo/odoo#63422

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-01-28 09:53:55 +00:00