Commit Graph
12325 Commits
Author SHA1 Message Date
Vincent Schippefilt 5ce86a65ac [FIX] web: allow back-end to be usable with IE11
IE11 does not support Array.filter, so I replaced it with _.filter

closes odoo/odoo#30434
2019-01-31 09:15:33 +00:00
Martin Trigaux 6b054f2640 [FIX] web: do not select disabled element
If xlwt is not installed on the server, the option is disabled.
However, the first element was checked, even if it is disabled.

Trying to export record without xlwt was causing a traceback.

Introduced at b60de0db41 where xls is now the first choice

closes odoo/odoo#30724
2019-01-31 10:41:33 +00:00
Pierre Paridans 6ca2563155 [FIX] web: form's tabs should be scrollable on mobile
On mobile, swiping right/left switches to next/previous record.

This feature prevents the horizontal scroll of the form notebook's tabs by
overtaking the swipe gesture on those elements.

This issue had different consequences depending on the platform:
  - on iOS: the tabs cannot be scrolled at all.
  - on Android: the tabs can only be scrolled by using a two-fingers
    gesture

This commit restore the horizontal scroll on the tabs but also keep the
swipe-gesture to navigate records.

opw-1929267

closes odoo/odoo#30658
2019-01-30 15:42:41 +00:00
Denis Ledoux 651859a337 [FIX] web: reports, fallback for external report layout.
Following revision 61eef73b52

the fallback to the standard external layout when
the external layout is not set on the company has been removed.

It therefore leaded to the raise of the exception
```
The report's template '%s' is wrong, please contact your administrator.
Can not separate file to save as attachment because the report's template
does not contains the attributes 'data-oe-model' and 'data-oe-id'
on the div with 'article' classname.") %  self.name)
```

when the external layout was not set,
which could happen quite easily in a multi-company environment,
if you do not set the company external layout after having created it.

This revision simply puts back the fallback as it was before.

opw-1931195

closes odoo/odoo#30687
2019-01-30 10:57:00 +00:00
Géry Debongnie ad9f6aee93 [FIX] web: reload view when pressing enter in search bar
Before the control panel refactoring, whenever a user pressed ENTER in
the search bar (with no text), the current view was reloaded.  This
untested behaviour was changed (not on purpose) with that refactoring:
instead of reloading, the search view add a useless filter in the list
of facets.

We restore the previous behaviour in this commit.

closes odoo/odoo#30503
2019-01-30 10:45:11 +00:00
Romain Estievenart 3956afb8e4 [IMP] web: expose FieldX2Many relational fields
Expose to public the variable FieldX2Many.

Task ID: 1910385

closes odoo/odoo#30512
2019-02-06 10:05:11 +00:00
Andrea Ulliana 7f2ce89554 [IMP] web: add JS-related lib files for ace editor
In task handled in https://github.com/odoo/odoo/pull/29999, we will need
support for javascript files in ace editor. This commit adds the related
lib files.

See https://ace.c9.io/#extending-highlighters:
https://github.com/ajaxorg/ace/tree/master/lib/ace/mode
1. https://github.com/ajaxorg/ace/blob/master/lib/ace/mode/doc_comment_highlight_rules.js
2. https://github.com/ajaxorg/ace/blob/master/lib/ace/mode/javascript_highlight_rules.js
3. https://github.com/ajaxorg/ace/blob/master/lib/ace/mode/javascript.js

task-1919350
2019-02-05 14:12:16 +00:00
Romain Estievenart 7d1dafa3e2 [IMP] web: improve kanban mobile
Improve the mobile kanban when it's embedded in another view like
the Dashboard app

- Improve swipe: Allow to swipe on empty space
- When it's embedded :
     - The Kanban column height now is fit to the content
     - A empty space is now display if the Kanban column is empty

Task Id: 1904747
2019-01-31 11:30:54 +00:00
Romain Estievenart 635944443c [IMP] web: allow customize tab padding on pivot view
Allow the customization of the pivot header cell's left padding in mobile.

Task Id: 1904747
2019-01-31 11:30:54 +00:00
Vandan Shah f757b5eccd [IMP] web: Improve calendar display when no partner is set on event
Task:- 1906798
PR:- #28669
Co-authored By:-  Mohammed Shekha <msh@odoo.com>
2019-02-05 11:45:29 +00:00
Christophe Simonis 4400cce820 [MERGE] forward port branch saas-12.1 up to 4524ad06a8 2019-02-04 13:27:22 +01:00
mgh-odoo 43888662ff [FIX] web: unaccent default params fixed
purpose of this commit is to remove default parameter of "casesensitive",
because default parameter is ES6's feature. it's not supported in IE9.

closes odoo/odoo#30751
2019-02-01 06:50:54 +00:00
Vincent Schippefilt 2e57f90bd1 [FIX] web: fixed leak on image fields
During the unit tests, I have noticed that the test window was doing a
lot of work after the test were completed, it was using CPU and using RAM
in jigsaw pattern. Eventually after being left alone for a few hours,
the window would just crash.

This was due to an unlimitted chain of deferred running when an image
field had a load error.

The situation is as such:
1. The image is put in the DOM with an onError handler
2. There is an error, as the image is a dummy text for the tests
3. The onError is called, it clears the image field, then calls _render
4. _render re-adds an image with the same onError handler   <----------
5. The onError is called - again - it clears the image field - again  |
   (wich does nothing this time because the value is the same) -      |
   then calls _render - again                                         |
6. The second time _render is called, go to step 4 --------------------

... In the meantime, the widget has been destroyed by the test,
so it should not do anything anymore.

This fix breaks the loop, as well as bind the onError handled with 'one'
instead of 'on'.

closes odoo/odoo#30716
2019-01-31 09:38:31 +00:00
Nicolas Martinelli 1dbe4ea0d7 [FIX] web: current date
- Set the OS in a timezone such as the current day is different from the
  day in UTC (e.g. America/Nome before 10:00 AM or Australia/Melbourne
  after 3:00 PM)
- Open any datepicker
- The 'little triangle' indicating the current day is wrongly set (one
  day before or after)

Knowing that Odoo always creates momentjs date and datetime with the
`UTC` flag set to `true`, the `bootstrap-datetimepicker` does something
which seems inconsistent.

First, it retrieves the `viewDate`, and sets it to the beginning of the
month and week in:

https://github.com/odoo/odoo/blob/1c6c504215f3ef09e6336c92c9d350e87599eaa1/addons/web/static/lib/bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js#L725

In this part, it is important to note that each `startOf` functions
called sets the hours/minutes/seconds to zero. It means that the
reference time is changed.

Then, it iterates on this newly created date, and determines `today` by
comparing it to `getMoment()` in:

https://github.com/odoo/odoo/blob/1c6c504215f3ef09e6336c92c9d350e87599eaa1/addons/web/static/lib/bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js#L748

However, `getMoment()` returns the current date and time, but with the
`UTC` flag set to `false`.

Therefore, we compare a UTC datetime on which the reference time has
been changed to a non-UTC datetime, which fails to give the appropriate
current day.

There are two approaches to solve this. The first possibility is to
change the way Odoo defines momentjs dates and datetimes, maybe by
removing the `UTC` flag at creation. This sounds like a bad idea, since
other widgets or views (such as the calendar or the pivot view) make use
of them. This is likely to introduce a bunch of new issues with TZ in
these views. The second approach is patching the library to fit our use.
Although we usually don't do such a thing, this allows to specifically
solve this use case, and in particular placing the 'small triangle' at
the appropriate date without impacting any other part of the system or
the library. It can be easily performed by comparing the dates and the
months to make it work.

opw-1915251

closes odoo/odoo#30538
2019-01-29 13:26:22 +00:00
Christophe Simonis cd5c8a02f9 [MERGE] forward port branch 11.0 up to 36d96e0150 2019-01-29 13:17:12 +01:00
Christophe Simonis 36d96e0150 [MERGE] forward port branch saas-15 up to 788684a5dd 2019-01-29 11:57:06 +01:00
Julien (juc) Castiaux b6f11ace83 [FIX] web: datepicker fallbacks to default english locale
When using the datepicker with norwegian locales, the dates are
correctly formatted using the norwegian locale but the name of
the months are shown in english. This cause a date validation
error and thus it is not possible to change the date.

tempusdominus.js uses moment.js to deal with dates, it sometimes
copies/creates some and set their option according to the ones
given at instantiation time and fallbacks on default options for
that are not set.

opw-1922437

closes odoo/odoo#30276
2019-01-30 08:25:27 +00:00
Christophe Simonis bdfef60d60 [MERGE] forward port branch saas-11.3 up to cd5c8a02f9 2019-01-29 18:35:14 +01:00
Christophe Simonis 788684a5dd [MERGE] forward port branch saas-14 up to aaa2035bcf 2019-01-28 19:45:46 +01:00
Christophe Simonis aaa2035bcf [MERGE] forward port branch 10.0 up to 4a5862a492 2019-01-28 19:45:04 +01:00
Géry Debongnie dc751f20a2 [FIX] web: add exponential backoff strategy for lost connection
Before this commit, the web client had a naive strategy to handle lost
connections: it tried to poll the server every 2 seconds until a rpc
succeeds.

This works quite well from the perspective of the user, but may be a problem
from the perspective of the server.  If a server is down for a longish period,
then each users active tabs will then perform a request every 2 seconds. This
means that the server will be progressively hammered by many requests, which
will clutter the logs, and make it more difficult to gracefully recover.

With this commit, we simply exponentially increase the delay each time, and add
a little jitter to give a better distribution.

Cherry-pick of 4a3f04bcc5

closes odoo/odoo#30136

closes odoo/odoo#30596
2019-01-28 10:55:53 +00:00
Tejas ShahuandMohammed Shekha a63a953a2d [FIX] web: translation issue fixed
Before this commit:
Editing a translatable field -> clicking on a translation
warning ->
come back through breadcrumb do not preserve translation
warning.

After this commit:
Editing a translatable field -> clicking on a translation
warning ->
come back through breadcrumb preserves translation warning.
Technical note: alertFields is now an object and an attribute
of the form renderer
that stores translation alerts per record. The translation
alerts
created for a given record are maintained unless
they are closed manually or the renderer is destroyed.

Issue-ID: 1877480

Co-authored-by: Mohammed Shekha <msh@openerp.com>

closes odoo/odoo#29377
2019-01-24 11:14:55 +00:00
Christophe Simonis fab415acab [MERGE] forward port branch 11.0 up to 984a99611e 2019-01-23 18:15:18 +01:00
Christophe Simonis 51a76880f2 [MERGE] forward port branch saas-15 up to 3cba1862d4 2019-01-23 16:05:02 +01:00
Christophe Simonis 3cba1862d4 [MERGE] forward port branch saas-14 up to 81c9e28eab 2019-01-23 15:23:00 +01:00
Christophe Simonis d870fd555e [MERGE] forward port branch 10.0 up to 90c1af1151 2019-01-23 14:08:50 +01:00
Lucas Perais (lpe) e7bbdf884f [FIX] web: calendar: take locale to format dates
Before this commit, when opening the calendar view with a specific locale
in the "week" view
the days were translated but the date format was wrong and fell back to english
This was because the translated terms were passed explicitly, but the locale did not
get passed

After this commit, we do what it takes to pass the locale to fullcalendar
and the dates are formatted with the right pattern

Also, there may be a bug in fullcalendar, because just passing the locale in the options
won't work, it should be instanciated first in fullcalendar's "locales cache"

OPW 1922092

closes odoo/odoo#30530
2019-01-29 08:52:28 +00:00
Nicolas Lempereur 90c1af1151 [FIX] web: no chrome autocompete on many2one widget
For editing many2one fields (and partially many2many) most widget show
an autocompleting list of targeted records.

They thus have `autocomplete="off"` to prevent browser completion.

But chromium has an history of breaking `autocomplete="off"`, see:

- https://caniuse.com/#search=autocomplete
- https://crbug.com/468153
- https://crbug.com/587466
- https://crbug.com/914451
- https://crbug.com/923895

It seems that since chromium 71, the heuristic to ignore
`autocomplete="off"` has become more aggressive and for example if there
is at least 3 fields like an address in a page, chromium will ignore
`autocomplete="off"` for the fields like an address.

So for example the eidting the many2One field with placeholder "Country"
in a contact page now has a browser autocomplete menu that is:

- hidding the many2one autocomplete
- going to save empty country it appeared visually filled if the
  autocomplete result was selected.

With this changeset, the placeholder in the many2one instance is
interspersed with U+FEFF charcters (ZERO WIDTH NO-BREAK SPACE) so the
browser does enable the autocomplete feature by force.

This should thus remove the issue (until it is fixed by chromium) in the
case of field named "Country" or matching other regexes in this file:

https://github.com/chromium/chromium/blob/cdb1b2073f12/components/autofill/core/common/autofill_regex_constants.cc

U+FEFF has been chosen instead of more recommended characters because
other have been shown erroneous for printing in some windows
configuration (see cb2a3afa7).

10.0 version of #30439
opw-1930588
closes #30439
closes #30449
2019-01-23 01:09:22 +00:00
Nans Lefebvre b7983443b6 [FIX] web: make value_from of Datefield work without calling complete before
Commit 9af941428880af8e1810dfd9feef494d7a745e98
made it so that the value_from function depends on a variable defined after
the function complete has been called, without any guarantee that this function
would be called after. Apparently this is the right OOP thing to do.

opw 1930523

closes odoo/odoo#30712
2019-01-31 07:35:46 +00:00
qsm-odoo caacd95a87 [FIX] web: allow to open community website menu on iOS
Before this commit, the menu to go into the backend from the website was
not possible to open on iOS without opening the right menu first. This
was because position: fixed is not able to counter overflow: hidden in
iOS. This is the fix for stable versions, the proper solution will be
done in master.

Closes https://github.com/odoo/odoo/issues/29390
task-1923151

closes odoo/odoo#30507
2019-01-24 10:55:18 +00:00
Nans Lefebvre e27f0ee7ef [FIX] web: reset the dynamic domain when discarding changes
Create record A on form view, on which a dynamic domain is added by an onchange.
Switch to kanban view. Quick create a record B. Click edit.
This sends you to the complete form view to edit the record.
The dynamic domain of A is still applied.

When discarding the changes, the _domains attribute was not reset.

Example of a model on which this flow can be reproduced is helpdesk.ticket,
with _onchange_partner_project providing the new _domain.

test courtesy of @aab-odoo

opw 1920874

closes odoo/odoo#30308
2019-01-28 14:57:46 +00:00
Christophe Simonis 4aa153e65c [MERGE] forward port branch 11.0 up to 19558129f0 2019-01-17 20:49:36 +01:00
Odoo Translation Bot fe36bff420 [I18N] Update translation terms from Transifex 2019-01-27 01:37:55 +01:00
Christophe Simonis c8ace043e5 [MERGE] forward port branch saas-11.3 up to 387d5cff90
closes odoo/odoo#30566
2019-01-25 17:29:34 +00:00
Lucas Perais (lpe) 187c32c2c7 [FIX] web: pivot correct context after reload
Open a pivot view with default filters automatically activating
Disable those filters

Change the groupBys on the rows and cols of the pivot

Save your result as a favorite filter

Before this commit, the filter did not contain the context information for columns groupby
Also, the search view did not exploit the context of the new filter as it should be

After this commit, the flow works as expected

OPW 1913732

closes odoo/odoo#29415
2019-01-17 12:37:25 +00:00
Christophe Matthieu 586dc9e025 [FIX] web: can reopen ModelField selector widget
Before this fix, in studio when the user select the field then focus out
then focus in and selected a child field, an exception is triggered because
the last page is visible but the data are removed.

backport of 12.0's 9eef25ae0a

opw-1928453
closes #30277
2019-01-16 16:18:59 +00:00
Christophe Simonis 952f784454 [MERGE] forward port branch 11.0 up to 4f2f299534 2019-01-15 17:48:36 +01:00
Aaron Bohy dec9f7c4ce [FIX] web: one2many list: quickly switch between pages
Before this rev., a crash might occur when the user quickly
switched twice between pages (e.g. go to page 2, then page 3) on a
slow network.

In the given example, when data of page 2 returned, the list was
re-rendered. Unfortunately, the offset of that list' datapoint was
already changed due to the switch to page 3, meaning that the view
tried to render a page that wasn't loaded yet, leading to a crash
if there were modifiers to evaluate, or to empty records being
displayed.

This rev. ensures that the view is rendered with the data of the
page it expects.

closes odoo/odoo#30150
2019-01-11 14:36:13 +00:00
Nans Lefebvre a7cbac305e [FIX] web: reset offset in the search more view dialog
Start on the modal obtained by a "search more". The offset is never reset.
So suppose you are on page 2, looking at record 81-160.
Do a research that gives less than 80 records.
The result of the search is nothing, since is has been done with a 80 offset.
It should be reset to 0 when we do a new search.

opw 1920826

closes odoo/odoo#30109
2019-01-11 15:07:40 +00:00
Christophe Simonis b50883d17b [MERGE] forward port branch 11.0 up to c07b7200b2 2019-01-08 11:52:15 +01:00
Nicolas Lempereur 27a084eb81 [FIX] web: attach document fix click on firefox
As of saas-11.3 there is a "Attach document" widget that is meant to
more easily add attachment.

But on firefox the click event is coming from the button, where on other
browsers it was possibly from a child element.

So the code expecting the child element did not work on firefox.

opw-1920842
closes #29903
2019-01-03 17:00:18 +00:00
Odoo Translation Bot d331d28fdf [I18N] Update translation terms from Transifex 2019-01-06 03:24:31 +01:00
Martin Trigaux 838c9e5617 [I18N] export 11.0 source terms
To integrate recent content changes and benefit from cd4080839f and 7f8631a91

closes odoo/odoo#29933
2019-01-04 10:13:05 +00:00
Nicolas Lempereur 3125d20da3 [FIX] web: X2Many read propagates field context
Most operations on X2Many widget possibly propagates a field context
(name_create, name_search, ...) but the original read or read on an
onchange does not.

With this changeset, the field context is also used in these instances.

The assertions added in the added test failed with:
  expected: ["world"], result: [undefined]
  expected: ["world","world"], result: [undefined,undefined]

fixes #29203
opw-1914466
closes #29866
2019-01-04 09:44:49 +00:00
Christophe Simonis e618845112 [FIX] web: adapt forward-ported test 2019-01-02 16:08:25 +01:00
Christophe Simonis 79f1ecd756 [MERGE] forward port branch 11.0 up to d82c0d133e 2019-01-02 15:37:01 +01:00
Nicolas Lempereur ce6e66cef9 [FIX] web: bar chart no crazy with 2 group by
In 3d2ca8104e some change were introduced to the graph view.

But part of it had no sense when displaying data over 2 group by.

eg. if the first level has 2 groups (2018, 2019) and each second level 2
    groups (Done,Cancelled), we could have:
     2018/Done: 0
     2018/Cancelled: 5
     2019/Done: 8
     2019/Cancelled: 9
    this gives us two main groups [2018: 5] / [2019: 17], the code
    remove the 2018 because [2018/Done] is 0 so we have something odd
    with columns not in order, and in stacked bar chart some part of
    a bar at the wrong offset

opw-1932517
closes #30529
2019-01-24 16:18:19 +00:00
Nans Lefebvre d794cd616b [FIX] web: make the fields display without overlap in settings
The display of many fields in the setting overlaps other elements,
e.g. OnSIP WebSocket, Domain and VoIP Environment in General Settings.

We override the flex: 0 0 66,6% set by Bootstrap by flex: 0 0 auto
so that everything automatically looks nice.

closes odoo/odoo#30359
2019-01-21 08:03:04 +00:00
Denis Ledoux 6355126ff1 [FIX] web: oversight during forward-port f854e01a98
pyeval is no longer there in 12.0.

it's pyutils for christ sake @kangol
2019-01-21 18:18:02 +01:00
Odoo Translation Bot 127fdea764 [I18N] Update translation terms from Transifex 2019-01-21 17:38:09 +01:00