Commit Graph
8571 Commits
Author SHA1 Message Date
Aaron Bohy 16c90138bd [FIX] web: handle onchange on nested one2manys
Suppose that we have a form view with a one2many field o2m_1,
displayed as a list. The model of o2m_1 contains a one2many field
o2m_2 which isn't displayed in the list view, but which is in the
form view. If an onchange sets the value of o2m_1, e.g. with a
command 0 to create a new record, and that the value of o2m_2 for
this new record is set (e.g. with a command 0 as well), it crashed.
2017-10-26 08:22:00 +02:00
Christophe Simonis 2a1456a29c [FIX] web: _applyChange() should return list of changed fields, even when no onchange are performed 2017-10-25 17:58:01 +02:00
Christophe Simonis 693f8dc68a [MERGE] forward port branch saas-16 up to 7bfde6e05d 2017-10-25 14:57:24 +02:00
Géry Debongnie c739bcf0d1 [FIX] web: update column aggregate when field changes (list)
A list view can display the sum of all values for one field, using the
'sum' attribute.  Before this commit, this sum was not updated whenever
a field was changed (but it worked when adding a line).
2017-10-25 14:13:14 +02:00
Christophe Matthieu 9d7f9cc38c [FIX] calendar: don't display the created or updated record
If the user change a filtered field, the record is not always displayed.
Wrong domain construction. The automatic filter must be use to filter and
remove items from the view for the unselected and not display the selected.
2017-10-24 17:26:48 +02:00
Géry Debongnie 616eedb7e4 [FIX] web: allow onchange to modify origin field
With this commit, we allow an onchange coming from a field to modify the
same field.  This was not working for field widgets derived from an
input field.
2017-10-24 15:39:14 +02:00
Géry Debongnie d58d6e270f [FIX] web: propagate view context in all x2m operations
It could happen in some cases that a rpc coming from a view was not made
with the context of the view (and from the action).  For example,

- enable "Lots & Serial Numbers" in the inventory settings
- create a stockable product tracked by lot
- go to the inventory dashboard, on the "receipts" card click on the
  three dots and then on "planned transfer"
this link forces the context key "planned_transfer" in the action
https://github.com/odoo/odoo/blob/11.0/addons/stock/views/stock_picking_views.xml#L725
- now add a stock move to move some quantity of the product you just
  created
- see that no button appears on the one2many list
- save
- see that a button appears on the one2many list

This is an issue because the read on the o2m at the end is made with the
wrong context.  The reason is that when we fetch x2m, we create a new
datapoint of type 'list' which did not reuse the context of its parent.
2017-10-24 15:38:55 +02:00
Khoi Nguyen a0fad8ba6d [FIX] web: show tooltips on status bar widgets
The 'new views' refactoring introduced the usage of the "disabled"
attribute in addition to the associated bootstrap class. As a
side-effect, tooltips are never rendered when the mouse is on a disabled
button, since disabled elements do not fire mouse events.

In particular, no tooltip is shown when hovering over a disabled button
of the statusbar in debug mode. This can be observed when opening the
form view of a Manufacturing Order.

We fix this issue by requiring that disabled buttons in a status bar
never be the target of mouse events, triggering them on their
respective parent elements instead.
2017-10-24 14:03:12 +02:00
Aaron Bohy 58ed404a32 [FIX] web: editable lists: partial backport of 3b70961 2017-10-23 16:49:19 +02:00
Aaron Bohy c3a7037afd [FIX] web: restore scroll position when leaving form views
For instance, open a list view with enough records so that there is
a scrollbar, scroll, open a record of the bottom of the list and go
back using the breadcrumbs: the scroll position should be restored.

Before this rev., it wasn't the case: the scroll position was reset
to the top of the list (i.e. to 0).

This was due to the form renderer which manually triggered the event
DOM_updated on the main bus to ensure that textareas were correctly
autoresized. However, this wasn't done at the right place, and it
impacted the way scroll positions of views were saved/restored.
Indeed, this was only necessary when switching from readonly to edit
mode, i.e. when the form view was actually already in the DOM, but
not at each rendering as they may be performed outside the DOM (and
in this case, the DOM_updated event is triggered by the view_manager
when the view is really appended to the DOM).

Note that this whole scroll mechanism relying on the DOM_updated
event will probably change soon in master, with the refactoring of
the upper part of the webclient.
2017-10-23 16:49:19 +02:00
Christophe Matthieu b2327b8bf0 [FIX] web: reduce the number of changes when use handle widgets 2017-10-23 12:18:29 +02:00
Christophe Matthieu 512113b78a [FIX] web: reordering lines using the handle widget triggers onchange
issue: When reorder each line trigger an onchange on the line (if they are an
onchange linked to the field) and one onchange per line on the parent.

Adding an option doNotNotifyChange to avoid the trigger on the parent.
2017-10-23 12:18:28 +02:00
Christophe Simonis 10128fa7e8 [MERGE] forward port branch saas-16 up to dc2a6c6cd2 2017-10-20 19:27:04 +02:00
Christophe Simonis 5ea0f55d65 [MERGE] forward port branch saas-15 up to bee0c11ef7 2017-10-20 17:57:21 +02:00
Christophe Simonis bee0c11ef7 [MERGE] forward port branch saas-14 up to f3ac68ed29 2017-10-20 17:24:15 +02:00
Géry Debongnie 635572b49d [FIX] web: properly handle failures in onchanges
With the new views, we mainly focused on making them work.  But we also
need to be able to handle unusual cases, such as some RPC failing.  An
example of such a problem was the following:

- a form view with a one2many with an onchange
- edit mode, change a field in the one2many, click elsewhere
- the onchange triggers, calls the server
- it may happen that the server fails with a ValidationError
- the onchange deferred fails, the line in the one2many is restored to
  the value known by the list renderer, which is the previous value (but
  the new value was applied to the model)
- we now have a 'corrupted' state: clicking on save will send the
  invalid value, even though the UI displays the previous one.

We solve this problem in this commit by making sure that the onchange
deferred returned by the _performOnchange always succeed (or stays
pending).  If the rpc fails, the deferred will succeed with an empty
dictionary.  This means that the list renderer will be updated with the
value from the model.

Note that it may not be intuitive that a failure in the onchange is not
seen as an error from the perspective of the _performOnChange, but I
think that it still makes sense:
- the validation/network errors are not really a concern of the UI. The
  UI just display the values entered by the user.
- if an onchange fails (for example, because of a coding error), we do
  not really want to prevent the user from working.

Also, when the onchange is performed, the initial change was already
applied to the local data.  Rollbacking them would be a more difficult
task.

Note that we also improve the mock server in this commit, to allow
mocking failures.
2017-10-20 17:14:10 +02:00
Géry Debongnie fd65dbaa1f [FIX] web: session.get_file should return a value
The session get_file method should return the value from the
ajax.get_file method, otherwise we lose information (this is necessary
to be able to react properly to the fact that the download was blocked)
2017-10-20 17:14:10 +02:00
rde dd2a619ad5 [FIX] base, web, website: settings - prevent duplicate enterprise labels
Before this commit:
Multiple widgets for the same field on the same view (V11.0 settings) would not
retrieve the correct label but all of them.

Now:
We now retrieve the correct label instead of all of them
2017-10-20 15:58:24 +02:00
Géry Debongnie 823cfd6ab1 [FIX] web: make sure m2m_checkbox works twice in a row
We had an interesting bug with the field many2many_checkbox: in some
cases, it could cause a crash, because it could not find an element in the
localdata.

To reproduce this, start with a non empty field many2many checkbox, then
uncheck them twice.

The reason is that the datapoint of type 'list' that represents the
current value is actually modified, and the replace_with operation
assumed that it could find the localID by looking into its data.  I have
the feeling that a more complete fix is to make sure that the datapoint
is not modified (in its 'data' key), but is modified in its '_changes'
key.  However, this would probably be a bigger change.
2017-10-20 14:56:37 +02:00
Martin Geubelle 2455350c40 [FIX] web: deal with date widget on datetime
This use case was not correctly managed as the function evaluating if the
value has changed compares datetime and date.

This triggered an issue if the widget `date` was set on the field `date_order`
on a purchase order for example ; it was not possible to create a record as
the datapoint was set `dirty`.

This rev. ensures that a `field_changed` is not triggered if the day is the same
on a date widget.

This rev. also adds support of `datetime` fields on date widget, which appears
to be a valid use case.

Fixes https://github.com/odoo/odoo/issues/20311
2017-10-20 11:25:32 +02:00
Martin Geubelle 1312ee72cf [FIX] web: correctly render the field image
Before this commit, the image was directly built without using the corresponding
template, which set some properties on the image (class, width, etc.).
2017-10-20 11:04:08 +02:00
Christophe Simonis a3b3bb2228 [MERGE] forward port branch 10.0 up to 9b4447e9aa 2017-10-19 23:16:39 +02:00
Nicolas Lempereur c57fb01a3e [FIX] web: iOS content in modal disappear
As can be seen in https://github.com/scottjehl/Device-Bugs/issues/8 a
combination of "-webkit-overflow-scrolling:touch", "position:relative"
and "overflow:auto" can have unexpected behavior on iOS.

The issue solved here is that writing in a form view inside a modal in
iOS (at least version 10.3) would make the whole form body invisible
until edition is ended.

This commit fixes this by adding a CSS rule which avoid the iOS bug.

opw-774396
closes #20314
2017-10-19 14:33:30 +02:00
qsm-odoo 1e9adb8971 [FIX] web: domain field should never be considered unset
Backport of https://github.com/odoo/odoo/commit/841f41f95b7cf7d8f13ddce724d60d1d1149886d
Does not have to be forward-ported in saas-16.
2017-10-19 11:07:50 +02:00
Géry Debongnie d8f03e64fd [FIX] web: do not send id in update commands for m2m
When we generate commands for many2many, it could happen that the id was
in the list of changed fields (when we are in a new records, with a non
empty initial onchange).  When this happens, the server is not happy.

To reproduce this, open the uninstall wizard of a module in the 'App'
application.  This creates a new record with a non-empty many2many
field. Then click on 'Show technical modules', this will trigger an
onchange which should not send the id field.
2017-10-19 10:56:49 +02:00
qsm-odoo 841f41f95b [FIX] web: domain field should never be considered unset
Indeed, false was already considered as "[]" in edit mode.
2017-10-18 18:14:33 +02:00
Lucas Perais 6c9e45576e [FIX] document: display create_date of attachment timezone aware (#20242)
Before this commit, when putting the mouse over an attachment in the attachment drop menu list, the date time displayed was UTC only.
After this commit, we convert that value to the correct timezone datetime.

OPW 776704
2017-10-18 14:25:22 +02:00
Géry Debongnie d365a289d4 [FIX] web: generate proper x2many commands in some cases
When creating a new record with a non empty default value for a one2many
field, we did send the command 0 (for each one2many line) instead of the
command 1 (update).  This was a pretty big problem, because then the
server would try to create a line with possibly incomplete data.

For example, it was not possible to create expense sheets: go to expense
menu, select one expense in the list view, click on the action menu
'submit to manager', this opens a form view with a one2many with the
selected expense, then save.  Before this commit, this would lead to a
server error.
2017-10-17 18:21:47 +02:00
fda-odoo a1e15b9fce [FIX] web: use "get_formview_id" when opening record from calendar view
Opening a record in a calendar view always showed the default form view when it is not a popup.
Example in CRM: opening an opportunity will always show a lead view.

The fix aims to use the "get_formview_id" method to find the right id of the view that must be shown instead
of using a default id.

opw-774272
2017-10-17 15:34:29 +02:00
fda-odoo a0fcd5c781 [FIX] web: use "get_formview_id" when opening record from calendar view
Opening a record in a calendar view always showed the default form view when it is not a popup.
Example in CRM: opening an opportunity will always show a lead view.

The fix aims to use the "get_formview_id" method to find the right id of the view that must be shown instead
of using a default id.

opw-774272
2017-10-17 15:25:41 +02:00
fwi-odoo 48c17fd360 [FIX] web: polyfill to make the list editable work in IE11
Internet Explorer doesn't implement 'contains' for document so we make a
polyfill for this method in order to be compatible.
2017-10-17 09:31:55 +02:00
fwi-odoo 3993528bac [FIX] web: polyfill to make the list editable work in IE11
Internet Explorer doesn't implement 'contains' for document so we make a
polyfill for this method in order to be compatible.
2017-10-17 09:29:14 +02:00
Géry Debongnie a18a3fd31a [FIX] web,report: display warning when report download is blocked
iOS devices need to open a window to allow downloading files.  This is
fine, unless the browser is setup to block the popups, which is quite
probably the default settings.  In that case, it just fails silently,
and the user has no idea of what just happened.

So, with this commit, we simply display a warning to let the user know
of what is actually going on.
2017-10-16 14:47:29 +02:00
Khoi Nguyen 0958eee295 [FIX] web: Remove debugger
Introduced by
https://github.com/odoo/odoo/commit/9f7af9f9b742d08ca69a4d4d0b963f625c4b4bba

Sorry!
2017-10-16 13:10:25 +02:00
Khoi Nguyen 8191d6d72e [FIX] web: tab navigation with phone widgets in form view
This commit ensures that tab navigation works properly when editing a
form view that contains input fields with phone widgets. Previously,
pressing TAB would skip those fields.
2017-10-16 13:05:19 +02:00
Khoi Nguyen b6c3ee4e24 [FIX] web: discarding a new record in a modal closes the modal
Discarding a new record triggers the 'history_back' action.  This makes
sense if the record was discarded from a normal form view, but not so
much when in a modal, where the expected behaviour is to close the
dialog.

This commit overrides the function in the action manager which handles
the switch to the previous view. It checks whether a dialog window is
open, in which case it simply closes it.
2017-10-16 12:20:11 +02:00
Khoi Nguyen 9f7af9f9b7 [FIX] web: ticking a checkbox in an x2many after onchange
This commits fixes a traceback that appears when ticking a checkbox in
an x2many which triggers an onchange. The root cause of the issue is
twofold:

- confirmUpdate requires currentFieldIndex to be defined, but might be
  needed when setting currentFieldIndex;
- confirmUpdate attempts to restore the selection range even if we are
  not dealing with a char field (e.g. checkbox).

We solve the issue by ensuring that _selectCell gives a temporary value
to currentFieldIndex. This value is chosen so that confirmUpdate calls
_selectCell with the right parameters. Moreover, we only restore the
selection range when the range is defined.
2017-10-16 11:34:39 +02:00
Khoi Nguyen bb692c76d4 [FIX] web: tab navigation with phone widgets in form view
This commit ensures that tab navigation works properly when editing a
form view that contains input fields with phone widgets. Previously,
pressing TAB would skip those fields.
2017-10-16 11:34:39 +02:00
Christophe Simonis 6df0bf2a67 [FIX] web: correct expectation in new test introduced by previous forward-port 2017-10-13 14:26:46 +02:00
Christophe Simonis 1da064a1d3 [MERGE] forward port branch saas-16 up to 8ee9024a4c 2017-10-13 13:13:11 +02:00
Géry Debongnie d4cf4374d1 [FIX] web: allow widget many2many_tags to display more than 40 records
Before this commit, the widget many2many_tags only loaded the first 40
records. This was difficult to see, because there were not so many views
with a lot of tags.
2017-10-12 16:15:06 +02:00
Géry Debongnie 66b692a5eb [FIX] web: fix display issue with fieldSelection
When displaying a many2one values, in edit mode, the option did not
properly display some characters.
2017-10-12 16:14:49 +02:00
Géry Debongnie 7d448d57e3 [FIX] web: fix issue with default_get/onchange and one2many
Before this commit, there was a bug when creating a new record which
contains a one2many with an onchange.  The commands sent to the onchange
did not contain the full information.

Here is how you could reproduce the issue: install expense, go to the
expense list view, select the 2 lines, then, in the 'action' menu in the
control panel, choose 'Expense: submit to manager'.  In the new expense
sheet, you could see that there were two lines in the one2many
expense_line_ids.  However, these lines are empty.  The reason is that
the commands sent in the onchange were 2 commands 0, with {} as data.

So, in short, the BasicModel did generate the proper commands, but with
empty data, in the specific case when we have a non empty one2many in a
default_get, then an onchange.

To solve this issue, I had to fix 2 things: the internal data struture
was wrongly updated, and the commands should be generated with all the
data, and not only the changes.
2017-10-12 16:14:47 +02:00
qsm-odoo 03ef19e40c [FIX] web, hr_timesheet_sheet: make m2o friendly-usable outside of views
Before this commit, m2o external button was always floating outside the
m2o main DOM element, on the right. This induced problems when using the
m2o outside of views (like in Odoo Studio). Now, the m2o design is made
so that this button is inside the m2o, except in form views where we
expect the button to overflow in the tables' right paddings.
2017-10-12 13:39:17 +02:00
rgarnau b8dac2ff32 [FIX] web: integer not properly parsed
The parsing of the integers does not escape the thousands separator.

issue: Integers are currently not properly parsed. For example, create
a database in Spanish language, install product_expiry and in settings
activate Lots & Serial Numbers. Go to Products and create a new product.
Choose to track by lots and specify the use_time, life_time, etc.
When saving, all integers are set to 0
2017-10-12 10:34:40 +02:00
Adrien Dieudonne aac4918096 [FIX] web: kanban mobile horizontal scroll issue
In mobile, the .o_kanban_card_content width wasn't defined.
In desktop, we don't have this issue because the .container bootstrap
element set the width.

Now, the kanban card content is correctly displayed in
the workcenter kanban view.
2017-10-11 13:21:45 +02:00
Richard Mathot 66f7d393d3 [FIX] web: debug mode tooltip
Display properly the content of context object instead of
[object Object].
2017-10-11 10:40:46 +02:00
Christophe Simonis 6c2ab192ea [MERGE] forward port branch saas-16 up to 88a9980b0c 2017-10-10 16:49:59 +02:00
Xavier Morel 7f6d32d5e0 Revert "[FIX] qwebjs: add tests to test suite" 2017-10-10 15:39:39 +02:00
Xavier Morel 6e646bc8bd [FIX] web: make qwebjs tests pass again
A bunch of features had been added to the qweb test files and qwebjs
did not pass them as features were either implemented differently or
not implemented at all:

* Fixed wonky and not cross-impl tests
  - added ``not`` word replacemenet to qwebjs as I wasn't sure how to
    handle that one cross-impl
* fixed t-esc/t-raw to render content *inside* the host node e.g.
  span@t-esc should render as <span>{contents of esc}</span>
* added fallback to body content if t-esc/t-raw yields an empty result
* process t-att in order with t-att-* and t-attf-* rather than before
  them both
* suppress attribute generation entirely in case of falsy value
2017-10-10 14:25:19 +02:00