Commit Graph
7367 Commits
Author SHA1 Message Date
qsm-odoo 72fa3e8bda [FIX] web: properly display tooltips with much data
When there is a lot of texts to display in a tooltip, it will overflow
the viewport vertically as the max-width of the tooltip is set at 200px
(bootstrap default). This commit increases the max-width to the
viewport full-width.

opw-725804
2017-03-28 16:45:35 +02:00
Christophe Simonis c37f1f6cb9 [MERGE] forward port branch saas-11 up to 8bab7aebd6 2017-03-28 16:17:09 +02:00
Christophe Simonis 8bab7aebd6 [MERGE] forward port branch 9.0 up to e876becada 2017-03-28 16:14:34 +02:00
Christophe Simonis e876becada [MERGE] forward port branch saas-6 up to 7bcfa2b52a 2017-03-28 16:01:05 +02:00
Christophe Simonis 7bcfa2b52a [MERGE] forward port branch 8.0 up to 5fc3979262 2017-03-28 15:22:58 +02:00
Jairo Llopis 5fc3979262 [FIX] web: Avoid double-fetching many2many tags in list views
Before this patch, #15920 was happening. The problem was that calling `render_cell` produced a call to [`record.set(column.id + '__display', value)`][1], which triggers the `change` event, which called `render_record` the first time, which called again `render_cell` and produced the 2nd data fetch.

After this patch, `render_record` is only called if there is some place where to put the result, which does not happen in those situations.

There is still the problem that there is one call to name_get for each many2many widget found in a list view (instead of one per full view rendering), but at least they are not two calls!

[1]: https://github.com/odoo/odoo/blob/5d17749ff47c02294d5ff2ae56bbcef9d082562e/addons/web/static/src/js/view_list.js#L1125
2017-03-28 15:12:56 +02:00
Wolfgang Taferner 8e7f34c323 [FIX] web: domains might be undefined, so we check
Introduced recently in b2d66d0c14

opw-726354
Closes #16068
2017-03-28 15:02:47 +02:00
Christophe Simonis 27496730d8 [MERGE] forward port branch saas-11 up to c2569b9df1 2017-03-28 14:51:14 +02:00
qsm-odoo eac7e16e20 [FIX] web: no formview dialog during editable list edition
Clicking on an editable list row makes the row editable. Clicking on
an editable list row while another row is being edited, first make
the row being edited readonly before making the clicked row editable.
The row which goes back to readonly have to be reloaded, operation
which is not instantaneous. If another row is clicked while a row
is going back to readonly (this typically happens if a row is double
clicked while another one is being edited), a form view dialog was
opened to edit the row (behavior which was not expected).

opw-710627
2017-03-27 10:35:55 +02:00
Christophe Simonis 70b770d62e [MERGE] forward port branch 9.0 up to 8376f538b5 2017-03-24 17:57:29 +01:00
Christophe Simonis 8376f538b5 [MERGE] forward port branch saas-6 up to 9d04d14669 2017-03-24 17:11:48 +01:00
Christophe Simonis 8caac6bc44 [MERGE] forward port branch 8.0 up to 5847de4aaf 2017-03-24 15:23:16 +01:00
qsm-odoo b2d66d0c14 [FIX] web: properly combine domains with "OR" in CompoundDomain
The CompoundDomain class allows to regroup several domains with an
implicit "AND"; these domains can be either a string, an array or
another CompoundDomain. A CompoundDomain can then be converted to
an array thanks to pyeval.js.
For example, if a CompoundDomain is initialized with `[A, B]` and
`[C]`, the array conversion gave `[A, B, C]` (which is expected).

However, a hackish method was used with CompoundDomain. If one of the
domain of a CompoundDomain is equal to `["|"]` (an array with the
OR operator in it), the two next subdomains were supposed to be joined
by a OR operator. Indeed, for the case of a CompoundDomain initialized
with `["|"]`, `[A]` and `[B]`, the array conversion gave `["|", A, B]`
(which is expected). However, if initialized with `["|"]`, `[A, B]` and
`[C]`, the array conversion gave `["|", A, B, C]` which is very wrong
as what was expected is `["|", "&", A, B, C]`. The problem is that the
given `[A, B]` contains implicit "&" operators.

This commit fixes the problem by normalizing only if the CompoundDomain
starts with a ["|"] or ["!"] array which is the standard odoo case.
This allows to limit breaking custom code (e.g we want a simple "AND"
of `[A]` and `[B]` to stay `[A, B]`, not become `["&", A, B]`).

The commit also modifies a test so that it checks that the problem is
properly solved.
2017-03-24 15:03:54 +01:00
qsm-odoo 3aabf8101a [FIX] web: correctly check editable list validity
The editable list has a `is_valid` method which checks that all the
records it contains have valid data. The problem is that it was
considering that all the records in the `dataset.cache` were part of
the x2x field the editable list is working with. This is wrong as the
`dataset.cache` can contain information which are not part of the
editable list anymore.
See the commit which introduced the use of the `dataset.cache`:
a9d20d9fa0

This was causing issues with rare cases of an editable list which
contains another editable list (even invisible) which was sharing
common information with its parent editable list.

opw-710627
2017-03-21 11:55:45 +01:00
Nicolas Lempereur bc0313791c [FIX] fields, web: improve form onchange to x2many
In a form view, when a field onchange lead to a change on a x2many,
there was two different behavior:

- if the x2many had an embedded view (eg. a tree view inside a form
view) the onchange would notify that it expected the x2many field in
this embedded view to be changed and handled the changes correctly.

- if the x2many had a default view, the onchange ORM would not be
aware the x2many could be modified and would not sent the changes
back causing blank or not updated x2m lines and error on save.

---

Two solutions were birthed to solve the second point:

=> PR #10557 = solving everything

With this PR the onchange in the ORM is aware of every fields in the
current view (even field in a x2m in a x2m in a x2m in a form view) and
if any of these are change the javascript gets back the value of the
fields present in the view.

This PR has currently not been merged by fear of changing too much and
anyway could only be done in master.

=> PR #12249 = if no field for x2many, send its form view fields

With this change, if the ORM onchange is not aware of the fields in the
x2many widget to returns, all the field in the x2m default form view are
returned.

This was merged in bbdf960 but introduced a number of other issue:

- in most situation the x2many is represented by a list view, which may
have fields missing of the form view,  so the original is still present.

- the view used may differ from the default form view in other way
(depending on value in context or other possibilities).

- the form view could have fields not present in the form view which
could end up in `write` on fields which should not be written to.

---

This commit reverts bbdf960 and adapts a small part of #10557 so the
x2many with default view works as an embedded x2many. For more than one
level (eg. a x2many in a x2many) this would still not work but it is
only solvable by a PR such as #10557 which could only be targetted for
master.

With this commit:

- the list of fields sent to ORM onchange is computed at the first onchange
- the fields from a x2many field default view is sent for onchange
- the initial onchange on record creation is delayed to when x2many are loaded

closes #12249, closes #15336, closes #15890
fixes #11236, fixes #12249, fixes #15129, #15419
opw-705965 opw-716095 opw-715619 opw-710440

note: already present in 10.0 (with a test) as f65475d68
2017-03-20 13:28:34 +01:00
Nicolas Lempereur f65475d68c [FIX] fields, web: improve form onchange to x2many
In a form view, when a field onchange lead to a change on a x2many,
there was two different behavior:

- if the x2many had an embedded view (eg. a tree view inside a form
view) the onchange would notify that it expected the x2many field in
this embedded view to be changed and handled the changes correctly.

- if the x2many had a default view, the onchange ORM would not be
aware the x2many could be modified and would not sent the changes
back causing blank or not updated x2m lines and error on save.

---

Two solutions were birthed to solve the second point:

=> PR #10557 = solving everything

With this PR the onchange in the ORM is aware of every fields in the
current view (even field in a x2m in a x2m in a x2m in a form view) and
if any of these are change the javascript gets back the value of the
fields present in the view.

This PR has currently not been merged by fear of changing too much and
anyway could only be done in master.

=> PR #12249 = if no field for x2many, send its form view fields

With this change, if the ORM onchange is not aware of the fields in the
x2many widget to returns, all the field in the x2m default form view are
returned.

This was merged in bbdf960 but introduced a number of other issue:

- in most situation the x2many is represented by a list view, which may
have fields missing of the form view,  so the original is still present.

- the view used may differ from the default form view in other way
(depending on value in context or other possibilities).

- the form view could have fields not present in the form view which
could end up in `write` on fields which should not be written to.

---

This commit reverts bbdf960 and adapts a small part of #10557 so the
x2many with default view works as an embedded x2many. For more than one
level (eg. a x2many in a x2many) this would still not work but it is
only solvable by a PR such as #10557 which could only be targetted for
master.

With this commit:

- the list of fields sent to ORM onchange is computed at the first onchange
- the fields from a x2many field default view is sent for onchange
- the initial onchange on record creation is delayed to when x2many are loaded

closes #12249, closes #15336, closes #15890
fixes #11236, fixes #12249, fixes #15129, #15419
opw-705965 opw-716095 opw-715619 opw-710440
2017-03-20 13:25:07 +01:00
Christophe Simonis 31ebb07773 [MERGE] forward port branch saas-11 up to aefdf96c25 2017-03-17 17:55:30 +01:00
qsm-odoo d32e275ad1 [FIX] web: force red color for invalid form elements
When an input is saved with an invalid value, it gets the
`o_form_invalid` class. This makes the border red. In enterprise, there
was a bug as required inputs have also a different border color and the
rule was more important. Unfortunately there is no avoiding
the !important rule here. Indeed, other solutions would require to make
more rules in enterprise or to change the order of files (which would
create many problems).
2017-03-14 14:47:17 +01:00
Christophe Simonis 2ef43281c2 [MERGE] forward port branch saas-11 up to 2e972578b9 2017-03-13 15:53:55 +01:00
Christophe Simonis 2e972578b9 [MERGE] forward port branch 9.0 up to 73d6f9023a 2017-03-13 14:49:12 +01:00
Nicolas Martinelli 4ce309dfab [FIX] web: deactivate buttons
To reproduce:
- Get a slow connection, e.g. activate throttling in debug mode of the
  browser.
- Create an invoice with at least one tax.
- Change a price unit.
- Click on 'Save' then repeatedly on 'Validate'

The tax lines are duplicated.

The issue comes from two identical `write` calls whose purpose is to
delete the existing tax line and create a new tax line.

The two calls are issued by the click on 'Save' and the click on
'Validate', which triggers a 'Save' since it doesn't consider the form
as being saved yet.

There were several issues:
- The buttons from the statusbar were not disabled
- The buttons were enabled too soon. They should be enabled again when
  the form is reloaded, otherwise the call to 'Validate' doesn't
  consider the form saved.

This is an extension of commit
https://github.com/odoo/odoo/commit/bbbf3db581b5cf883

opw-710642
2017-03-07 11:57:14 +01:00
Martin Trigaux ee78aa7d6a [FIX] web: avoid undefined options
options is not mandatory, crashed when navigating with tabs
Complete 2bf6e69e
2017-03-07 11:24:23 +01:00
Goffin Simon 69d6c37456 [FIX] web: prepare_dropdown_selection
Steps to reproduce the bug:
1.Create a new company
2.Set a user in this company
3.Go to Helpdesk > All tickets > Create

It raised a traceback because stage_id was not defined

opw:710084
2017-03-07 00:35:58 +01:00
Denis Ledoux cde8668034 [FIX] web: IE <= 11.0 doesn't support ChildNode.remove
IE 11.0 doesn't support `Childnode.remove`:
http://caniuse.com/#feat=childnode-remove

As a workaround, we use `Node.removeChild`,
which is more widely supported.

opw-710617
2017-03-06 18:21:06 +01:00
bluesoft83 2bf6e69e28 [FIX] web: keep focus field when navigating with keyboard
When moving with keys up or down on editable list view, jumping of line was
bringing the cusor back to the first cell.
The cell focus is stored in the option dict (e.g. {'field_focus': 'name'}.
Previous code was discarding the content of the given option dict to create
a new one.

Closes #15703
2017-03-03 14:12:53 +01:00
Leonardo Rochael Almeida 2b5e879957 [IMP] web: Enhance registry.js tests
Make sure we're really setting and getting registry values instead of
just `undefined` values.
2017-03-03 10:17:46 +01:00
Leonardo Rochael Almeida 6eb15a6263 [IMP] web: Remove tiny code duplication 2017-03-03 10:17:41 +01:00
Leonardo Rochael Almeida bf8cc11e7e [FIX] web: QUnit context in js tests
Previously, the context for `options.{before,after}Each()` functions was
isolated from the context created by the odoo `test` function, making
it impossible to save attributes in the test during
`options.beforeEach()` that are accessible from the test itself, or to
clear resources created in the test in `options.afterEach()`

Moreover, the odoo test infrastructure was set up completely inside the
test wrapper, after `options.beforeContext()` had already run, making
it impossible for `options.beforeContext()` to use this infrastructure.

Here we use the QUnit context directly in the test, but move the
initialization previously done in the test wrapper to a `beforeEach`
wrapper (and, symetrically, on `afterEach`), making it possible to use
the odoo infrastructure in the javascript test setup, including
declared section dependencies.
2017-03-03 10:17:33 +01:00
Fabien Meghazi 38ec6d7522 [FIX] qweb2.js: fix erratic object type detection in foreach (Fixes #15655)
Could not add a test as the qweb js testsuite is broken and it's xml
test files have been modified in order to test qweb.py specific cases.
2017-02-28 13:00:54 +01:00
Csaba Fazekas a1224f5ca9 [FIX] web: Contact form modal not responsive
When creating a contact from "Contacts & Adresses" in res.partner view form.
The radio button (field "type") was not responsive.

opw:706338
2017-02-27 12:28:42 +01:00
Christophe Simonis 387b2acfcb [MERGE] forward port branch saas-11 up to 1730dca101 2017-02-23 19:40:03 +01:00
Denis Ledoux 1a9a082d10 [FIX] web: create="0" in many2many list views
The revision
dd657c42f7

intended to give the possibility to add an existing
record to a many2many list even without the `create` access
on the model of this record.
This is accepted by the ORM, as there is no need of the create
right on the model, only the write on the source model on which
the many2many field is.

The revision has as unexpected side effect to remove the possibility
to manually set `create="0"` on the tree of a many2many field,
to hide the "add an item" of the list view.

As this last feature is more important, we therefore revert this.

We will provide another solution for the above issue.
We think about forcing what the view definition says, so if you
set create="1" on the view, it will display the "add an item" link
in any case, even if you do not have the access right to do it.
This would allow to display the link for the above case, and in case
you actually do not have the access right, and this is an error
in the view definition, you will have an access error raised anyway.

opw-708310
2017-02-17 18:21:45 +01:00
Adrien Dieudonne d506199988 [FIX] web: set max width for image field in form view
Before this commit, wide images were larger than the form view.
2017-02-14 16:02:57 +01:00
Christophe Simonis 9beca598d4 [MERGE] forward port branch saas-11 up to b5971e417f 2017-02-10 17:32:36 +01:00
Martin Trigaux d20fd7bdbb [FIX] web: display checked checkbox when printing
Fixes #15147
2017-02-10 13:34:31 +01:00
qsm-odoo b5971e417f [FIX] web: hide list readonly checkbox when entering edition
Forward-port of https://github.com/odoo/enterprise/commit/8a55b3f9f7a7524583effb8198c03ebf695131bd

There are multiple problems with the editable view list. It should be
solved once and for all in the work-in-progress master.

This commit fixes a bug with readonly checkboxes. When a field is
readonly, the table cell gets the "o_readonly" class which changes
its style and behavior. When entering edition, the cells are hidden
except the ones with this "o_readonly" class so that their style are
not affected. The "o_readonly" cell content however was hidden thanks
to a "color: transparent;" rule to let the form readonly field show
the value. The problem is that checkboxes... are not hidden with this
"color: transparent;" rule. Also, the "o_readonly" class is not toggled
during edition while the readonly status could be... so the right fix
would be to get rid of this "o_readonly" class and let the inline form
handle the behavior, but this would affect style and possibly break
unknown behavior.

This fix adds rules to handle the checkbox case correctly.
2017-02-10 11:49:05 +01:00
Goffin Simon 2f328d3447 [FIX] web: Dashboards error
Steps to reproduce:
Go to any pivot view (for example Sales > Report > Sales) and add
the current view to your personnal dashboard (in the search view: Favourites > Add to my Dashboard)
Go to the dashboard, traceback because $buttons was not defined.

opw:707296
2017-02-10 11:01:03 +01:00
Goffin Simon 8bed9363f0 [FIX] web: Dashboards error
Steps to reproduce:
Go to any pivot view (for example Sales > Report > Sales) and add
the current view to your personnal dashboard (in the search view: Favourites > Add to my Dashboard)
Go to the dashboard, traceback because $buttons was not defined.

opw:707296
2017-02-08 08:05:46 +01:00
Christophe Simonis 9ec95b2a68 [MERGE] forward port branch saas-11 up to 51b79a7ee1 2017-02-06 17:18:24 +01:00
Goffin Simon 93448bb2b8 [FIX] web: Dashboards error
Steps to reproduce:
Go to any pivot view (for example Sales > Report > Sales) and add
the current view to your personnal dashboard (in the search view: Favourites > Add to my Dashboard)
Go to the dashboard, traceback because $buttons was not defined.

opw:707296
2017-02-06 16:39:59 +01:00
Nicolas Lempereur 0e15f5ddd0 [FIX] web: typo space missing in 2d753ab5 2017-02-06 16:21:46 +01:00
Aaron Bohy 434199a407 [FIX] web: undefined variable e 2017-02-06 09:21:26 +01:00
Aaron Bohy dd657c42f7 [FIX] web: FieldMany2Many List: allow to add items if create="0"
One can add an item in a Many2Many without creating it, so the action
should be available. However, if the create action is not allowed, there
is no 'Create' button in the SelectCreateDialog.
2017-02-06 09:21:26 +01:00
qsm-odoo a4dc9a8032 [FIX] web: do not call session load_qweb on frontend
Since commits 2a8a17024d and 9c68bc7482,
the session is not started by the webclient anymore but directly by the
session service instead, and the session info is found in the DOM
instead of by RPC.

Because of that, the session is started in the frontend and other
non-backend environments which caused a JS error while trying to
load qweb (as no qweb has to be loaded). This commit makes the
session start check if it is a non-backend environment and only
initialize session info (from DOM) in that case.
2017-02-03 15:49:23 +01:00
Christophe Simonis b7c7591bfb [MERGE] forward port branch saas-11 up to 71773e1f1c 2017-02-01 19:08:14 +01:00
Christophe Simonis 71773e1f1c [MERGE] forward port branch 9.0 up to a53063606a 2017-02-01 18:16:15 +01:00
Géry Debongnie a28405e469 [FIX] web: pivot view properly restores row groupbys
Before this commit, when saving the pivot state in a favorite filter,
then restoring it, the row groupbys were ignored.  This commit makes
sure that we take them into account if necessary.
2017-02-01 12:18:40 +01:00
Géry Debongnie b8922c964c web: pivot view properly updates measure list
Before this commit, when changing measures from the favorites menu (by
selecting a filter with some pivot_measures), the measures in the
dropdown menus were not correctly updated.

This commits make sure that we update the active measures in the menu after
each changes coming from a do_search.
2017-02-01 11:55:53 +01:00
Christophe Simonis ba8a1c7ec2 [MERGE] forward port branch saas-11 up to e86983112e 2017-01-27 18:20:28 +01:00
Christophe Simonis 047efcbd58 [MERGE] forward port branch 9.0 up to 838beb12de 2017-01-27 16:21:51 +01:00