Commit Graph
7234 Commits
Author SHA1 Message Date
Christophe Simonis 4c46dd4f9d [MERGE] forward port branch 10.0 up to 2f139632d6 2019-02-27 10:42:03 +01:00
Nicolas Martinelli b431f8eadc [FIX] barcodes, web: float scannable
- Switch to French language
- Go to Inventory > Inventory Adjustment
- Launch an adjustment

The field 'Real Quantity' doesn't follow the float formatting.

This is because the widget is set as `field_float_scannable`, which is
not recognized by the formatting function.

Since the widget descriptor has priority over the type descriptor, we
must explicitly take this widget into account, on top of adding the
`format_value` method.

opw-1940884

closes odoo/odoo#31366
2019-02-22 13:45:30 +00:00
Nicolas Lempereur 8183f92de4 [FIX] web: ie11 autocomplete field no open itself
On IE11, in 10.0 up to master in some instance when creating a record
under some conditions the dropdown may be automatically opened and need
to be closed.

This has been pinpointed to 90c1af1151 so it seem that a combination of
fields/code/autocomplete and changing the placeholder at one time causes
the issue.

Since IE11 lie and say it is mozilla 11.0 we just apply the 90c1af1151
when the browser is chrome (we did no did this at first to have the same
behavior accross browsers).

note: there is an opened bug in chromium https://crbug.com/928305 if
solved the hack could be removed completely.

opw-1940592
closes #31271
2019-02-20 10:39:17 +00: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
Christophe Simonis d870fd555e [MERGE] forward port branch 10.0 up to 90c1af1151 2019-01-23 14:08:50 +01: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
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
Christophe Simonis ef670016e6 [MERGE] forward port branch 10.0 up to b8b33c6363 2018-10-18 14:52:51 +02:00
Aaron Bohy 7063c50924 [FIX] web: FieldMany2one: don't ignore tabindex in readonly
opw 1889710
2018-10-16 10:58:49 +02:00
Christophe Simonis c7de55dc3c [MERGE] forward port branch 10.0 up to 72f76caa39 2018-09-06 15:29:08 +02:00
Nicolas Lempereur 72f76caa39 [FIX] web: relativedelta>11months work as expected
Since march 2015, using in a domain "relativedelta(months=X)" with
X being bigger than 11 or lower than -11 would result in an error.

This is because in the refactoring adding modules (e8a00bc50d) the two
functions divmod and utils.divmod with different implementation in
pyeval.js were replaced by one function divmod in web.utils module.

But there was still an usage of the removed implementation.

opw-1880766
closes #26816
2018-09-06 13:14:42 +02:00
Christophe Simonis ed99894ac6 [MERGE] forward port branch 10.0 up to 13e321325b 2018-07-16 16:25:59 +02:00
len-odoo 02afc0e0aa [FIX] web: groupby product on package types triggers a js error
On a database where many modules are installed (e.g.  runbot all), with
the option "manage available packaging options per products", doing a groupby
"product" on the "package type" list view triggers a js error.
It comes from the fact that the fixed_group variable contains a "length"
attribute; the _().each function uses this to determine (erroneously)
that the object is an array.
It thus uses fixed_group[0] to get an undefined, and then tries to access
a method of undefined.

We replace the each by a simple js loop.

opw 1863576
2018-07-16 08:47:06 +02:00
Christophe Simonis e338542f93 [MERGE] forward port branch 10.0 up to 58c70226b7 2018-06-29 14:32:03 +02:00
Adrien Dieudonne 47de788cbb [FIX] web: amount on bank.statement not displayed in mobile
Before this commit, it was not possible to add an amount to a new
bank statement. The input (.o_form_field_monetary) appeared as disabled.

This bug was due to this commit: @a1224f5ca
This rule should be only applied to .o_form_field_radio.

Closes #18887
Task ID: 35832
2018-06-26 13:35:18 +02:00
Christophe Simonis cabe0951af [MERGE] forward port branch 10.0 up to 9001a75f23 2018-05-18 18:53:56 +02:00
Lucas Perais (lpe) abda3464ed [FIX] web: get_file handles arbitrary AND serialized exceptions
Commit bcd4c90 was intendend to make get_file handle uncaught/unserialized exceptions
in the context of a http request

The drawback is that when get_file received a serialized exception (route: /report/download)
the JS modal was empty in that case

This commit handles both the cases

OPW 1848606
closes #24794
2018-05-18 13:03:31 +02:00
Xavier ALT c22d3f6732 [FIX] web: widget char_domain should pass context to selection dialog
In case we define a field like,

<field name="my_domain" widget="char_domain" context="{'active_test': False}"/>

when selecting records the dialog should display all records (as asked by the
context), but it's not the case.

This commit ensure the field context is passed to the selection dialog.

opw-1831902
2018-05-16 14:18:17 +02:00
Christophe Simonis 1f74b878f4 [MERGE] forward port branch 10.0 up to 0aeb92ccbc 2018-05-07 11:54:15 +02:00
Alexandre KühnandNick Booker c3ce712359 [FIX] web: correctly display filename when uploading a file
Before this commit, we had the following issue with binary widget in a form:

Suppose we have a binary field with filename attribute set. When uploading a
new file 'temp.txt' with content 'Cg==', the displayed value is 'Cg=='. When
the changes are saved, the displayed value becomes 'temp.txt'.

It should always display 'temp.txt', which is what is fixed by this commit.

In addition to fixing this issue, we describe what is the expected displayed
value of a binary field. This is based on whether the attribute filename is
provided, and whether the record is in edit or read-only mode.

Fixes #21630
Closes #24275

Co-authored-by: Nick Booker <nick.booker@opusvl.com>
2018-05-04 17:10:29 +02:00
Christophe Simonis 4e90a676da [MERGE] forward port branch 10.0 up to 4b7f4f32ea 2018-05-04 13:19:12 +02:00
Christophe Simonis 4b7f4f32ea [MERGE] forward port branch 9.0 up to f12daec1a1 2018-05-03 16:25:17 +02:00
Nicolas Lempereur f12daec1a1 [FIX] web: don't change page before saving
When we edit a list view and change page before the change has been
savec, the saving and page changing will be done concurrently thus
possibly causing an error if the page is changed before the saved is
finished: the save will try to modify the page that is no more
displayed.

In this change, the list view editable wait for the saving to be
finished before reloading its content.

note: for 9.0 up to saas-15

opw-1839149
closes #24471
2018-05-03 09:11:44 +02:00
Christophe Simonis 55ce6aff10 [MERGE] forward port branch 10.0 up to 79bbd1dcb8 2018-05-02 13:52:12 +02:00
Nicolas Martinelli bcd4c90a71 [FIX] web: get_file and CPU time exceeded
- Create a binary field which takes some time for computation. For
example:
```
ding_dong = fields.Binary(compute='_compute_ding_dong')

def _compute_ding_dong(self):
    if not self.env.context.get('bin_size'):
        while True:
            3*3
    for x in self:
        x.ding_dong = x.product_id.image_medium
```
- Run the server with a limited CPU time, for example:
  `--workers=2 --limit-time-cpu=10`
- Download the file

A JS traceback occurs, without any information about the real crash.

The error management is simply not working: `JSON.parse` is called on a
string which is not JSON-parseable.

opw-1838832
2018-04-26 15:14:47 +02:00
Christophe Simonis 2bc3fd89f2 [MERGE] forward port branch 10.0 up to 2d12ae3202 2018-04-23 14:39:41 +02:00
Aaron Bohy e43b9ab9c6 [FIX] web: ListView: no infinite loop on empty nameget
Assume a list view with a many2many field, and a record for which
that many2many contains a single value, whose nameget returns the
empty string (which is a falsy value in JS). Before this rev., it
triggered an infinite number of namegets, and the browser crashed.

It was because the cell was re-rendered when the nameget returned,
and in the rendering of the cell, it re-performed a nameget if
the value was falsy.

opw 1838255d
2018-04-23 08:20:23 +02:00
Christophe Simonis 67054b6dcb [MERGE] forward port branch 10.0 up to 2f037a13ca 2018-04-18 12:14:53 +02:00
qsm-odoo 5d13a2f431 [FIX] web: properly right-align numbers in grouped list views' rows
The 'oe_number' class was replaced by 'o_list_number' but this was not
properly done for grouped list views. As a fix, the new class is added
on top of the old one to not break potential customizations.

Proper fix will be done in master.
See https://github.com/odoo/enterprise/commit/a2ce226a2a085b26174cdfd32922517dff39658c

Closes https://github.com/odoo/odoo/pull/23966
2018-04-17 13:37:24 +02:00
Christophe Simonis ff46163bca [MERGE] forward port branch 10.0 up to f4326b4dab 2018-04-05 16:21:23 +02:00
Jeremy Kersten 5ba05f2ba4 [FIX] web, website: fix font path for bootstrap
Before this commit, if you or a lib uses Glyphicons, the font was loaded from
/web/content/fonts/ (or /web/static/src/less/fonts/ in debug=assets)

It is because bootstrap is imported from /web/static/src/less/import_boostrap.less
not directly from /web/static/lib/bootstrap/less/bootstrap.less

Now, we use absolute path to load font, overriding the variable define in
variables.less from bootstrap.
2018-04-04 13:02:21 +02:00
Christophe Simonis f16a6c90d3 [MERGE] forward port branch 10.0 up to 9aa1b7ba12 2018-03-22 11:41:27 +01:00
Goffin Simon dcf77ee9f9 [FIX] web: Modify existing sales order lines
Steps to reproduce:

- Create a sale order and add sale order lines(Not Inline) without saving the sale order.
- Edit any of the existing sale order line and hit on "Save & New" on the sale order line.
- Add another sale order line and hit on "Save & Close"

Bug:

A validation error was raised.

opw:1829723
2018-03-22 10:56:31 +01:00
Christophe Simonis 78dced6bc2 [MERGE] forward port branch 10.0 up to c2b3ad1899 2018-03-21 15:55:26 +01:00
Martin Geubelle 75d9a2b4db [FIX] web: correctly display statusbar
Some status were shown in the statusbar even though they were not specified in
the `statusbar_visible` attribute. This happened when the value was a substring
of one specified value.

Example:
```
hello = fields.Selection([('hello', 'Hello'), ('hello_world', 'Hello World')])
<field name='hello' widget='statusbar' statusbar_visible='hello_world'/>
```
In this case, both status were shown ('hello' is a substring of 'hello_world').

Fixes #20034
2018-03-20 13:49:32 +01:00
Christophe Simonis 82effcca83 [MERGE] forward port branch 10.0 up to caf6b4a7c7 2018-03-19 18:25:41 +01:00
Romain Derie 9f1438d5f1 [IMP] website: Script injected in DOM: window.onerror empty params
Cherry-pick (and improvement) of 4bd8e3e (11.0) which should have landed in 10.0

Closes #21032
2018-03-16 16:12:29 +01:00
Christophe Simonis ac89023155 [MERGE] forward port branch 10.0 up to 5e6bb745e8 2018-03-06 12:28:30 +01:00
Aaron Bohy b466b3bc60 [FIX] web: create favorite filters in dialogs
Consider the following scenario: open in edit mode a form view
containing a many2many field displayed with widget many2many_tags,
on the many2many field dropdown, click on 'Search More' (it opens
a dialog), and in the dialog, try to save the current search in
the searchview's favorite menu.

Before this rev., it tried to retrieve the context of the active
view in the closest instance of a ViewManager-like widget in the
SearchView's ancestors.

First, it is wrong as in the given scenario, the requested context
is actually the one of the list controller in the dialog, not the
one of the form controller in the background.

Second, it produces a crash in Studio, when trying to save filters
in the dialog opened by clicking on 'Search More' on the groups
many2many field in the sidebar.

This part of the code can't be tested in this version, but tests
will be added in master.

Fixes #23293
2018-03-06 09:06:45 +01:00
len-odoo e710e5df7a [FIX] web: show error when trying to export a report with more than 256 columns
If the user tried to generate a report with more than 256 columns,
he would get a traceback instead of an error message.
Furthermore, if only one measure was selected, then the check was not done
and the user would also get a traceback.

opw-1816931
2018-03-05 12:56:27 +01:00
Christophe Simonis eebc7b6e32 [MERGE] forward port branch 10.0 up to 1512618d3e 2018-02-21 12:42:46 +01:00
Christophe Simonis 1512618d3e [MERGE] forward port branch 9.0 up to e544ec8df7 2018-02-21 11:27:22 +01:00
Romain Derie bcc088c348 [FIX] web, web_editor: Better email validation with regex (JS)
This commit improves link creation in web editor.

Before this commit, anything with a @​ would be considered as valid email which
is obviously not the case. It would then be prefixed by 'mailto:'.
This was causing 2 issues:
  - URL with @​ symbol in it would have 'mailto:' added as prefix, like google
    maps coordinates.
    eg: mailto:http://www.google.com/maps/whatever/@​312211.22,321321
  - Incorrect emails would go through (eg: @​@​@​, ko@​k@​k@​, mail@​mail)

Now, we will try to detect and identify valid emails from invalid emails from
URLs. It will also handle 'mailto:' directly typed in the input.

This commit comes with it's counterpart in enterprise https://github.com/odoo/enterprise/pull/1859

This closes #11984, closes #22936

Note that there is a WIP in master to use this new is_email function
everywhere we try to validate emails. It will aim to uniformize email
validation in odoo's javascript that are often performed with different mean
here and there, some more permissive than others, some only checking for @​.
2018-02-20 12:30:13 +01:00
Nicolas Lempereur 5b230c34cb [FIX] web: noshow list view aggregates w/ currency
In df69b5bb the aggregates of a column with currency was shown only if
records were of the same currency when a grouping was closed.

But when the list view is grouped, this would cause a number of issue:

- error if with first grouping is opened, another one is closed
- if the first grouping was closed aggregates were always shown
- the code only acts when closing a grouping
- aggregates could be shown when they should not
- aggregates could be not shown when they should

So this commit change things so this feature is ignored when the list
view is grouped.

There is also a fix so `currency_field` of the column is used instead of
just using `currency_id` that may be wrong.

note: only for saas-14 and saas-15 (feature is not present in saas-16)

opw-810835
closes #22598
2018-01-29 13:37:22 +01:00
Christophe Simonis 6f2d1b8261 [MERGE] forward port branch 10.0 up to 34bfadb2f2 2018-01-24 15:50:56 +01:00
Nicolas Martinelli 34bfadb2f2 [FIX] web: suggested date
- Set the OS to a GMT- timezone (e.g. 'America/Los Angeles')
- Set the format of the date to '%d/%m/%Y'
- Go to 'Account > Adviser > Journal Entries'
- Type '02-01-2018'

The suggested date is 31/01/2018.

Setting the moment object as UTC will lead to a conversion of the date
to the OS timezone when calling `toDate`, e.g.:
Mon Jan 31 2018 16:00:00 GMT-0800 (PST)

UTC should only be used in case of datetime, not date.

opw-803466
2018-01-24 14:11:55 +01:00
Christophe Simonis d35a76ee17 [MERGE] forward port branch 10.0 up to d76237e038 2018-01-12 16:16:51 +01:00
Christophe Simonis d76237e038 [MERGE] forward port branch 9.0 up to 26d3b77a1d 2018-01-12 15:32:15 +01:00
tbe-odoo d5e97eab8b [FIX] web: Kanban image not showing in some languages
- In some languages the kanban images are not displayed because of a bug in human_size method in JS.

This method translates the Unit Size for data and strip with the string with a comma as separator.
When the translatation contains spaces after the commas (like in the French translation), there is extra spaces in the final result.
This then cause an issue with the method is_bin_size that expects a unique space between the value and its unit.
Resulting in a bug in the method 'kanban_image'.

opw #804973 #804970 #804648
2018-01-12 12:05:56 +01:00