Commit Graph

6179 Commits

Author SHA1 Message Date
Denis Ledoux 759492167a [FIX] web: textarea of editable list above everything
When expanding a textarea of an editable list,
by putting a long description for instnace,
with multiple lines,
some elements were put above the textarea,
making the content partially hidden

opw-709894
Closes #16083
2017-04-03 17:23: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]: 5d17749ff4/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
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
Jordan Vrtanoski 450f7df00d
[FIX] web: transfer context to underlying many2one in reference field
Fixes #11955 (loss of context in many2one subwidget)
Closes #11957
2016-12-15 09:34:32 +01:00
Nicolas Lempereur 5d17749ff4 [FIX] web: repair length field in view list
Underscore method _.each expects an array like object when a "length"
property is present.

This was an issue with a record having a numeric "length" field set to a
non-negative value. When changing a line the change would not appear on
blur.

This issue was fixed with 0e664c9e9 but introduced back with f0e331e00.

opw-691070
2016-10-24 13:25:58 +02:00
Jeremy Kersten d3609f7f19 [FIX] web,crm: list view, don't fallback on group_operator declared in python
Partial revert of odoo/odoo@633780a
2016-10-12 18:03:51 +02:00
Jeremy Kersten 633780a00c [FIX] web,crm: view_list respect group operator defined in the view.
Remove useless avg defined on crm view.

If you define avg='Average Values' in a view, now we see in the footer of list view the average.
2016-10-11 11:50:24 +02:00
Nicolas Lempereur 1da79b872e [FIX] web: keep m2m value in list view
Currently, when rendering a list view cell with a many2many we would
empty the list of ids, and fill it again once a name_get is resolved.

But in some instance, the code could use the data when it has been
emptied out.

For example, if we set the tax_id field (inside the order_line list view
inside the sale.order form view) as requred, if we modify the order line
and save directly (without clicking outside of the list view) we can get
an incorrect error saying that the "Order Line" is not valid.

It has been reproduced when saving with CTRL + SHIFT + S on google
chrome and firefox, and there have been reports that for some
configuration it also happen when clicking on the "Save" button.

This commit change the behaviour so the value is kept whilst the name_get
is ongoing, and just use a default "false" value for the name during this
interval.

closes #13478
opw-668067
2016-09-14 15:52:48 +02:00
Nicolas Martinelli 2559b2cf4f [FIX] web: statusbar click
When the statusbar is clicked, a `debounce` function prevents a
doucle-click, and therefore making several `write` calls. On some status
bars, clicking doesn't work anymore.

The reason is because, in some mysterious cases, the event is propagated
to the parent. The `currentTarget` is not the `li` element, but the
parent `ul`. By setting the `immediate` argument to `true` (execute the
first function instead of the last), this solves the issue.
2016-09-02 10:27:41 +02:00
Nicolas Martinelli c2fe9fe0e6 [FIX] web: prevent double-click on statusbar
When double-clicking on the statusbar widget, two calls to write are
performed. This can cause unwanted behavior, and when the `write` method
takes a lot of time to process, it's not possible to prevent it
server-side.

Courtesy of @gurneyalex and @aab-odoo

Closes #13134
opw-686025

FORWARD-PORT UP TO SAAS-6!
2016-08-16 13:09:49 +02:00
Christophe Matthieu a9fac2ea2d [FIX] web: required attribute on one2many field
Require One2many field without any line must show an error like many2many fields.

issue 11782
2016-06-22 09:16:07 +02:00
Jeremy Kersten 9772bbef07 [FIX] web: fix backport #4c7a9bd 2016-05-25 23:38:28 +02:00
Goffin Simon 4c7a9bdac4 [FIX] web: raise a warning for bad domain
When a user wrote a wrong value in char_domain field it should raise a warning
message instead of a traceback.

Backport of b3a88b6ed846a13c0cd07cc25ea49bccbdf84aa8

opw:676783
2016-05-25 15:52:59 +02:00
Nicolas Lempereur dd714ace55 [IMP] web: multi-click on save on view form (no fp)
When clicking on save several time when editing a view form it can be
saved several times which can be an issue for one to many.

The normal happenstance when saving should be as follow:

-> save (click)
-> wait write result
-> received write result
-> reload the form with updated data and updates buttons

But when clicking several time, it could become:

-> save (click)
-> wait write result
-> received write result
-> save (click)
-> wait write result
-> received write result
-> reload the form with updated data and updates buttons

This commit only reinstate the saving feature once the form is reloaded.

closes #11926
opw-671793

note: no need to forward-port
2016-05-09 10:54:16 +02:00
Olivier Dony 7f6bd2dc66 [FIX] web: fix layout issue in Chrome 50 (again)
Makes the fix in f992c8ee19
specific to the view manager of the main oe_application
container, in order to avoid disrupting other view manager
occurrences (such as the ones in modal windows or x2many
list views).

Fixes #11629 (again)

Note: Hopefully the Blink team will fix Chrome so we can
get rid of this hack in the future:
  https://bugs.chromium.org/p/chromium/issues/detail?id=603507
2016-04-19 17:44:24 +02:00
Simon Lejeune f992c8ee19 [FIX] web: fix layout issue in Chrome 50
A 100% height is not distributed anymore to the children of a table-row
if they are not themselves table-cell in Chrome 50. This breaks the
indenpendent scrolling of the menu and the view manager.

However, setting the `table-cell` display breaks the layout in Internet
Explorer.

When the webclient is loaded by Chrome 50, we load a stylesheet
forcing a `table-cell` for display.

Seems to be related to https://bugs.chromium.org/p/chromium/issues/detail?id=353580
and 8876584335

Related to e1a99192bd
Fixes #11629
2016-04-18 14:43:50 +02:00
Simon Lejeune e1a99192bd Revert "[FIX] web: fix layout issue in Chrome 50"
or how to break every internet explorer releases while
attempting to fix chrome 50
2016-04-15 12:12:26 +02:00
Simon Lejeune 00ead29c7c [FIX] web: fix layout issue in Chrome 50
The height was not distributed anymore to the children of a `table-row`
element if they are not themselves `table-cell` elements.

Fixes #11629
2016-04-14 14:31:12 +02:00
Holger Brunn b25c054c93 [FIX] web: prevent crash in rare case with status field
Current behavior before PR: if you create a new record within a one2many
field and the model's form has a clickable status bar defined, clicking
this status bar will raise an exception because the virtual id
(one2many_v_XXXX) will be passed to the model's write method

Desired behavior after PR is merged: clicking just changes the cached
value
2016-04-11 15:21:45 +02:00
Xavier Morel ceb87b78f0 [REV] usage of m2m listview for o2m
Turns out to break way more than it fixes.
2016-04-05 11:32:59 +02:00
Peter Hahn c2abdbbc37 [IMP] Make many2many widgets in listview usable for one2many
Existings many2many widgets in ListView can be used also for one2many if
the supplementary data is provided for the column.

closes #11282
2016-03-25 16:54:32 +01:00
Christophe Simonis d519daca1d [MERGE] forward port of branch 7.0 up to f1b9b30 2016-03-24 15:02:45 +01:00
Nicolas Martinelli f1b9b301da [FIX] web: clear filename if image error
When the user chooses as product image a file which is not an image, the
message "Could not display the selected image" is displayed. However, at
saving, a traceback is thrown since the file chosen is uploaded anyway.

If the image cannot be displayed, the image field is cleared.

opw-672206
2016-03-24 11:18:14 +01:00
Denis Ledoux 4fb2e76b43 [FIX] web: `char_domain` rendering on record switch
When using the left/riht arrow to switch of record
in a form view,
the rendering of the `char_domain` widget was done too
early, before all fields are ready / set, and if the
domain of the previous record could not be applied
on the current record, it leaded to a traceback.

This revision introduce a new deffered,
because I coudln't find one that was doing
what I was looking for:
 - `is_initialized` is a defferred which is
 resolved when the form view has finished
 its rendering for the first time
 - `reload_mutex` is a mutex used only when reloading or
 switch to left/right record.

While the one needed in this case is a deferred
which is resolved when the record has finished
being rendered, wether when its when coming
from the list view to the form view (and it's
not the first time the form view is loaded,
e.g. list view -> form view -> list view -> form view, another record),
or on the switch of left/right record.

opw-671594
2016-03-10 14:11:34 +01:00
Nicolas Martinelli e5f184fe6d [FIX] web: context/domain in move line tree
DO NOT FORWARD-PORT: the functionality is not used anymore in v9

Commit aaf9badb filters the returned ids by keeping the domain in the
request. However, `this.dataset.domain` might be empty, while
`self.dataset.get_domain()` will retrieve it from the model.

Since `get_domain` is not always defined on the dataset, we keep
`this.dataset.domain` as a fallback. The fix is not great, and a better
solution should be found in master branch when the web refactoring is
done.

opw-666755
2016-02-19 13:21:41 +01:00
xmo-odoo 19a1c18f57 [FIX] make m2m checkbox labels clickable 2016-01-29 16:24:14 +01:00
Nicolas Lempereur 29be9ae80b [FIX] web: conserve /id for saved export list
With 003d85b instead of getting the name of the relation
field_relation we get field_relation/id which will get us an xmlid
instead.

But the data about related fields are not gotten all at once when
opening the export modal. They are gotten by clicking on the arrow of
the related record.

It is in this data that the /id will be appended for the field, but when
getting a saved export list, this data may not be available.

This commit immediately add the `/id` when a field is put in "Fields to
export" column, so this inconsistency is no more.

closes #10640
fixes #10327
opw-665994
2016-01-28 17:27:18 +01:00
qsm-odoo 94a1536ae1 [FIX] web: o2m pager when empty
Commit 704b3cec9f introduced a bug which led to be on page -1 on
empty o2m. So when adding a record to such a o2m, the reload content
function chose to stay on page -1 therefore not displaying the new
added record.
2015-12-31 10:59:59 +01:00
qsm-odoo a40d48378d [FIX] web: o2m view manager header
Commit b3f3c67eea corrected the o2m view manager template which was
useless in its previous version because of a dead selector. It appeared
that some fonctionnality relied on the fact that this was dead code.

This commit removes the dead code.
Thanks LeartS (see #5711).
2015-12-28 15:24:12 +01:00
Holger Brunn 704b3cec9f [FIX] web: keep o2m current page in correct range
when going through different form view records

For example, when being on page 4 of a o2m then switching to next form
view record, if this new record did not have 4 pages for this o2m, the
o2m was shown empty (and if there was no page, the o2m became unusable)
2015-12-28 14:06:47 +01:00
Leonardo Donelli b3f3c67eea [FIX] web: hiding of o2m view manager header
One2many fields bring in the entire viewmanager widget.
When there is only one view though (e.g. only kanban view for contact
tab of partners), we want to hide the viewmanager header because we
don't need it (it's where the view switcher would go).

Odoo had the widget logic to do that, but it was wrongly implemented,
resulting in a always present oe_view_manager_header div with all
its elements (although empty).
The wrong javascript operation should have triggered a client error
when loading the view, but for pure chance it didn't because the
t-jquery selector was wrong too so the javascript was never evaluated.
2015-12-28 11:03:50 +01:00
Antonio Espinosa 6cdcdb8724 [FIX] web: datejs Spanish long format
From:  miércoles, 04' 4e 'noviembre' 4e '2015 10:48:19
To:    miércoles, 04 de noviembre de 2015 10:48:19

Closes #9910
2015-12-09 08:56:00 +01:00
Denis Ledoux 7f20b79188 [FIX] web: char_domain display translation
The `records selected` could not be translated.
2015-12-08 15:11:20 +01:00
Denis Ledoux 2939800ed4 [FIX] web: char_domain widget re-renders on model change
Before this revision, the `char_domain` re-rendered its display
only when its domain value was changed.

It must re-render as well when the model on which this domain
is applied is changed, as the number of records can
obviously be different.

e.g., in mass-mailing, when changing the recipients type
from partners to leads, the domain doesn't change, it
stays `['opt_out', '=', False]`, but the model on which
this domain is applied does change, as well as the number
of selected records.

opw-658391
2015-12-08 15:11:20 +01:00
Christophe Simonis 83a4a582fa [MERGE] forward port of branch saas-3 up to 513cea6 2015-12-08 12:28:41 +01:00
Christophe Simonis 47b2f7ea9e [MERGE] forward port of branch 7.0 up to 3a1c693 2015-12-08 12:16:00 +01:00
Christophe Matthieu 4d8ec5f931 [FIX] web: readonly fields not transferred from dialog to 2many field
'write_function' transfer the options to 'write' method from the popup form

Steps to reproduce:
1. Create custom model to add a product quantity on hand(readonly) field on stock.move
2. Show this field on Warehouse>All operations>Create a Transfer> Create: Internal Moves
3. Add a Internal Move, then open it again, the quantity on hand field's value show 0. But change the product, the value is correct.
2015-12-02 13:29:51 +01:00
Christophe Matthieu 1cd03ed7fe [FIX] web: one2many set_value must use dataset last_default_get as default values 2015-12-01 13:41:28 +01:00
Christophe Matthieu 0ba248aeda [FIX] web: prevent default value changes
Load record use values as dataset and change object value (for eg: add virtual id in the default value object).
2015-12-01 13:41:28 +01:00
Cedric Snauwaert d179a94da6 [FIX] web: list_view, context when doing name_get call in m2m was not compute correctly
this is a backport of commit fd56268c6ca4e8a6f94f16de9129bd12be87303f
2015-11-26 10:25:15 +01:00
Xavier Morel c6d6ae8aec [FIX] qweb: handle unicode tags and attributes
closes #8895
2015-11-19 14:59:44 +01:00
Thomas Groutars b665478fa7 [FIX] py.js: unhandled prefix `not`
closes #6129
2015-11-19 13:54:26 +01:00
Nicolas Lempereur 15b0596c31 [IMP] web: remove onchange on m2o one remove record
These onchanges were needless since it was already done by the
BufferedDataSet when we use alter_ids to add/remove ids/virtual ids from
the recordset.

The onchanges this commit remove were introduced with 6b907bb4d in
juliet 2012 whilst the onchange in the BufferedDataSet when using
dataset alter_ids was with dd747c096 in october 2012.

closes #8273
fixes #7595
opw-644706
2015-11-10 12:38:04 +01:00
Nicolas Lempereur 3e1d5a5cca [IMP] web: remove needless o2m onchange
Partial backport of master (-> v9) commit 059230512.

for the issue when removing an invoice line from an account.invoice,
three onchange where triggered:

- ListView account.invoice.line unlink the line id from its dataset,
  [[first onchange]]
  -> the line id is removed from the dataset which trigger an onchange

after this is done (and the onchange is finished), the following
onchange happen:

-- remove each record of the Collection of the ListView
   -> this remove the id of these record from the ListView List dataset
      [[second onchange]]
      -> this trigger an onchange albeit the dataset is not changed
         (since it was already removed before the first onchange)
   -> this trigger an onchange on the one2many_list of the ListView
      which has the same dataset as the ListView
      [[third onchange]]
      -> so an onchange is called yet again.

this commit removes the second onchange in this case where we remove ids
already removed from the dataset.

closes #8273
fixes #7595
opw-644706
2015-11-10 12:36:06 +01:00
Nicolas Martinelli ea2c80cad0 [FIX] web: Python-like rounding method
Javascript and Python handle the rounding of -x.5 differently.

In JS, `Math.round(-0.5)` is equal to `-0`.
In Python, `round(-0.5)` is equal to `-1`.

This will lead to inconsistencies between Python and Javascript, but it
can also lead to inconsistencies in the Javascript itself. Indeed, in
the POS, a refund to the client is entered as a negative number. For
example, `4.245` will be rounded to `4.25`, but a refund of `-4.245`
will be rounded to `-4.24`. The payment and the refund are not
consistent.

Sources:
- http://www.ecma-international.org/ecma-262/6.0/index.html#sec-math.round
- https://docs.python.org/2/library/functions.html#round
- https://en.wikipedia.org/wiki/Rounding#Round_half_up

Fixes #9249
opw-653034
2015-11-04 13:14:59 +01:00
Christophe Matthieu ee2b550f3c [FIX] web: radio button display empty value when change record
When a selection field with widget="radio" is False, the form view display the previews value for this field.

1 - Create a selection field (ex: [("1", "1"), ("2", "2")]), and display it on a form vue.
2 - Go to the form view (all the record have False value for this field).
3 - Change the value of this field for one record.
4 - In readonly mode, all other records now wrongly display this value (still False in DB or when "edit").

#opw-652002
2015-10-29 07:21:36 +01:00
Christophe Matthieu 2f842d1703 [FIX] web: assertion error when save after speed multi delete in one2many
To reproduce use a form view with a one2many editable list and create a lot of lines. Then click a few times quickly on the delete.
If the user click at least two times on delete of a same record, the dataset add the id in "to_delete" the virtual id because "to_create" doesn't contains the virtual id of the record deleted previously.

E.g.: create a "Customer Payments" and select a "Customer" and "Payment Method" who generate a lot of "Credits" lines.
2015-10-12 17:15:28 +02:00
Olivier Dony 0f06e5f54f [FIX] tests: outdated resource paths in manual test files 2015-09-18 15:52:11 +02:00
Nicolas Lempereur 1fe932a7bc [FIX] web: css for popup search view float position
The widget SelectCreatePopup display the search view drawer directly
after the search view input field. But in current firefox version this
could lead to an issue with float positionning.

fixes #8462
opw-648999
2015-09-14 12:15:10 +02:00