Commit Graph
11137 Commits
Author SHA1 Message Date
Michael Mattiello (mcm) 71f2f06c61 [FIX] web: render component in kanban
This commit fixes the kanban view to render components.
Before this commit, when rendering a component an error was thrown.

closes odoo/odoo#49525

X-original-commit: 29c18b53af26752079a49e4ece2419f62f680b5d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-04-14 11:58:53 +00:00
Damien Bouvy 256c75baf7 [IMP] web: add a <Popover> component
Using bootstrap popover with owl is possible, but with a lot of
friction.

This commit adds a Popover element to ease developments that require
a popover. This component takes 2 props:
  - position='bottom' (optional): 'top', 'bottom', 'left', 'right'
  - title (optional)

Its usage requires setting an `opened` slot for the content of the
popover, whilst the 'trigger' of the popover uses the default slot.

E.g.
```xml
<Parent>
 <Popover>
  <t t-set="opened">
   <p>You have opened the popover, congratulations!</p>
   <button t-on-click='_handlerOnParent'>Dispatch cake</button>
  </t>
  <button class="btn btn-primary">Click me!</button>
 </Popover>
</Parent>
```

Note that:
- only one popover can be opened at a time (opening a popover will
close any previously opened popover)
- `Popover` uses `Portal` under the hood, so events are propagated
correctly even though the popover is teleported elsewhere in the dom
(see example in this commit message with `_handlerOnParent`)
- `<Popover>` is registed as a global component in QWeb and does not
need to be added to a Component's subcomponents list

closes odoo/odoo#47710

Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-04-14 11:59:04 +00:00
Dhruv Patel dafba22a6c [FIX] web,mail: many2many_tags_email: increase limit
A long time ago, commit [1] increased the limit of displayed badges
inside a many2many_tags widget, from 40 to 1000 (a large limit that
should never been reached with such a widget).

However, this solution was specific to the many2many_tags widget,
and didn't apply to its extensions (like the many2many_tags_email
widget). For instance, open the chatter full composer, add 40
partners in the recipients field and try to add one more: nothing
happens.

This commit sets the limit on the widget itself. That way,
extensions automatically have the same limit, and can override it
if needed.

[1] d4cf4374d1

Task : 2091027

closes odoo/odoo#49488

X-original-commit: 02e41f1131b4ea3ad977cc241a3d447c37195f6e
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-04-14 08:47:15 +00:00
jerome hanke (jhk) 43a2f2051b [FIX] web: css border is consistent on layout external boxed
Steps to reproduce:
- install timesheet
- go to general settings > set documents layout to use 'external_layout_boxed'
- go to timesheets > list view > select all > print > timesheet entries

Previous behavior:
the first line of the report's table is missing a border

Current behavior:
borders are consistent

opw-2230710

closes odoo/odoo#49432

X-original-commit: a70437c0fc8127976ce00b5ec1ef4ae006b28e15
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-04-10 15:18:40 +00:00
qsm-odoo e4a7103517 [FIX] web, web_editor: allow editor instantiation from public user
If for some reason someone wanted to develop a textarea using the
editor which is supposed to work as a public user (like we are trying
to do on Odoo.com), it was not possible. The code was "designed" to
allow it but there was one problem: the lazy loading of the editor
assets required a `render_template` call to the server... which cannot
be done from a public user.

This commit solves the issues by allowing the lazy loading of assets
to use a custom route if required. That route is then used by the editor
"root". That route performs the render_template as a superuser provided
that the view's xmlid is whitelisted.

Note: there was another unauthorized call for public user: the
colorpicker. This was solved by disabling the colorpicker template rpc
for public user, they will still get the default summernote one.

Part of https://github.com/odoo/odoo/pull/48981

closes odoo/odoo#48981

closes odoo/odoo#49398

X-original-commit: e84a0bfdc99c21406861b88c02b11c925d92f927
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-04-10 11:54:03 +00:00
qsm-odoo cf85f3b082 [FIX] web: fix ajax.loadAsset cache
The caching system which was implemented was not working if the
same asset was asked twice "at the same time" = "if the second demand
occured while the first demand's RPC loading was taking place".

Part of https://github.com/odoo/odoo/pull/48981

X-original-commit: ba0ac348a3700331cec6955625ca2b6c72600ced
2020-04-10 11:54:02 +00:00
Lucas Lefèvre a27afdb543 [REF] calendar: Materialize virtual recurring events
TL;DR A bit of magic and ... Pouf ... all virtual events are now real records.

Purpose
=======
The current implementation of recurring events uses "virtual events" to represents all
events in the recurrence. Only one event is stored in the database. All other events are
dynamically built and sent to the web client which sees them as real records.
This implementation is old, difficult to read (6 years of changes and bug fixes) and
has become more and more difficult to maintain.
A fresh start would be welcome.

Specification
=============
When creating a recurring event, a `calendar.recurrence.rule` record should be created.
This model holds the rrule configuration and is responsible to manage events that result
from the rrule.
When a new recurrence is created, all resulting events are also created (stored in the
database). No more virtual events.
To avoid an explosion of events, a maximum of 720 events is created. With 720 events,
a daily recurrence lasts for 2 years and a weekly recurrence lasts for 15 years.
This strategy is used by Google Calendar and seems acceptable in most cases.
A cron job could eventually be introduced to generated more events as the end comes.

This allows to introduce an new rrule end type: 'Forever'. This is actually a shortcut
to create a recurrence running for 720 events.

Inspired by Google Calendar, new possibilities are introduced when modifying a recurring
event (e.g. change the name, add an attendee):
- Modify only this particular event (the event is still part of the recurrence)
- Modify this and following events (events are still in the same recurrence)
- Modify all events

In a similar way, when updating the rrule of an event (e.g. from every Monday to every
Tuesday), the user can choose to:
- Modify this and following events: the recurrence is split. The first part remains
  unchanged but now ends when the second recurrence begins. The second parts is the
  updated rrule.
- Modify only this particular event.
- Modify all events: Forbidden (same as Google Calendar)

Note: when events are "moved" because the rrule changed, the events are not actually
moved. They are unlinked and new events are created (See "Some design choices explained"
section).

Some design choices explained
=============================

Where to store the rrule?
-------------------------
Two options were considered.
1) Store the rrule on an event, each event of the recurrence having a Many2one
to the parent_id, aka the Master Event of the recurrence.

2) Store the rrule on another model: `calendar.recurrence.rule`. Each event in the
recurrence having a Many2one to the recurrence record.

Both options have pros & cons. But there is no clear winner.
However the actual business logic of handling the recurrence creation/update
would be the same.
Where the rrule configuration is stored is the only main difference between both options.
And this is probably the easiest part of implementing recurring events.

With that in mind, option 2) is chosen. It allows to clearly separate recurrence
logic from the events themselves. It is also the "correct" way of modeling data to avoid
many empty columns for most records.

Reusing events on rrule update
------------------------------
When an rrule is modified, events should also be updated.
In most cases, current events are unlinked and new events are created from scratch.
Only events exactly at the same time before and after the rrule update are kept.
Trying to reuse other events would require an obscure and arbitrary heuristic.
(Imagine an rrule every Monday that is changed to every Tuesday and every Friday.
What would you do?).
This implies that any change to a specific event (name change, attendee added, chatter
messages) is lost. This tradeoff seems acceptable as updating an rrule should not be
that frequent. Moreover, Google Calendar also works that way so why not Odoo?

Reusing events on events shifts
-------------------------------
On the calendar view, drag and drop an event to shift the entire recurrence.

One way to handle the recurrence shift is to apply the same timedelta to all events.
Now events are correctly positioned... except for events that were specifically
moved. Those outliers needs special handling.
This also introduces some behavior inconsistencies:
when an rrule is directly modified, events are not reused, but when the rrule is
modified by drag & dropping an event, events are reused. This option needs more code to
handle the shift and the behaviors are not consistent.

The chosen option is to find the rrule configuration from the dragged event (this is
easy) and update the recurrence with those new rrule values. This brings us back to
an rrule update (see above): code reusability yeah; one behavior to rule them all yeah.
One downside is that outliers are lost (but Google Calendar also works that way).

Task 2126717
PR #42031
PR Enterprise odoo/enterprise#8006
2020-04-09 10:56:37 +02:00
Dhruv PatelandMohammed Shekha 923988934a [FIX] web: list: blank line added before data rows
Let's assume an editable="bottom" list view with handle widget and a
required field. Moreover, there are less than 4 records in the list,
so there are empty lines at the bottom of the list s.t. there are
at least 4 rows.

Click to add a row: a new row (in edition) is added at the end of
the list (instead of an empty row). Do not fill the required field,
but instead move another row after the new one (which is still in
edition). Then click on discard.

Before this commit, the discarded row was replaced by an empty one
(s.t. there are always at least 4 rows in the table), but that
empty row wasn't added in the bottom of the list.

task-2209076

closes odoo/odoo#49251

X-original-commit: 22f43536cb78e07aaab3fd806f3c6c5f068824f3
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-04-08 14:42:03 +00:00
Kevin Baptiste 58a90952ed [IMP] project: improve usability (back2basics)
* Reword tasks in the sample project
 * Add a "Create and Edit" button on the project creation modal
 * Open the file chooser in "Set a cover image" if there are no images
   set
 * Correclty display the kanban state button on archived task
 * Add a button to list the tasks when deleting a project
 * Open file chooser for cover image: Automatically open the file chooser
   when setting a cover image on a task if there are no attachments to chose
   from.

closes odoo/odoo#47306

Taskid: 2209133
Related: odoo/enterprise#9141
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-04-08 14:29:50 +00:00
Nisha patel 04af701f76 [FIX] web: Fix the zoom image stick top on search of employee.
Currently, the Employee picture stays on top of the card of the employee
we're looking for. The image does not disappear after a search is validated.
Steps to reproduce:
 >> On employee kanban focus cursor on search panel, then mouse over
to employee image so it will be zoomed, now without mouse leave just
type in the search panel and enter, the big zoomed image stuck on
screen and don't even know how to make it go away.

So in this commit, We fix that on keudown hide the zoom image so
when user search on search panel it will hide the zoom image.
OnShow of zoom bind the generic even keydown and on that just
hide the image so it should not stick on screen.

TaskID : 2212808
Closes : #48253

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-04-03 07:19:28 +00:00
jvm-odoo c0010f86c0 [FIX] web: fix can export all without access rights
Issue

	- Access rights > archive ir exports & line
	- Any list view
	- Select all > action > export

	Access rights error

	- Export all (next to import button)

	Export done

Cause

	Action > export does a search_read which checks
	access rights

	Export all is bypassing that check

Solution

	Do a search_read when clicking on export all
	before doing the export process

OPW-2230048

closes odoo/odoo#49203

X-original-commit: 8aa89d4c416bdcf3c7f6543f3d32006f9807c938
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-04-08 10:35:08 +00:00
Julien Castiaux ab4000fb3c [REF] base: Remove deprecated exceptions and osv
TL;DR: remember `osv` and `except_orm` ? You can forget about them.

* Deprecated `except_orm` dropped.
* `UserError` elevated as super type of all user-related
  errors.
* Unused `DeferredException` dropped.
* Unused `QWebException` dropped (real one is in `qweb.py`).
* `MailDeliveryException` made a python exception.
* `name` legacy exception attribute made an alias of the python standard
  `args[0]` attribute and deprecated.
* `value` legacy exception attribute dropped.
* `exception_type` RPC error response key dropped.
* Deprecated `osv` module dropped.
* `--osv-memory-age-limit` cli option made an alias of
  `--transient-age-limit` and deprecated.

The `odoo.exceptions.Warning` have long been a deprecated alias to
`UserError`. It is going to be removed in a future version but first we
explicitly deprecate it with a warning.

The `odoo.exceptions.DeferredException` was a very old internal
exception, it has been removed without deprecation notice as it is never
raised.

The `odoo.exceptions.except_orm` has been a deprecated exception type
with deprecation warning for 5 years, it has been removed in favor of
UserError which becomes the super class of all user-related errors.

The `odoo.base.models.ir_mail_server.MailDeliveryException` was
inheriting `except_orm`. As it is not related to a user error but is
more of a problem an admin much take care of, the exception has been
made a Python error.

The `exception_type` JSON key in RPC error responses was holding an
hardcoded value derived from the exception type. Its usage has been
dropped in favor of the `name` JSON key that holds the precise exception
name. Again as it was hardly used in the source code (beside the crash
manager) it has been dropped without deprecation warning.

Since we are here trying to clean odoo custom exceptions, we are also
deprecating the `name` exception attribute in favor of the more standard
`args[0]` attribute.

The `name` (along with `value`) were two attributes used to raise
`except_orm` exceptions before the introduction of `UserError`,
`AccessError` and related exceptions. The `name` attribute, at the time,
was holding the exception type/title. Nowadays it contains the error
message. The `value` attribute, at the time, was holding the error
message. Nowadays it is no more used.

The `osv` module contains very old deprecated aliases. There is no
simple way to log a deprecation warning for osv, osv_memory and
osv_abstract but as they have not been in use for ages, they have been
removed too. To be consistent, the `--osv-memory-age-limit` cli option
has been made a deprecated alias to the `--transient-age-limit`.

closes odoo/odoo#45723

Task: 2187728
Related: odoo/enterprise#9162
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-04-08 08:41:17 +00:00
Christophe Monniez 640e63e371 [FIX] web: temporarily skip broken tests
After cb76a0022, three more Qunit tests were found to fail randomly.

closes odoo/odoo#49190

X-original-commit: 9809c53e65059d53a9f115ab29ef02583f84bdb5
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-04-08 08:42:32 +00:00
Mohammed Shekha 2b776cbbb5 [IMP] do not propagate default_* key from parent context to sub view
before this commit: from commit: https://github.com/odoo/odoo/commit/d58d6e270f4106d717821438490f60bc4f71306e parent context
was propagated to sub views, propagating whole context to sub view creates
issue as it contains default_* key inside it, there is a chance that sub view
has same field name which matches with default_fieldName in context,
e.g. go to sale order form view and create sale order line, while selecting
product, write in product_id field so that Create and Edit option comes,
select Create and Edit option, so whatever previously written in product_id
field will be added in product.product form's context as default_name,
now go to Purchase tab of product form and try to create Supplier, but note
that Vendors One2many should be editable, if it is not then to produce this
issue, make Vendor o2m list editable top/bottom, as soon as you click on
Vendor o2m's create button traceback generated which comes from name_get of
res.partner, issue raised because vendor o2m has m2o of res.partner and field
name is 'name', when default_get for vendor o2m is called it will propagate context
and context has default_name='typed string in product_id', as name field is
m2o with res.partner it will generate traceback as m2o accepts (id, name) tuple
not string

after this commit: propagate context to sub view but remove default_* keys
from parent context

task-2121161

closes odoo/odoo#49075

X-original-commit: 2e3756e0ce96a9e0c5fa304632a2600cbd832ef5
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-04-06 14:42:34 +00:00
Julien Mougenot e1f9648021 [FIX] web: empty search bar value on autocomplete close
Before this commit, the value of the search bar remained when the auto-completion
dropdown was closed (via click out or "Escape"). This was inconsistent with the
behaviour of the search bar which is supposed to show the auto-completion values
related to the search input.

Now, the value is cleared when the dropdown closes.

Task 2227590

closes odoo/odoo#49066

X-original-commit: 1c3e6ef0a5946ce415c9a210546b207011a51b3d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2020-04-06 13:38:45 +00:00
Christophe Monniez 017361d056 [FIX] web: skip calendar timezone drage and drop qunit test until fixed
Following 889dd9245, there is still a qunit test that randomly crash.

closes odoo/odoo#48977

X-original-commit: cb76a00226cf22d1ed659d736a36fa9b92e0a512
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-04-03 13:17:12 +00:00
Aaron Bohy 147d7e8910 [FIX] web: form: hide labels of oe_(read|edit)_only fields
In a form view, nodes with classname "oe_read_only" (resp.
"oe_edit_only") are only visible in readonly (resp. edit) mode.
Moreover, fields inside a group automatically have an associated
label.

Before this commit, when one of these classnames was set on a
field node inside a group, the effect wasn't applied on its label,
so the label was always visible, even if the field was hidden.

Bug reported in PR odoo/odoo#48699

closes odoo/odoo#48968

X-original-commit: 705f434f0f18a0e4d2fdb0f86d3e350d190b2a30
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-04-03 11:41:05 +00:00
Nicolas Lempereur 28f99db1e8 [FIX] web: no false positive "drag and drop on month mode with all_day mapping"
The "Views > CalendarView > drag and drop on month mode with all_day
mapping" test would fail regulary with "Found 2 elements to click on,
instead of 1" because the drag and drop would be ongoing and the event
would sometimes appear two times in the DOM when we try to click on the
drag and dropped event.
closes #48928

closes odoo/odoo#48937

X-original-commit: 9bc0b11b2e255852c1376fe6fa87722186681a73
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-04-03 08:35:55 +00:00
Lucas Lefèvreandaab-odoo 1248292630 [FIX] web,*: Remove undefined domain in action menu context
*google_drive

Go to a user form view and click on "Change Password" in the action
menus.
=> traceback `Cannot read property 'constructor' of undefined`

This error is raised because `active_domain: undefined` is in the context
and py_eval can't handle an undefined value.

closes odoo/odoo#48915

X-original-commit: 69694c627be42e3d068e48be14026493628a3a8d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: lul-odoo <LucasLefevre@users.noreply.github.com>
Co-authored-by: aab-odoo <aab@odoo.com>
2020-04-02 21:06:25 +00:00
Christophe Monniez 0f7d670434 [FIX] web: skip calendar timezone qunit test until fixed
closes odoo/odoo#48909

X-original-commit: 889dd9245eea4a06faf5aae81a47971f9db4b93f
Related: odoo/enterprise#9634
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-04-02 15:50:51 +00:00
hpr-odoo 5398aca0f9 [FIX] web: Fix the bug while zoom on image
Currently when zoom slowly from right to left on employee image it
will not zoom the image.

currently to hide the zoom image we used target.width() and the method width
gives the width of the selected element (excluding padding, border
and margin) so due to border excluded it will hide the zooming image.
Aslo the offsetHeight property returns the viewable height of an
element in pixels, including padding, border and scrollbar, but not
the margin.

The reason why the 'viewable' word is specified, is because if the
element's content is taller than the actual height of the element,
this property will only return the height that is visible.

so instead of method width we used method outerWidth which gives
width of the selected element (including padding and border, excluding
margin).

closes odoo/odoo#46619

Co-authered-by: Mahendra Barad <mba@odoo.com>
Task: 2199218
Closes: #46619
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-26 09:53:09 +00:00
Mitali Patel c248594ee5 [IMP] base: allow restricting / removing exports right
Add a new group allowing administrators to remove the ability for
users to bulk-export data from the database. It's pretty minor as
technically the user can still access the underlying object through
the basic methods but it's still a bit of a roadblock.

Users can export by default.

Task 2170900

closes odoo/odoo#45400

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-04-01 13:07:50 +00:00
Dhruv PatelandAaron Bohy ae610d0e20 [IMP] web: graph: drill down to records in bar/pie charts
After this commit, in the graph view, when the user clicks on parts
of the bar and pie charts, it opens the list view of the concerned
records (like what was already done in the pivot view).

This is the default behavior, but it can be deactivated by setting
the attribute 'disable_linking' to true in the view.

Task 2198461

closes odoo/odoo#47796

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
2020-03-31 19:15:10 +00:00
Romeo Fragomeli dc43b00553 [FIX] web: avoid to set allDay when the duration of a event is 24H * n
Before this commit, when the duration of an event is "24H * n". The event
is set as allDay. This is strange to have a event that start a 8H and end
at 8H of next days and the event is in the allDay slot.

After this commit, we don't change the allDay flag anymore.

Steps to reproduce:
* Open calendar in week view
* Create a event from 8 -> 16
* Then resize the end of this event from 16 -> 8 of the next day (BUG)

Task ID: 2183249
2020-03-31 15:37:13 +00:00
Romeo Fragomeli 0150141756 [FIX] web: don't show all_day slot when no all_day mapping is present
Before this commit, it was possible to create/move an event in the "all
day" slot of FullCalendar even when the mapping field wasn't set.

With this commit, when the "all day" mapping is not present, the "all
day" slot of FullCalendar becomes hidden.

Ref:
https://fullcalendar.io/docs/allDaySlot

Task ID: 2183249
2020-03-31 15:09:30 +00:00
Romeo Fragomeli 7b815c3bf2 [FIX] web: calendar's drag-and-dropped event has wrong end-date
Due to previous commit, in month view, the flag marking events as "all
day" is no more present and so some logic is not applied anymore. This
results into the wrong end-date.

With this commit we avoid to change the end date of an event in
FullCalendar.

Note that it changes the behavior on drag-and-dropped event in month
view:
* Before both the last and this commit, an event if 1H will become an
"all day" event when it's dropped into another cell.
* After them, the time will be the same as the original event and only
the date will change.

Also, one test was already added in commit odoo/odoo@7af13089df
to check that, in month view, when we move a non-"all day" event to
another day, it can't change into a all day event.

This commit adds a second test to cover the case when the "all day"
mapping is present.

Task ID: 2183249
2020-03-31 15:09:18 +00:00
Romeo Fragomeli d57470387a [FIX] web: calendar's event not correctly ordered in month view
Before this commit, events were sorted by ID in month view.
Event A occurring after event B would be placed on top of B instead
of below.

Steps to reproduce:

* Go in the calendar app
* Insert a event at 12:00
* Insert a event at 8:00
* Insert a event at 14:00
* Go in view month the events are not sorted (BUG)

In month view, events are forced to be "allday", so the sequence used
can't be based on its time but only on its ID.

To fix this, this commit doesn't force the "allday" flag anymore.

Task ID: 2183249
2020-03-31 15:06:53 +00:00
Romeo Fragomeli 8dfbc7d421 [MOV] web: extract mobile-specific code to enterprise
Task ID: 2092550
2020-03-31 15:06:45 +00:00
Romeo Fragomeli 70ea6739ed [REF] web: extracts calendar's methods to allow customization
This commit extracts some calendar's event handlers, private methods and
templates to create 'hooks' allowing further customization.

Task ID: 2092550
2020-03-31 15:06:35 +00:00
Romeo Fragomeli 10bc51cf88 [FIX] web: calendar's test to create an event with timezone
In `calendar_tests.js`, the tests about creating an event with timezone in
week mode only triggers 7 asserts but they were design to trigger 8 of
them.

After analysis, it looks like in the commit odoo/odoo@369c20a99b
the FullCalendar's UI was redesigned and some CSS rules might have add
some margin preventing a MouseEvent from being triggered correctly,
resulting in misadapted tests.

This commit restores the original behavior by adding some pixels to
these offsets, allowing the events to be correctly dispatched and
adapting again the tests.

Task ID: 2092550
2020-03-31 15:06:27 +00:00
Romeo Fragomeli ebce7719b6 [REF] calendar,web: update to FullCalendar v4
This commit updates the FullCalendar library from v3 to v4.

The purpose of this update for us is to add a proper support of the
drag-and-drop of events on mobile.

But also to fix scrolling issues present mainly on smaller screens. In
those configurations multi/inner-scrolls were present resulting into
either the inability to properly scroll the desired content or even
blocking alltogether the scroll.

As a nice-to-have feature, the version 4 removes its dependency on the
jQuery library, allowing a faster loading of a bigger set of events.

Last but not least, this version also reduces its dependency on the
Moment.js library (but still keeps a binding to it for compatibility
purpose).

This commit focus only on the update of the library itself and the
adaptation of the related code to keep it working. Further
enhancements/fixes will be done later on.

To do so it modifies the following points:
* Update the library in itself (js, css...).
* Convert all FullCalendar's method calls to the new syntax (e.g.
  `$calendar.fullCalendar('destroy')` becomes `calendar.destroy()`).
* Add a utility method to convert v4 events into the old v3 event
  structure to ease the transition from one version to the other.
* Wrap all event's custom fields into a new event's
  `extendedProps` object (as its the new way of storing them instead of
  directly as a prop. of the event).
* Adapt `slotLabelFormat` and `weekNumberCalculation`.
* Use the view's new names:
** `agendaDay`  -> `timeGridDay`
** `agendaWeek` -> `timeGridWeek`
** `month`      -> `dayGridMonth`
* Use the option's new names:
** `viewRender`      -> `datesRender`
** `eventMouseover`  -> `eventMouseEnter`
** `eventMouseout`   -> `eventMouseLeave`
** `isRTL`           -> `dir`
** `selectHelper`    -> `selectMirror`
** `weekNumberTitle` -> `weekLabel`

Ref:
https://fullcalendar.io/docs/upgrading-from-v3

Task ID: 2092550
2020-03-31 15:06:11 +00:00
Kevin Baptiste 79e79d0fd0 [IMP] project: add new kanban examples
Add new Kanban examples and improve the usability of the dialog.

closes odoo/odoo#48620

Taskid: 2210279
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-03-31 10:58:14 +00:00
Tiffany Chang (tic) 69e5f59005 [IMP] web: scope list table selection
Prior to this commit, the list_editable_renderer was grabbing the first
table in the DOM. This made it so extending list views with another table
could cause the new table to resize unexpectedly when changing the column
width of the list view generated table (i.e. o_list_table).

While this double table situation may not arise very often, it directly
hindered task: 2198420 and may hinder other customized view tasks.

Related to task: 2198420
("Requests for Quotations KPI's" subsection)

closes odoo/odoo#46654

Related: odoo/upgrade#877
Related: odoo/enterprise#8945
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-03-31 10:31:35 +00:00
Michael Mattiello (mcm) 4520a09f2c [REF] web: convert FieldBoolean to owl
This commit does 4 things:
- adds a file for deprecated legacy fields.
- moves legacy FieldBoolean into this file.
- converts FieldBoolean to owl component.
- adds a new xml file for component fields' templates.

task id: 2193996
2020-03-31 07:11:01 +00:00
Michael Mattiello (mcm) 9324282b01 [REF] web,*: add new field registry for components
* account

This commit adds a new field registry for component fields.
This field registry is used to only register the new field components
and the other one should register the legacy fields.
Those two registries will be used together while all legacy fields are
not converted to owl component.

As the legacy registry now throws an error when adding a component
field the existing component fields (account.ShowGroupedList and
account.ShowResequenceRenderer) are moved into the new registry.

This commit also refactors some field managers (form renderer, list
editable renderer, calendar popover) to use the new registry and thus
support the component fields.

task id: 2193996
2020-03-31 07:11:01 +00:00
Michael Mattiello (mcm) 91c7e574ed [ADD] web: add CustomCheckbox owl component
This commit adds an owl component for the Odoo custom checkbox.

task id: 2193996
2020-03-31 06:13:11 +00:00
Michael Mattiello (mcm) cde276a1ef [REF] web: add missing features of abstract field
This commit adds missing features of AbstractField written in owl.

task id: 2193996
2020-03-31 06:13:11 +00:00
Aaron Bohy 009fe3e81b [FIX] web: list: keep header checkbox selected
... when toggling an optional field.

This bug wasn't really important until now, but with the new
selection mechanism, it could lead to weird situations (e.g. the
selection box says that all records are selected, but the thead
checkbox isn't checked).

Part of task 2185145
2020-03-30 13:33:40 +00:00
Aaron Bohy 4fd30ecbc1 [IMP] web: adapt multi edit feature to list selection changes
We don't change the multi edit mechanism for now: it still only
applies to the selected records, limited to the current page.
However, we add the information in the confirm dialog to make it
clear for the user.

Part of task 2185145
2020-03-30 13:33:40 +00:00
Aaron Bohy 94583df492 [IMP] web: adapt delete feature to list selection changes
Following the new selection feature in list views, this commit
adapts the delete action.

Part of task 2185145
2020-03-30 09:55:08 +00:00
Aaron Bohy 8608a5ed8d [IMP] web: adapt (un)archive feature to list selection changes
Following the new selection feature in list views, this commit
adapts the archive and unarchive actions.

Part of task 2185145
2020-03-30 09:55:08 +00:00
Aaron Bohy 9755e8875b [IMP] web: adapt export feature to list selection changes
The export feature already exported the whole domain when the
thead selector checkbox was checked (unlike all other actions
which were executed on the current page only).

Following the new selection feature, this commit uniformizes the
behavior of the export with other actions: if the page is selected,
only the records on that page are exported. To export all records
matching the current domain, the user has to click on the 'Select
all' link in the control panel.

Part of task 2185145
2020-03-30 09:55:08 +00:00
Aaron Bohy 7af5fb31ec [IMP] web: selection in list views
This commit allows the user to apply actions to all records
matching the current domain in list views. It also ensures that
the user is aware of the set of records actually selected.

The number of selected records is now displayed in the control
panel, and the user can, with an additional click, select all
records matching the current domain instead of the ones of the
current page.

Task 2185145
2020-03-30 09:55:08 +00:00
Aaron Bohy 9be9a75e67 [REF] web: move _archive function to BasicController 2020-03-30 09:06:17 +00:00
Aaron Bohy 63047c1c33 [REF] web: DataExport tests: lint file and factorize mockRPC 2020-03-30 09:06:17 +00:00
Nicolas Lempereur b53cf339e4 [FIX] web,*: phone number ltr even in rtl language
Currently there is two ways in view to have a phone number displayed in
LTR in a RTL language:

- have `widget="phone"` on a field
- have a class o_force_ltr on the field

But this is currently done very rarely and fail in list view because the
direction of data cells is used, eg.:

```
<div style="direction:rtl">
  <table><tr><td style="direction:ltr">
      <span>+1 2 3</span>
  </td></tr><tr><td>
      <span style="direction:ltr">+4 5 6</span>
  </td>/tr></table>
</div>
```

will be displayed as:

+1 2 3
6 5 4+

In this commit, we use unicode-bidi* to optionally add an additional
level of embedding so direction is taken into account by the
bidirectional algorithm.

This commit also adds o_force_ltr class or phone widget on phone fields
where it is not already defined.

*: https://drafts.csswg.org/css-writing-modes-3/#propdef-unicode-bidi

opw-2224828
closes #48425

closes odoo/odoo#48588

X-original-commit: ab067218e069f0a92610c3f0d4137e563e47755c
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-03-30 13:50:04 +00:00
Luis González 8ccdbea9a7 [FIX] web: Make company switcher widget usable with the keyboard
Background
==========

After the refactor on the multi-company behavior performed for v13, now
there are two possible actions per company, depending on where they're
clicked: switch to the company or toggle it. Such actions were handled
by `<div>` elements, which aren't keyboard-reachable by default.

The Issue
=========

Because of the above, the company switcher was neither reachable nor
usable when using the keyboard.

Solution
========

To solve this, the following is performed:
- Add HTML attributes required to make elements reachable, along with
  their corresponding aria attributes
- Actions that are currently triggered when clicking on an element, now
  are also triggered when the keyboard focus is on the element and `ENTER`
  or `SPACE` are hit

Closes #47650

closes odoo/odoo#48627

X-original-commit: 33a7238d0b03ccb89e4c4d2f0d7380b5649dc4d4
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Luis González [Vauxoo] <luisg123v@users.noreply.github.com>
2020-03-30 16:31:37 +00:00
Dhruv Patel 8b6592e4d4 [IMP] web: add test for text paste in searchbar
added test case for text paste in autocomplete in the searchbar using mouse,
it should populate the autocomplete dropdown.

task-2204174

closes odoo/odoo#48251

X-original-commit: 010961ee3eac55a1e885ce918b597943078324f6
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-25 11:55:20 +00:00
Romain Estievenart 04cc2b5700 [FIX] web, web_tour: mobile quick search view issues
Now we have the mobile search_panel in enterprise,
this commit simply adapt the Odoo repos part with:

- Css Clean up
- Remove the no longer existing step inside the tour
the button 'o_enable_searchview' no longer exist
inside a M2X dialog

Task ID: 2200099

closes odoo/odoo#48376

Related: odoo/enterprise#9494
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2020-03-29 14:24:33 +00:00
Nicolas Lempereur 469b1a85d0 [FIX] web: show title for short event in day view
In 13.0, as of 369c20a9 there is some style that will show an event with
bigger font-size and spacing in calendar day view.

In this commit, if an event is short (less than 30 pixels, so less than
45 minutes) we will decrease the spacing to have the same as in week
view and see the event title more easily.

opw-2216654
closes #48391

closes odoo/odoo#48409

X-original-commit: a4d170ad9e73d1d63404532b161911df020b5c36
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-03-26 09:37:28 +00:00