Commit Graph
10409 Commits
Author SHA1 Message Date
Thibault Delavallée 163725e3c6 [FIX] base, web: update comments to moved files from base 2017-11-29 10:19:07 +01:00
Christophe Simonis 2b957f8d01 [FIX] web: correct test 2017-11-28 18:58:09 +01:00
Christophe Simonis 29590a61cd [MERGE] forward port branch 11.0 up to 8fb25e185b 2017-11-28 16:57:58 +01:00
Christophe Simonis 5851a69aa3 [MERGE] forward port branch saas-16 up to 3f66814a0d 2017-11-28 15:12:31 +01:00
qsm-odoo 41d2470093 [FIX] mail: properly suggest users to chat with
Before this commit, it was not possible to choose the user you want to
chat with in a chat window anymore. This was because the dropdown that
suggest the users appeared under the chat windows since commit
https://github.com/odoo/odoo/commit/7b965a9673a9124e6e045b8a290a156eed402ad5

Indeed, the mentioned commit changed the z-indexes so that chat windows
are still usable when a modal is opened. This was done by making the
chat windows always have the greatest z-index... forgetting this would
make them appear on top of their own autocomplete dropdowns.

This commit restores the feature while keeping the ability to talk while
a modal is opened. See code comments for details.

opw-785162
2017-11-28 14:28:40 +01:00
Adrien Dieudonne d2e1a1deb3 [FIX] web: search_filters: need to convert datetime to utc
When a datetime was selected in a search filter, the time wasn't
converted to UTC to the server.
So, there were unexpecting records due to the wrong query domain.

When we retrieve the value from the datepicker, we need to convert
it to UTC before sending it to the server.
2017-11-27 15:19:54 +01:00
Martin Geubelle cc031bd226 [FIX] web: Form: handle attributes and modifiers on header
This is done for all other tags (except <form> and <sheet>) but this one has been
forgotten.

Closes #21258
2017-11-27 14:01:50 +01:00
Martin Geubelle 76ba56e60d [FIX] web: List: handle custom class on button
It should be possible to set a custom class on a button in the list view.

Closes #20620
2017-11-27 14:01:50 +01:00
Xavier Morel b46830858f [FIX] web: excel export of binary fields
* In Python 3 xlwt apparently does not support writing bytes values ->
  try to decode assuming the value may be base64-encoded, this is more
  or less the behaviour for CSV exports.

  This will most likely not allow the export anyway as Excel cells are
  limited to 32k data characters, which accounting for base64
  expansion means ~24k worth of data, but that is a pre-existing
  issue.
* Also removed support for way outdated browsers from
  content_disposition: the Safari case is for Safari 5 (circa 2012)
  but versioning apparently changed since then and modern Safari
  report their "external" version number rather than the webkit
  version number => the current Safari reports version 11, and gets
  routed to the "does not support unicode file names", which is
  further bugged in Python 3 as it %s's bytes, leading to a resulting
  filename of e.g. `b'res.partner.csv'.csv` (with the prefix and
  quotes).
* The IE case is for IE8, which has long been unsupported by the web
  client.
2017-11-27 11:11:48 +01:00
Odoo Translation Bot 31e574b153 [I18N] Update translation terms from Transifex 2017-11-26 04:25:05 +01:00
Géry Debongnie d6ff8c8351 [FIX] web: better support for async field widgets
Most field widgets are synchronous, but some of them have to do extra
work before being ready (for example, the pad widget, or widget which
needs to lazy load JS/CSS files).  Because of that, the new views have
been well tested with synchronous widgets, but not completely with async
widgets.

Some code depended upon the fact that the widget was ready immediately
after being created.  This was incorrect, and is fixed in this commit,
by adding a new hook that is called in (basic) views after a widget is
ready (meaning, start and willstart are done)
2017-11-24 14:59:14 +01:00
Géry Debongnie cc560531b9 [FIX] web: better support for async field widgets
Most field widgets are synchronous, but some of them have to do extra
work before being ready (for example, the pad widget, or widget which
needs to lazy load JS/CSS files).  Because of that, the new views have
been well tested with synchronous widgets, but not completely with async
widgets.

Some code depended upon the fact that the widget was ready immediately
after being created.  This was incorrect, and is fixed in this commit,
by adding a new hook that is called in (basic) views after a widget is
ready (meaning, start and willstart are done)
2017-11-24 14:55:53 +01:00
Nicolas Martinelli e703d07e68 [FIX] web: read_group RPC
Example of failing request:
```
rpc.query({
    model: 'link.tracker.click',
    method: 'read_group',
    args: [[links_domain, ['create_date', '>', interval]], ['country_id']],
    kwargs: {groupby:'country_id'},
});
```

The RPC request built contains the following:
```
args: [[["link_id", "=", 1]], ["create_date"]]
kwargs: {groupby: "create_date:day", domain: [], fields: []}
```

This will be interpreted server side as:
```
model.read_group([['link_id', '=', 1]], ['create_date'], groupby=['create_date:day'], domain=[], fields=[])
```

2 arguments match `domain` and `fields`, which causes a crash.

opw-781300
2017-11-24 14:16:13 +01:00
Alexandre Kühn fb6c9c2443 [IMP] web: FieldChar trim its value by default
With this commit, we change the behaviour of the web client with respect
to spaces in char fields.  Most of the time, starting and ending spaces
have no value, and worse, make the data not so reliable.

After this commit, field char will trim by default (so, if the user input a
char as ' abc ', the string 'abc' will be sent to the server instead).
Note that this only applies when the value of the field is changed.  If
someone open a form view, then switches to edit mode and save, nothing
will change.

This is the desired behavior most of the time.  However, in some rare
cases, this is actually harmful.  For example, if we trim the
'decimal_point' field, it will not be possible to enter a whitespace as
decimal separator.  In those cases, we introduce a new attribute 'trim',
which allow the developer to desactivate that feature.
2017-11-24 13:09:10 +01:00
Lucas Perais (lpe) 16f7a15325 [FIX] web: on_open_record stop propagation
on pricelist, open a pricelist form
click on one country group [country group form opens]
click on a pricelist again

Before this commit, a traceback appeared, saying the pricelist record was null
YET the pricelist's form on which we clicked before opened.

After this commit, the form of the pricelist opens, and no traceback is thrown.

OPW 783896

[FIX] web: test circular many2many

closes #21148
2017-11-23 14:48:45 +01:00
Aaron Bohy 463a214699 [REF] web,*: give evaluated contexts to load_views
*board,sale_timesheet

This rev. changes the API of load_views, as it now assumes that
the given context has no longer to be evaluated. This is more
convenient that way, as we can now call load_views with contexts
that are dict, and not instances of the Context class.
2017-11-23 11:00:55 +01:00
Aaron Bohy baae272ffd [REF] web: tests: make load_views RPCs go through mockRPC
This allows to inspect those RPCs and the given arguments as well.
2017-11-23 11:00:53 +01:00
Aaron Bohy b4609e3c25 [REF] web: test_utils: handle logging in mockEnvironment
instead of createView. This allows to log info like RPCs or
uncaught Odoo events even if we are not in a view.

Also remove the logLevel param from MockServer as it wasn't really
used.
2017-11-23 11:00:21 +01:00
Aaron Bohy 0670a635ac [REF] base,web: use correct Widget in settings JS tests
... instead of hacking test_utils.
2017-11-23 11:00:21 +01:00
Martin Geubelle aad9a1593f [FIX] web: correctly display modifiers in tooltip
Since odoo/odoo@da136d8 the modifiers in the widget attrs are parsed.
`stringify` thus needs be to used when displaying them in the debug tooltip (to
avoid to display [Object object]).
2017-11-22 16:47:29 +01:00
Alexandre Kühn 732f176fe1 [FIX] web: readonly monetary field onchange currency
Before this fix:
    A readonly monetary field was not updating
    its currency symbol when selecting another currency.

Scenario:
    1. Activate multi-currency with $ (default) and €
    2. In hr_expense, go to My Expenses to Submit
    3. Create a new expense
    4. Select 'EUR' as currency
        => Unit Price is correctly updated with €, but not Total.

With this fix:
    Total displays the correct currency in edit mode.

Explanation:
    Monetary fields in readonly are relying on _formatValue() to
    display their value.
    _formatValue() uses this.formatOptions.currency, which stores
    the currency at loading of the field. We must update its value
    whenever there is a change of currency.

opw-783378
2017-11-22 14:16:00 +01:00
Martin Geubelle 10175daeaf [FIX] web: add tooltips for buttons
The rev. odoo/odoo@952c17b added tooltips for buttons but only header buttons.
These tooltips can also be present on other buttons.

Closes #18790
2017-11-22 12:01:14 +01:00
Lucas Perais (lpe) 5c9f4fd67d [FIX] web: fieldDependency should be in fields too
Commit f45edfbe6d fixed a bug on image fields
but was a partial fix.

The problem is that while adding field dependencies to fieldsInfo,
it did not add them in the fields of the view, making the view crash.

After this commit, views and subviews contain fieldDependency as both info and actual fields of the view

OPW 780021, 781620, 779649

[FIX] web: tests on many2many subviews

closes #20891
2017-11-21 13:31:56 +01:00
Christophe Simonis 7a976df0ec [IMP] web: also check for presence of QUnit.only in mobile suite 2017-11-20 16:46:27 +01:00
Géry Debongnie fd7b767637 [FIX] web: empty field char should be set to false
With the new views, empty char fields were sent to the server as ''
(empty string) instead of false.  This is not the correct behaviour, and
actually cause some problems.  For example, if you have a char field
with a unicity constraint, then you cannot set it to '', since there is
only one record that can take that value.
2017-11-20 16:29:11 +01:00
Martin Geubelle a96c07a765 [FIX] web: make broken test in firefox pass
The attribute `autocomplete` is set with the jQuery function `attr` but
the test was using the function `prop`.

This seems to work in Chrome but apparently not in Firefox.
2017-11-20 11:53:30 +01:00
Géry Debongnie 6cd17d575c [FIX] web: properly refetch x2manys in some cases
Consider the following situation: a form view with a one2many which
contains sub x2many fields (for example a m2m_tags). Suppose that the
one2many has more than 40 records.  Before this commit, trying to delete
one of these records caused a crash.

The reason is that when we delete a record, we need to reload the
missing records in the one2many field.  We actually do that with a
_readUngroupedList.  However, the _readUngroupedList method did not
process x2many fields, so the information stored in the datapoints was
'raw', and the rest of the web client expected it to be a datapoint.

To reproduce the issue in the testing environment, i had to use
onchanges and a readonly attrs, to reach a situation where a crash could
occur.  This shows that, while the issue is critical, it was not totally
trivial to be impacted by it.
2017-11-20 11:05:46 +01:00
Géry Debongnie 5d1640edff [FIX] web: add support for limit attr in arch in sub tree view
Before this commit, the 'limit' attribtue worked properly for list views
(but was not documented), and was ignored for inline tree views.  There
was no good reason for that limitation, so we fix this issue.
2017-11-20 11:05:41 +01:00
Alexandre Kühn 23e6dd36d7 [IMP] web: hide in kanban tag's color (#20815)
New feature:

   - New Transparent tag visual (grey border & text, white bg),
   - By default, newly created kanban tags are transparent,
   - Tag's colorpicker has now a 'Hide in Kanban' checkbox,
     to select the transparent color.

Toggling off 'Hide in Kanban' sets the color of the tag as follow:

   - Previous color, if 'Hide in Kanban' was toggled on on the
     same formview session.
   - Color 1 (dark orange), otherwise.
2017-11-20 10:47:43 +01:00
Odoo Translation Bot 08bdd06542 [I18N] Update translation terms from Transifex 2017-11-19 04:26:17 +01:00
Martin Geubelle 5ba6d93810 [FIX] web: Kanban: prevent drag&drop for readonly
If the kanban view is grouped by a readonly field, it should not be possible
to drag&drop the record from one column to another as this will trigger a
write on this readonly field.

It should however be possible to resequence records so the option `containment`
is used in the records.

Closes #19390
2017-11-17 16:21:01 +01:00
Christophe Simonis 21dd24c071 [MERGE] forward port branch 11.0 up to ca3390fd05 2017-11-17 14:22:46 +01:00
Alexandre Kühn 11ff01af9b [FIX] web: delete attribute on list view
Before this fix, when adding the attribute delete=0
on a listview, it was still possible to delete records
via the menu 'Delete' in the sidebar.

After this fix, this should not be possible to delete
records when delete=0.

The attribute delete was hard-coded to true, as there was
a traceback when it was set to false. It was simply due
to a misplaced closing brackets that was hiding an
assignment, which resulted to calling a method on undefined.
2017-11-17 12:34:25 +01:00
Alexandre Kühn 056fe805a1 [FIX] web: delete attribute on list view
Before this fix, when adding the attribute delete=0
on a listview, it was still possible to delete records
via the menu 'Delete' in the sidebar.

After this fix, this should not be possible to delete
records when delete=0.

The attribute delete was hard-coded to true, as there was
a traceback when it was set to false. It was simply due
to a misplaced closing brackets that was hiding an
assignment, which resulted to calling a method on undefined.
2017-11-17 12:16:59 +01:00
fwi-odoo 9cbf0c87e2 [FIX] web: allow to reexecute functions using _.throttle in the js tests
Before this commit, it was not possible to reexecute functions using the
_.throttle function in the same test (e.g. drag and drop two elements in the
studio tests).
2017-11-17 10:52:11 +01:00
Christophe Simonis c703a2a0c3 [MERGE] forward port branch 11.0 up to d279a3e6d5 2017-11-16 17:55:37 +01:00
Christophe Simonis a094f6318b [MERGE] forward port branch saas-16 up to 745d00362a 2017-11-16 12:40:36 +01:00
Géry Debongnie 672b403d05 [FIX] web: make sure modifiers works for async widgets
Before this commit, asynchronous field widgets (with willStart async),
with a non empty template had a problem: the invisible modifier was not
applied properly.

The reason is that the code that applied the modifiers was called
directly after the widget was 'willStarted'. This means that if this is
async, and if there is a template, the $el in willStart will be replaced
by another $el after, which will remove the invisible modifier.

This was an interesting problem with the pad widget (it is asynchronous
the first time a pad widget is instantiated)
2017-11-16 12:20:30 +01:00
Géry Debongnie 745d00362a [FIX] web: make sure modifiers works for async widgets
Before this commit, asynchronous field widgets (with willStart async),
with a non empty template had a problem: the invisible modifier was not
applied properly.

The reason is that the code that applied the modifiers was called
directly after the widget was 'willStarted'. This means that if this is
async, and if there is a template, the $el in willStart will be replaced
by another $el after, which will remove the invisible modifier.

This was an interesting problem with the pad widget (it is asynchronous
the first time a pad widget is instantiated)
2017-11-16 12:19:15 +01:00
Christophe Simonis 5877b7b38c [MERGE] forward port branch saas-15 up to 73e4dacf78 2017-11-15 15:50:36 +01:00
Christophe Simonis 73e4dacf78 [MERGE] forward port branch saas-14 up to 0bf7ab4511 2017-11-15 15:20:52 +01:00
Christophe Simonis 0bf7ab4511 [MERGE] forward port branch 10.0 up to 0fe7989e24 2017-11-15 14:50:46 +01:00
Géry Debongnie 6158c5ce04 [FIX] web: fix issue with combination of o2m, m2m, and m2o
Consider this: a form view with a one2many list view. In the one2many
list view, there is a many2one field.  When opening the manyone in a
modal form view, there is a many2many field.  In that situation,
clicking on 'Add a new record' on the many2many field had the
unfortunate effect of interfering with the one2many field in the main
form view, which caused a crash or the modal form view to close
unexpectedly.

The issue is that an event was simply not properly stopped at the proper
location.  This is usually not a big deal, but, as described above, it can be
a problem in some cases.
2017-11-15 13:48:49 +01:00
Naglis Jonaitis b52244e15b [FIX] web: removes duplicate id attribute inside DB manager template
Closes #20855
2017-11-14 15:25:15 +01:00
fwi-odoo 466ca1e07e [FIX] web: handle SessionExpiredException in the crash_manager 2017-11-14 12:14:57 +01:00
Christophe Simonis 0d0dd0c866 [MERGE] forward port branch 10.0 up to a8b72d764e 2017-11-14 11:27:04 +01:00
Christophe Simonis a8b72d764e [MERGE] forward port branch 9.0 up to d07f9c5ef5 2017-11-14 11:26:02 +01:00
Aaron Bohy 6d616c566f [FIX] web: search view: autocomplete on datetime fields
... gives wrong values due to the timezone.

For instance, let's assume that the browser timezone of the user
is UTC+2, and the user types 10/09/2017 10:00:00 in a searchview
with a datetime field in its arch (i.e. which autocompletes on a
datatime field). Before this rev., the suggested value was
10/09/2017 12:00:00, i.e. the timezone offset was added to the
value.

opw 779832
2017-11-13 15:12:18 +01:00
Aaron Bohy 9bea735145 [FIX] web: search view: autocomplete on datetime fields
... gives wrong values due to the timezone.

For instance, let's assume that the browser timezone of the user
is UTC+2, and the user types 10/09/2017 10:00:00 in a searchview
with a datetime field in its arch (i.e. which autocompletes on a
datatime field). Before this rev., the suggested value was
10/09/2017 08:00:00, i.e. the timezone offset was substracted from
the value.
2017-11-13 14:07:40 +01:00
Géry Debongnie 75b0393454 [FIX] web: remove slow css rule
We do not take CSS seriously enough, but it has an impact on rendering
speed.  The rule removed in this commit slowed down the Qunit JS test
suite by a considerable amount:

With a fresh db with no extra addon installed, community version:

- in chrome, before this commit: 103.2s, with this commit: 54.8s
- in firefox, before this commit: 194.9s, with this commit: 117.7s

This is due to the way rendering is done in web browser.  They start
checking css rules from the right, so the *:nth-last-child(2) rule was
checked for every element in the dom, each time it was added/modified.
Note that the rule just above (*:first-child) had no noticeable impact,
but I still think that the universal css selector should still be
avoided in general.

The fun part is that I did not find the place where this rule was
supposed to be applied.  I assume that it is just a dead rule.  If this
is not the case, we can reintroduce the margin-top with the class mt0,
applied on the specific element.
2017-11-13 11:59:23 +01:00