Before this commit iteration in a t-foreach containing null or
undefined values crashed because they have no attributes.
closesodoo/odoo#31828
Signed-off-by: Fabien Meghazi <amigrave@users.noreply.github.com>
After the update of jQuery, crashes were no longer displayed (in
dialogs) on browsers using the unhandled-rejection-polyfill lib
(e.g. firefox). This was due to a bad conversion from ES6 to ES5.
Issue reported on the jquery update pad.
closesodoo/odoo#31767
Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
We had to manually convert the unhandled-rejection-polyfill lib,
and we forgot to replace this by self in two arrow functions.
This was causing crashes e.g. on Firefox.
We also forgot some uses of const, which is not really an issue as
const is supported on all browsers, but it is not ES5.
Issue reported on the jquery update pad.
closesodoo/odoo#31658
Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
The commit 6d3ada178f
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!
closesodoo/odoo#29756
See https://blog.getbootstrap.com/2019/02/11/bootstrap-4-3-0/
and https://blog.getbootstrap.com/2019/02/13/bootstrap-4-3-1-and-3-4-1/
Again, some fixes were added in this version and not in a 4.2.x version
so there is no clean way to backport them in 12.0 / saas-12.2.
If needed, the file bootstrap_review.scss is there for that.
Among the new features, two notable ones:
- The '.modal-dialog-scrollable' class which does what odoo already
implemented for all its modals. So we could remove our custom code in
a next update.
- Responsive font sizes ! Plan was to develop something similar for the
website, so this comes at the right time. The behavior is opt-in, we
will enable it in a next update.
Part of https://github.com/odoo/odoo/pull/31401
task-1944790
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!
closesodoo/odoo#31025
Only the syntax
<t t-operation="attributes">
<attribute name="foo">bar</attribute>
</t>
was currently supported for attributes while the syntax
<t t-operation="attributes">
<attribute name="foo" value="bar" />
</t>
Is also correct and supported server side.
Using value instead of the node content is needed to avoid translating the node
while it is parsed by babel to extract translatable content
- 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
closesodoo/odoo#30538
This rev. moves the backbone library from web to pos, as one of its
two usecases (the search view) has just been removed. From now on,
it is only used in the pos.
Part of task 1893568
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.
closesodoo/odoo#29324
The library es5 shim was usefull for older browsers that do not implement
completely the es5 specifications, like IE9.
As we do not support browsers older than IE11, that fully supports all
the features of es5, the library has become useless.
Removing this library will remove a little bit of noise in the callstack
when debugging.
closesodoo/odoo#27877
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
closesodoo/odoo#28989
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).
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.
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
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