Commit Graph
7088 Commits
Author SHA1 Message Date
qsm-odoo c04dfec023 [FIX] web: make the domain field a "block" field
The domain field needs space to be rendered. Even with its "in_dialog"
option activated, the readonly representation can take some space.
If there is not enough space, it will be a mess to read it and the
"-> x records" button can also overflow the "Add filter" button.

This commit makes the field to be rendered as a "block", which fixes
the problem in all current cases.
2017-03-29 12:26:11 +02:00
Christophe Simonis 2f68e9e93a [MERGE] forward port branch 10.0 up to 72fa3e8bda 2017-03-28 17:27:19 +02:00
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 b2fa9f2ad1 [MERGE] forward port branch 10.0 up to 31ebb07773 2017-03-17 17:57:52 +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 777a87cde8 [MERGE] forward port branch 10.0 up to 2ef43281c2 2017-03-13 16:22:57 +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
Christophe Simonis d08ecdc3b8 [MERGE] forward port branch 10.0 up to 1279f82e12 2017-03-06 13:52:06 +01:00
Olivier Dony 163f5a6268 [FIX] web: boolean button terminology is optional
Make sure the widget won't crash when no `terminology` option
is passed.

Also for the translation extraction system to work, each literal
term needs to be enclosed in its own _t() call:

  // No
  var trans = _t(term || "Default term");

  // Yes
  var trans = _t(term) || _t("Default term");

The _t() function supports `undefined` arguments so the second
form is equivalent to the first form at runtime, but supports
proper term extraction.

Finally, simplified the implementation a little bit,
requiring `hover_true` and `hover_false` "action descriptions"
to be provided explicity in custom terminologies.
Previously we tried to reuse the values from `string_true` and
`string_false`, but they describe a state rather than an action,
so they are hardly ideal.
2017-03-03 15:11:19 +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
Christophe Simonis eddefc9948 [MERGE] forward port branch 10.0 up to 8c55e57c7f 2017-03-01 16:14:41 +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
Adrien Dieudonne ed1abc43d1 [FIX] web: string values in priority widget
(1) The priority widget is based on a selection field.
So, this priority widget must support string values.
Before this commit, the widget worked correctly with numeric values.
For example: '0', '1', '2', '3' was converted to 0, 1, 2, 3.
But sometimes, we have non-numerical values.
For example: 'Normal', 'Low', 'High', 'Very High'.
In this case, we can not compare the elements to each other according to their values.
If you select 'High', we don't know if the star of the value 'Low' must be filled.

To fix this, we base the comparison on the indexes of the table of possible values.
For example:
[('A', 'A'), ('B', 'B'), ('C', 'C'), ('D', 'D')]
Now, if you select D, we know that A (with index 0)  is smaller than D (with index 3).

This could be a behavioral change if you had [('1', '1'), ('0', '0'), ('2', '2')]

(2) When the selection field had no value, the 'o_form_field_empty' class was added.
In this case, the stars must be displayed without being filled.
2017-02-24 14:38:20 +01:00
Christophe Simonis 85368d7f86 [MERGE] forward port branch 10.0 up to 387b2acfcb 2017-02-23 20:15:38 +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
qsm-odoo 5df7552ce8 [FIX] web: properly handle implicit "&" operator in domain selector
In saas-14, domain selector widgets are supposed to be instanciated
with a valid domain.

The problem is that some valid domains were wrongly evaluated. Indeed,
when receiving a domain which does not begin by an operator, the
"DomainTree" widget considered there is an implicit "&" operator that
should be used. This is not enough. Indeed, when evaluating the domain
["|", A, B, C], there is also an implicit "&" despite the fact the
domain starts with an operator ("|"). Because of that, previous
implementation interpreted this domain as ["|", A, "&", B, C] while
it should have been interpreted as ["&", "|", A, B, C].

Note: in master the parsing will be improved to handle wrong domains
and be decoupled of the DomainTree widget.
2017-02-16 10:44:41 +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
qsm-odoo 134db4ce99 [FIX] web: change selected field value on chain shortening
Before this commit, when opening a field chain with a field selector
and only removing parts of it, the field selector internal "chain"
value was properly updated but not its "selectedField" value.
2017-02-13 14:55:18 +01:00
Christophe Simonis be9dfb331f [MERGE] forward port branch 10.0 up to 9beca598d4 2017-02-10 17:33:06 +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
Christophe Simonis cbdd0b20dc [MERGE] forward port branch 10.0 up to ffd4442b06 2017-02-10 13:17:02 +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