Commit Graph
439 Commits
Author SHA1 Message Date
Nicolas Lempereur 97cd3dfdf9 [FIX] web: update moment ar locale for month
The months name in momentjs used an arabic translation with the month
then some crap (or the month said a second time) after.

This does not seem expected, and has been solved in moment.js library 2
years ago:
https://github.com/moment/moment/pull/4271

This PR apply this change in moment.js localization included in Odoo.

opw-2006265
closes #34248

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-06-19 15:00:27 +00:00
Aaron Bohy 3c40d732bf [FIX] web: crash in editable lists with date field
Backport of 7bc53ac30e.

Assume an editable list view with a date(time) widget, click to
edit a line, focus the date field (the datepicker opens), press
ESC: there is a crash in the lib, and the datepicker remains open
forever.

This fix is twofold:
 - we added a check in the lib to prevent it from crashing (it is
 easily reproducible: it crashes when an opened datepicker is
 removed from the DOM).
 - we added an event handler of ESC keydown event to hide the
 datepicker before the field is removed from the DOM.

closes odoo/odoo#32647

Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>
2019-04-23 06:58:16 +00:00
Christophe Simonis bd63913326 [MERGE] forward port branch saas-11.3 up to 4e39328a76 2019-03-18 20:03:24 +01:00
Christophe Simonis 9b6e37a983 [MERGE] forward port branch 11.0 up to 7e33b54771 2019-03-18 16:51:57 +01:00
Christophe Simonis 2940ee6b35 [MERGE] forward port branch saas-15 up to c6353942ff 2019-03-18 14:17:54 +01:00
Christophe Simonis c6353942ff [MERGE] forward port branch saas-14 up to 5162ca7be7 2019-03-18 10:53:01 +01:00
Christophe Simonis 5162ca7be7 [MERGE] forward port branch 10.0 up to 36ba37a7a1 2019-03-18 10:20:06 +01:00
Denis Vermylen 791a38a655 [FIX] web: qweb2: allow null values in a foreach iteration
Before this commit iteration in a t-foreach containing null or
undefined values crashed because they have no attributes.

closes odoo/odoo#31828

Signed-off-by: Fabien Meghazi <amigrave@users.noreply.github.com>
2019-03-12 16:15:39 +00:00
Christophe Simonis aeed32d4ff [MERGE] forward port branch 11.0 up to 1dbe4ea0d7 2019-01-30 17:10:34 +01: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
Mathieu Duckerts-Antoine 84abddfe90 [FIX] web: quotes and backslashes in search view
The commit 6d3ada1
aimed to solve problems occuring whith (single or
double) quotes when creating new custom filters.
Unfortunately, the point was missed and bugs were
still present. The present commit solves the
orginial problem satisfactorily.
There was also a problem in the management of
backslashes. Type '\\' in the search bar would
lead to a domain like
[('...', 'ilike', '\\\\\\\\\\\\\\\\')].
This has also been fixed. Note that it is
necessary to input "\\" if one is looking for a
backslash in db (as before).

A remark on the _formatAST function (py_utils.js):

We deescape only the chars `'`, `"`, and `\`
because it does not seem possible to produce a
string in the search view that would intend a
search for a line return or a tab for example.

A general remark:

Domains should always be in normalized form.
In that way they could be manipulated and combined
together without a tokenization/parsing!

closes odoo/odoo#31025
2019-02-15 12:38:22 +00:00
Lucas Perais (lpe) 7ecd750a77 [FIX] web: moment lib: update es locale
The parsing/formatting of abbreviated month name was broken.
The locale es in its version for moment 2.22.0 fixes it

OPW 1931272

closes odoo/odoo#31104
2019-02-13 13:01:04 +00:00
Christophe Simonis cb8fefa899 [FIX] web: correct tempusdominus lib patching
Oversight of previous forward-port.
2019-01-31 15:22:27 +01:00
Christophe Simonis 49cb3d8fad [MERGE] forward port branch saas-11.3 up to aeed32d4ff 2019-01-31 15:07:09 +01:00
Géry Debongnie 6d3ada178f [FIX] web: prevent crash when searching for escaped strings
Recent works in the search view (in 12.0) on dynamic filters had an
unfortunate effect: when the user tries to input escaped strings (for
example "test" in custom filters, there was a crash.

The reason is that the JS python parser (or more specifically, the
tokenizer) was unable to parse that as a string.  It worked before
because the web client sent the raw string to the server.  However, with
dynamic filters, this is no longer the case, and we need to parse
domains to be able to combine them.

In this commit, we modify the tokenizer to be able to work with escaped
strings.

closes odoo/odoo#29324
2018-12-06 15:16:32 +00:00
Lucas Perais (lpe) 889bdd3569 [FIX] web: fielddate[time] should select their value when entering them
Before this commit, when focusing on a date[time] field, the value was not selected
In v11.0, it was

This is due mostly because of the migration to BootStrap 4

After this commit, the value inside the input is selected

OPW 1911333

closes odoo/odoo#28989
2018-11-26 14:51:09 +00:00
Xavier Morel 8e17223c26 [FIX] web: remove bootstrap sourceMappingURL
We're not shipping the sourcemap files, and while the assets minifier
strips out the mappings they're getting hit in debug=assets which is
bot useless and problematic when running odoo-bin without a proxy for
static folders: if sourcemaps are enabled (which is apparently the
default in all browsers if devtools are opened at this point) the
browser tries to fetch the sourcemap, which does through the
SharedDataMiddleware which doesn't find them and passes the query on
to the regular Application which goes through the entire dispatch &
NotFound process.

If website is installed, that process ends up rendering website.404,
which can be pretty costly until everything is properly cached:

    # initial request
    "GET /web/static/lib/bootstrap/js/index.js.map HTTP/1.1" 404 - 319 0.198 0.954
    # a few requests later
    "GET /web/static/lib/bootstrap/js/index.js.map HTTP/1.1" 404 - 27 0.022 0.060

And the way sourcemaps are fetched (might be headers, might be the
stampede as browsers will try to fetch a dozen sourcemaps as fast as
possible) seems to make this problem much, much worse: instead of 300+
the requests take 800+ queries each, multiple seconds, and requests
get worse as time goes on (didn't investigate the exact reason for
that) *and* they apparently don't ever get cached (at least they don't
after half a dozen reloads of the client).
2018-09-17 10:44:58 +02:00
Christophe Simonis 68d36512ef [MERGE] forward port branch saas-11.4 up to d78f23df84 2018-09-07 20:20:45 +02:00
Christophe Matthieu 8f7fdb0d99 [FIX] web: fix JavaScript qweb and activate tests
Fix the issue of the t-esc display the content before the tag.
Activate qweb qunit test (same test for the JavaScript and python)
Use the same behavior as python: keep attributes order, and display content
as default value when the variable is falsy.
2018-08-13 17:09:28 +02:00
Adrian Torres a1bad2191c [IMP] pyjs: add date/datetime utilities
Introduce utilities to calculate the start / end of a period given a date or datetime object in the JS python interpreter.

This commit is the JS implementation of commit 960360afe4
2018-08-09 15:00:37 +02:00
David Beguin 902e484f14 [FIX] ClipboardJS update for Bootstrap Modals focus issue in Chrome
Since Bootstrap 4, ClipboardJS does not copy the value in the clipboard anymore
as Bootstraps modals give the focus to another element. As the focus need to be
given back to the correct element, ClipboardJS has to be updated as the
container parameter is only added in v1.7. We were in 1.5.
That container parameter allow to give the focus back to the correct element.
See doc on https://clipboardjs.com/
+ Issue : https://github.com/zenorocha/clipboard.js/issues/155
2018-08-06 11:34:51 +02:00
qsm-odoo 43d2db9439 [FIX] web: restore datepicker lib patches
Patches were introduced by Odoo in the lib and have been removed
while updating it to "tempus dominus". This commit restores them.

See:
- https://github.com/odoo/odoo/commit/3741603495532e218b66f3cfa0272e4536f1cf2c
- https://github.com/odoo/odoo/commit/ab42507d460125c5ee81bb6b4b859146494339ac
2018-07-27 12:36:54 +02:00
qsm-odoo 6692919d1e [REF] web, *: update bootstrap-datetimepicker to tempusdominus
* website_form, debian

Our old library for datetimepicker for bootstrap 3 is deprecated and
an updated version is developed by the same team under the new name
"tempusdominus", for bootstrap 4.

The lib is imported by taking the *unminified build* JS and the *src*
scss. Odoo is also bundling the lib better by putting the scss file
in both backend and frontend assets instead of only in common (so that
the scss is compiled differently for the frontend and the backend).

Note: the lib also needed to be patched inline to solve a bug at one
line.
2018-07-27 12:36:54 +02:00
qsm-odoo a991a579bc [REF] web: add the 'popper' library
Since bootstrap 4.0.0, the 'popper' library is a dependency.
2018-07-27 12:36:54 +02:00
qsm-odoo 9d90c7ea7b [IMP] base, web: update bootstrap 3.3.7 to 4.1.3
Simply updating the lib, the assets bundle content and the assets bundle
compiler.
2018-07-27 12:36:54 +02:00
Mathieu Duckerts-Antoine 097464de6f [IMP] web: easy selection of a period in filters menu
This commit allow to create easily a range of periods (related to a field
of date or datetime type) to select in the filters menu.

Two new attributes on elements with tag 'filter' are now usable
in combination in a search view arch:

- date: string.

		A valid field name with associated type date or datetime

- default_period: string (optional).

		To choose in the following list:
			- 'today'
			- 'this_week'
			- 'this_month' (default)
			- 'this_quarter'
			- 'this_year'
			- 'yesterday'
			- 'last_week'
			- 'last_month'
			- 'last_quarter'
			- 'last_year'
			- 'last_7_days'
			- 'last_30_days'
			- 'last_365_days'

Example:

<filter string="Creation Date" name="period_generator" date="create_date" default_period="this_quarter"/>

Note: the attribute 'domain' can not be used for such filters.
The generated domains are dynamic and can be saved as such
via the favorites menu.
2018-07-06 14:09:09 +02:00
Géry Debongnie dcc4d71623 [REF] web: move some code from pyeval to lib py_extras
Some functions that were in web.pyeval were actually "odoo independant".
To make them easier to manage/understand, this commit move them in the
library py.js, as an extra file.
2018-07-06 14:09:09 +02:00
Mathieu Duckerts-Antoine 64f3580af7 [IMP] web: add support of modulo in pyeval 2018-07-06 14:09:09 +02:00
kujiu f90cf060a3 [FIX] Syntax of icons (#25577)
Description of the issue/feature this PR addresses:

Accessibility improvements forbids the use of the syntax
`<i class="fa fa-check"/> Some text`
to create a labelled icon. But, by this, some fonts are changed.

Desired behavior after PR is merged:
The old syntax can be used.
2018-07-04 09:55:52 +02:00
kujiu 9de1bc0eef [IMP] Improve compatibility with screen readers (accessibility) (#24574)
Today, Odoo is really tricky to use without seeing the screen, it must be improved to be usable.

This PR forbid to use labels without a "for" attribute, add some title, rule and aria attributes in HTML. With that, Odoo will be fully usable with a screen reader.


* [IMP] Labels must have a for attribute. Improve accessibility.
* [IMP] Better error message when trying to read a missing cached value
* [FIX] Add some aria-label and title attributes for screen readers.
* [FIX] Template name is not included in the error message in case of SyntaxError in QWeb
* [FIX] Improve the Tour failed at step error message to be more explicit.
* [IMP] Add aria-labels
* [FIX] Add missing aria-label on failing test
* [IMP] aria-hidden means hidden. Fix all bad aria-hidden and hide aria-hidden for all.
* [IMP] Color names on kanban views and many2many tags
* [IMP] Add some checks on views for accessibility.
* [IMP] Add `alt` attribute on `img` tags.
* [IMP] Add aria-label and title on non-described icons
* [IMP] Add button role to widgets with btn class
* [IMP] Translate aria and formatted attributes.
* [IMP] Remove wrong aria-labelledby
* [IMP] Add menu role on dropdowns
* [IMP] Buttons must be focusable
* [IMP] Add aria attributes on progress bars
* [IMP] Improve accessibility of basic widgets
* [IMP] Change main layout to more semantic tags
* [IMP] Add menuitem role when missing
* [IMP] Remove wrong role='presentation'
* [IMP] Improve accessibility of tab panels
* [IMP] Add aria-invalid on invalid fields
* [IMP] Add aria-sort on ordered columns
* [IMP] Add role on alerts
* [IMP] Use dialog role, header, main and footer tags for modals
* [IMP] Add labels on o_status
* [IMP] Improve accessibility of kanban view with feeds and articles
* [IMP] Add alerts in case of new messages
* [IMP] Add widget, navigation or img role to aria-labelled items
2018-06-22 21:22:21 +02:00
Christophe Simonis 73652a0b19 [MERGE] forward port branch saas-11.3 up to 50860317cc
Note: 1aacc96262 has been ignored and will
be forward-ported later
2018-06-15 13:27:27 +02:00
Christophe Simonis 50860317cc [MERGE] forward port branch saas-11.2 up to b170a753e1 2018-06-15 11:30:27 +02:00
Christophe Simonis b170a753e1 [MERGE] forward port branch 11.0 up to b05e4d5f95 2018-06-15 10:15:27 +02:00
Christophe Simonis d45c32baac [MERGE] forward port branch saas-15 up to bdd051bf78 2018-06-13 18:13:48 +02:00
Christophe Simonis bdd051bf78 [MERGE] forward port branch saas-14 up to c43c540172 2018-06-13 14:12:12 +02:00
Christophe Simonis c43c540172 [MERGE] forward port branch 10.0 up to 788750ea51 2018-06-13 10:55:58 +02:00
Jeremy Kersten 51acdeba4f [ADD] qweb: add tests for widget=date with datetime
This commit is related to #24761
2018-06-12 15:48:21 +02:00
qsm-odoo e5b268827f [REF] web, web_editor, website: convert LESS editor to SCSS editor 2018-04-18 15:59:25 +02:00
qsm-odoo a13ba24b3a [REF] web: change bootstrap datetimepicker source from less to scss
Note: the scss version of the lib file was not up to date, I manually
updated it to our current version (very small changes). The lib will
probably have to be changed with bootstrap 4 anyway.

Note 2: the file is left included in the common assets but it would
probably make more sense to put it both in backend and frontend instead.
2018-04-18 15:59:10 +02:00
qsm-odoo 6096f24501 [REF] web: change bootstrap source from less to scss
Note: bootstrap 3.3.7 in SCSS produces slightly different CSS
of bootstrap 3.3.7 in LESS... the DOM result should be the same
though.
2018-04-18 15:59:09 +02:00
Christophe Simonis 412501a5dc [MERGE] forward port branch 10.0 up to 7147622665 2018-04-16 11:18:08 +02:00
Nicolas Lempereur 7a1db7e620 [FIX] web: wrong day column title in arabic
In arabic, with the version localization of bootstrap we use the week
starts on saturday. But the version of bootstrap-datetimepicker we use
in 10.0 and saas-14 is 3.0.3 which only fully supports week starting
on sunday and monday.

Thus in arabic, the column title in the date picker would be:

  Sunday <- Monday (ﻥ, ﺙ, ﺭ, ﺥ, ﺝ, ﺱ, ﺡ)

Instead of what the numbered days in the calendar are shown as:
  Friday <- Saturday (ﺱ, ﺡ, ﻥ, ﺙ, ﺭ, ﺥ, ﺝ)

This issue doesn't happen in saas-15, 11.0 and over since the library
has been updated with ad6fd5f8 and the as of version 4 supports any
starting day of week, with this change:
 https://github.com/Eonasdan/bootstrap-datetimepicker/commit/557b657

opw-1825640
closes #24200
2018-04-13 09:33:24 +02:00
Christophe Simonis b51f2d38c2 [MERGE] forward port branch saas-11.2 up to 500e3f4970 2018-03-21 11:04:48 +01:00
Christophe Simonis e0345a4a3f [MERGE] forward port branch 11.0 up to 2835d29979 2018-03-20 11:45:11 +01:00
Christophe Matthieu ec199222c3 [FIX] web: ace: no duplicated char with composition (html/css editor)
Before this commit, there was an issue with input method using
composition in which typed characters were duplicated.
This was occuring until the composition ended.

This is a bug specific to Google Chrome v53+.
It has been fixed in the most recent version of ace.js [1],
and we just port the fix into our custom code.

Note that we do not simply import ace.js as a whole, because
we must update lots of custom code at the same time.
We plan to do so in the future.

Fixes #23629

[1] https://github.com/ajaxorg/ace/pull/3116
2018-03-20 09:44:10 +01:00
Géry Debongnie 64d47c0bc5 [IMP] update ace editor to v1.3.1
Note that we do not do a custom build anymore, since we lazyload the
files anyway.  A custom build will save a few kb, but will not do any
meaningful change to the user experience.  However, it dies impact
negatively our ease of maintenance, so standard build it is.
2018-03-14 09:02:16 +01:00
Christophe Simonis 4aa5ec3fa5 [MERGE] forward port branch 11.0 up to d67b410dfc 2018-03-07 18:46:38 +01:00
Adrien Dieudonne 599f6a762e [FIX] web: qweb: load template with non-http xhr
Since we are able to lazy load Qweb templates, there was
an issue to generate Awesome Timesheet iOS native app with
Cordova properly. It seems that under Cordova, iOS always
returns 0 for the status on a xml http request object.

The problem is that native applications are requesting
a local file from something that isn't a webserver.

The local file is delivered with no http headers that means no
"200 OK" header and no "404 Not Found" errors.

In this case, the request is still be completing as intended even
if the status code used by browsers is 0.

For more info, see:
https://developer.mozilla.org/fr/docs/Web/API/XMLHttpRequest
https://bugzilla.mozilla.org/show_bug.cgi?id=331610
2018-03-05 14:06:23 +01:00
Alexandre Kühn 7113e27cb6 [FIX] web: update to qunit from 2.2.1 to 2.3.0
In particular, qunit 2.3.0 solves this issue: https://github.com/qunitjs/qunit/issues/1119

A consequence of the above issue is that some tests could have completed successfully,
although an error was raised.
2018-02-22 14:23:03 +01:00
qsm-odoo 126850e9bd [IMP] web: update bootstrap to 3.3.7
Before this commit the bootstrap version we used was inconsistent.
Indeed, the javascript files were the 3.3.4 ones and the less files
were the 3.3.5 ones. This was due to a failed merged resolution in 9.0.
This should however not cause any issue as the difference between
3.3.x versions are very minor.

Basically, this commit is more of a fix than an improvement and may
even be backported if we find reasons to do so. This commit is mainly
made to prepare the transition to version 4.0.0, which requires to
switch our LESS files to SCSS first (and it will be easier to go by
bootstrap 3.3.7 with SCSS files first).
2018-02-01 11:03:05 +01:00