Commit Graph
8774 Commits
Author SHA1 Message Date
Christophe Simonis cb50970f3f [MERGE] forward port branch 11.0 up to eefe879a37 2018-01-25 15:41:45 +01:00
Martin Geubelle 2d3ecf29b3 [FIX] web: handle nested x2m default values
A `default_get` for a x2many field can return a new list of commands for one of
its x2many field, like

[[0, 0, {
    'groups_id': [[6, 0, [1, 2, 3]]],
}]]

where [1, 2, 3] is a list of existing ids.

This use case was not correctly handled by the BasicModel because
`_makeDefaultRecord` was not recursive.

Closes #22401
2018-01-24 10:59:45 +01:00
Nicolas Lempereur 070babf7e2 [FIX] web: css long word breaking out kanban tile
When words are too long this may break out of a kanban tile and getting
everywhere.

This is not wanted and the content should be:

- hidden if overflown or
- long words should be wrapped or
- too long content should be ellipsed

The ellipsis is probably the best but this would affect the current
behavior (we would have to specify a max-height which unexpectedly
may be bothersome to currently existing data).

So breaking long words has been choosen in this change.

opw-806278
closes #22435
2018-01-23 11:04:40 +01:00
Aaron Bohy f68ad51520 [FIX] web: honor action's groupBy on reload
Let's assume an action with a 'group_by' specified in its context.
Unless another groupby is specified in the search view, the action
groupby must be used. For list views, it was only working for the
first rendering of the view. As soon as it was reloaded, the action
groupby was lost.

For instance, go to Project, click on a project in the dashboard
[the action has 'group_by': 'stage_id' in its context], switch to
list view [the list is correctly grouped by 'stage_id'], reload by
clicking on the view switcher -> the view isn't grouped anymore.

It was actually working by chance on other views because they have
specific handling of the groupby (e.g. the kanban view allows the
attribute 'default_group_by' on its arch), but by default, the
action groupby must always be used at each load/reload if there is
no other groupby specified.

This rev. restores the behavior of saas-15, before the new views.
2018-01-22 19:59:23 +01:00
Christophe Simonis fa1f2132e7 [MERGE] forward port branch 11.0 up to 950d9b2369 2018-01-22 17:47:32 +01:00
Nicolas Lempereur bb833825f2 [FIX] web: set default you/all option flipped
In 60d9f6fe the ir.default replaced uses of ir.values.

But the [ir.default].set user_id has opposite meaning to
[ir.values].set_default for_all_users.

This was not taken into account when adapting javascript in 791152a87
and this commit fixes that.

opw-805871
closes #22437
2018-01-22 17:40:56 +01:00
Aaron Bohy ca323c51b2 [FIX] web: Kanban: quick create in folded column
With attribute 'on_create="quick_create"' on the arch's root node,
kanban views open the quick create widget in the first column when
the user clicks on 'Create' (in the control panel), if the view
is grouped and if there is at least one column. However, this
column may be folded.

Before this rev., the quick create was inserted into the folded
column, which didn't look amazing. This rev. first toggles the
column before inserting the quick create.
2018-01-22 08:32:57 +01:00
Christophe Simonis 2f95cfb8ed [MERGE] forward port branch saas-16 up to f99c4f2b48 2018-01-19 12:43:58 +01:00
Lucas Perais (lpe) 56052dee60 [FIX] web,board: a kanban button action should trigger that action
Before this commit, when having a kanban within a dashboard and clicking on an action button,
the action was not triggered, instead, the board form view triggered 'save' on the board model
leading to a server side traceback

After this commit, the action button triggers the demanded one and only this one.

OPW 805707

closes #22191
closes #22371
2018-01-19 11:26:52 +01:00
Aaron Bohy ac0e452890 [FIX] web: Kanban: create several records on slow network
Before this rev., it crashed when the user used the quick create
to create several records (very quickly, or on a slow network),
e.g. on crm.lead (there must be a date field on the kanban record
to reproduce the crash).

The crash occurred when the 'read' RPCs for the created records
return misordered. For instance:
  1) 'name_create' record 1 (called and returned)
  2) call 'read' for record 1
  3) 'name_create' record 2 (called and returned)
  4) call 'read' for record 2
  5) 'read' for record 2 returns
  6) 'read' for record 1 returns

At step 5, the kanban column was updated with the new state, but
this state already contained record 1, which wasn't fetched yet.

This rev. ensures that the created records are added to the state
once they are fetched and ready to be displayed, not before.
2018-01-19 09:57:41 +01:00
Nicolas Lempereur b8c8eaa02f [FIX] web: error image when no kanban image
Introduce back part of `formatBinary` that was reverted with 7813a8e7.

When an image is unset, the value was `false` which would end up with a
bin_size of `NaN Bytes` which would end up displaying an error image
with source `data:image/png;base64,NaN Bytes`.

This commit get back a previous behavior so the bin_size when the
attachment does not exist is an empty string (so: '').

opw-805542
closes #22348
2018-01-18 15:53:37 +01:00
Géry Debongnie 1bb6887bb6 [FIX] web: fix crash when creating record with too many default values
When creating a record with many default values, it could happen that
the number of ids returned by the default get (or onchange) exceeds the
limit for the form view.

For example, we can see the issue in the expenses list view.  We can
increase the limit in the pager, to a value higher than 40.  Then,
clicking on select all, then on 'Submit to manager' in the action menu
will result in a traceback.

The Submit to manager action will trigger a new action with a context key
'active_ids' with a large number of ids.  After that, the web client
will execute the server actions, which will return a new action with a
context key 'default_expense_line_ids' with a bunch of ids.  Then, it
will attempt to create a form view.  This will call the
makeDefaultRecord method in the basic model.  This method will generate
the commands for the one2many, for all ids, but will only load the 40
first sub records.  After, it will attempt to apply the onchanges, with
some code that assumes that all operations of type 'ADD' correspond to a
local datapoint.

In this commit, we fix the code to properly work with operations of type
ADD with a res_id, but with no id. In that case, we simply generate a
command 'LINK_TO', since the value has not been changed.

opw 804370
2018-01-18 14:13:34 +01:00
Géry Debongnie ca2060048e [FIX] web: fix issue with multiple pages and relational fields
When fetching x2manys in a x2many, the basic model did not properly sort
the internal data structure before fetching the data.  This is usually
not an issue, except when we have an order which is different from the
order of the res_ids.  In that case, it can cause crash in some
conditions, because the results from the fetchx2manybatched were applied
to the wrong datapoint.

To reproduce this issue, some specific conditions needs to be met. I
think that it is easier to refer to the test, instead of trying to
explain that.

In this commit, we properly sort the data at the correct place. Note
that this probably solves a bunch of other related issues, caused by the
fact that the internal structure was corrupted.
2018-01-17 14:26:37 +01:00
Alexandre Kühn 290e247e82 [FIX] web: remove dead code
Cleaning dead code from these commits that have been reverted:

41fe7f9d1113d026b226b136b4477aaaf9f1f638#diff-54fd886cc58f994ad518ee72df4d3edeR50
2a5488619da22cfd901963dd141e722b195e82ab#diff-f96b339a9374f74489f1f98755e9787bL9253
41fe7f9d1113d026b226b136b4477aaaf9f1f638#diff-86d6d41b5bb7499bf055258d05549d59R3111

With these final changes, we hope to stop the many issues that have occured with
binary fields, from these commits:

255e8ca3d9
7813a8e714
41fe7f9d11
2a5488619d

What remains is the format of binary fields in list views without widgets,
which shows the bin_size instead of the base64 string representation...

... Rest assured, the computation is in JS, so there are no 'bin_size'
shenaningans!
2018-01-17 11:23:23 +01:00
Alexandre Kühn 2a5488619d [FIX] web: disable {bin_size: true} on binary fields
Revision on 41fe7f9d11

This commit intended to reduce the network load when reading records with
binary fields. This was made possible by enforcing the contextual key
`bin_size` to be set for records with binary fields.

However, it is causing some issues (see #22222, #22231) which are:
    - write with bin_size:true generates a traceback
    - read/search_read with bin_size:true breaks some images
      on some views (e.g. base.view_partner_form)

Since the problems outweight the gain of these changes, we revert them.
2018-01-15 10:03:14 +01:00
Christophe Simonis 56974322f8 [MERGE] forward port branch 11.0 up to 3b80a059ff 2018-01-12 19:03:00 +01:00
Christophe Simonis b42b9c936b [MERGE] forward port branch saas-16 up to 3b7bf3a4b8 2018-01-12 18:15:23 +01:00
Christophe Simonis 3b7bf3a4b8 [MERGE] forward port branch saas-15 up to 8962b8ecc2 2018-01-12 17:23:10 +01:00
Christophe Simonis 8962b8ecc2 [MERGE] forward port branch saas-14 up to d35a76ee17 2018-01-12 16:47:12 +01:00
Christophe Simonis d35a76ee17 [MERGE] forward port branch 10.0 up to d76237e038 2018-01-12 16:16:51 +01:00
Alexandre Kühn 41fe7f9d11 [FIX] web: contexts on field widgets + enforce bin_size for binary
Field widgets now have a key 'context' that let them
extend the context of the dataPoint (e.g. list).

In particular, widgets on binary fields enforce the contextual
item {bin_size: True}, so that the server gives the size of the
binary field as its value, instead of its content.

This change on binary fields reduces network load when accessing
a view with binary fields.
2018-01-12 16:12:49 +01:00
Alexandre Kühn 7813a8e714 [FIX] web: binaryfile field in list views
Revert partially 255e8ca3d9

Removed widget 'download_link', as it was a sub-version of widget 'binary':
it did the exact same thing (representation of binary fields by means of a download link)
in a much better-looking way (download icon + filename as text of the download link,
instead of just a download link with text "Download").

Also, the values of binary fields might be already a human-readable binsize (e.g. 2.52 MBs),
instead of its plain textual string representation in base64:
The contextual parameter 'bin_size', when set to true, does not download the data of binary fields.
As a consequence, the server provides the sizes of the binary, instead of their value.
2018-01-12 16:12:49 +01:00
Christophe Simonis d76237e038 [MERGE] forward port branch 9.0 up to 26d3b77a1d 2018-01-12 15:32:15 +01:00
tbe-odoo d5e97eab8b [FIX] web: Kanban image not showing in some languages
- In some languages the kanban images are not displayed because of a bug in human_size method in JS.

This method translates the Unit Size for data and strip with the string with a comma as separator.
When the translatation contains spaces after the commas (like in the French translation), there is extra spaces in the final result.
This then cause an issue with the method is_bin_size that expects a unique space between the value and its unit.
Resulting in a bug in the method 'kanban_image'.

opw #804973 #804970 #804648
2018-01-12 12:05:56 +01:00
Aaron Bohy 90279c70eb [FIX] web: quick create in empty grouped kanban views
For kanban views with attribute 'on_create="quick_create' set on
their root node, clicking on 'Create' in the control panel should
open the quick create widget in the first column if the view is
grouped and if there is at least one column displayed.

It was working as expected, except when there were no record yet.

This was because the kanban controller used the 'state.count'
attribute of the state (which indicates the total number of records
in the group), whereas it should have used 'state.data.length'
(which is the number of columns).
2018-01-12 08:13:15 +01:00
Aaron Bohy 25b101f15b [FIX] web: Kanban: quick create several records in a row
Before this rev., when quick creating a record in a grouped kanban
view, the quick create widget wasn't automatically re-opened, which
didn't allow the user to quickly create several records in a row
(without clicking each time on the '+').

This desired behavior had been broken by rev. 1d34e26, which aimed
to properly reload the kanban column when a record was created
(e.g. column counter, progress bar...).
2018-01-12 08:13:15 +01:00
Géry Debongnie 27dd19c0b9 [FIX] web: prevent crash in some rare cases
When we have a form view with a one2many with an onchange, and with
lines which contains a x2many, and more lines that the limit (so more
than one page), and the read is not in the same order as what is
displayed because we have a widget=handle, then we might have a problem
when we delete one of the lines, if the onchanges tries to change the
x2many.

This is due to the fact that the order of the basicmodel datapoint is
not preserved by the various operations going around.  I think that we
may still have a few other issues of this type, but it is actually quite
difficult to establish.

In any case, this situation is now properly handled.

opw 804530
2018-01-11 16:30:34 +01:00
Nicolas Martinelli 411a9fa326 [FIX] web: autofocus
Support autofocus on notebook pages:
```
<page autofocus="autofocus">
```

This was supported before the web client refactoring.

opw-801259
2018-01-11 15:19:52 +01:00
Christophe Simonis 228ecdbe28 [MERGE] forward port branch 11.0 up to ff0abd214c 2018-01-10 11:41:35 +01:00
Christophe Simonis a7c2a22310 [FIX] web: adapt new test introduced by previous forward-port 2018-01-09 17:58:06 +01:00
Christophe Simonis 6e25eb9b05 [MERGE] forward port branch saas-16 up to 4c410ee6a1 2018-01-09 17:03:07 +01:00
Martin Trigaux 4637bdf9bf [FIX] web: properly format translatable string
'Edit <type>View' makes untranslatable content as it is split in 3 and the type
is not translated. e.g. 'Editer FormVoir'
2018-01-09 11:23:18 +01:00
Alexandre Kühn 255e8ca3d9 [FIX] web: binary field format in list view
Binary fields were simply shown simply by their textual representation in list views,
e.g. the base64 string.

There was no formatter for binary fields, therefore it has been implemented so that
it displays its estimated size.

Binary fields in list views had a download link in v10.0.
We provide this feature back by means of a widget called 'download_link'.
It is also possible to define an option to set the field name having the filename as its value.

Example:

    <tree>
        <field name="fname"/>
        <field name="datas" widget="download_link" options="{'filename': 'fname'}"/>
    </tree>

with the following record: {fname: 'document.txt', datas: 'Cg=='},
we get a file named "document.txt" by clicking on the download link.

Closes #21996
2018-01-08 10:17:44 +01:00
Aaron Bohy bd2e783d30 [FIX] web: DebugManager in dialogs
For actions executed in dialogs (target='new'), a DebugManager
is instantiated and appended to the dialog's header (div with
classname 'modal-header').

However, in the full composer dialog (in a chatter, click on
'Send message', and then click on the expand icon), there are
more than one element matching the selector '.modal-header',
because it also occurs in the html generated by summernote.

In this case, the widget's $el is cloned and appended to each
element of the JQuery nodeset matching the given selector, but
widget.$el only refers to one of those. So when it isn't the one
appended in the real dialog's header, the debug manager remains
empty as the widget isn't able to populate it correctly.

This bug appeared with rev. 5f1ef09, as before it, the debug
manager was appended to the dialog before its content.
2018-01-08 08:23:02 +01:00
Christophe Matthieu d4982394bc [FIX] web: speed resequence up in x2m
Resequencing a x2m is very slow because the view is reloaded after each
change instead of only once after all the changes.
2018-01-05 17:34:26 +01:00
Christophe Matthieu 73e2ba991c [FIX] web: add a stableSort method for sorting x2m
Issue: create 60 lines in ordered x2many with the same value (0) for the order
field and make a change ; the displayed records will be switched.

The problem appears because the sorting function is not stable and the
records with the same values can change place (hence change page), which is
quite disturbing for the user.
2018-01-05 17:34:25 +01:00
Christophe Matthieu b7ee1aa4b1 [FIX] web: sort and onchange in tabbed editable x2m
Two attempts of dealing with sorting (and resequencing) in tabbed (multi-pages)
x2many editable lists (see odoo/odoo@c2563db and odoo/odoo@983c7ae) have been
previously done, using a static attribute (`keepChangesUnsorted`) on the
datapoint.

This solution sadly only covers both cases separately, not if they are combined.
Morever, onchanges were not correctly managed in neither of these two cases.

A new approach is used here, by "freezing" and "unfreezing" the datapoint when
needed, which is more flexible.

Some modifications have been introduced:
 - when ordering a x2many, all records are now considered (and not only the
   records on the current page) ; an additional read is thus done on the sorted
   field for all records in the x2many relation
 - `setSort` is now asynchronous as a `read` might be needed
2018-01-05 17:34:25 +01:00
Géry Debongnie 1efc9d0b5e [FIX] web: transfer attributes to subnodes in list views
In many cases, we allow class and style attributes in the arch of a
view.  However, it did not work in a list view, and there is not really
a good reason for that (only cost is a few runtime checks).

So, with this commit, we allow those attributes in list views (and
x2manys obviously).

However, note that there is a subtle (maybe slightly confusing)
behavior: when a list renderer is in 'readonly' mode, it does not
actually instantiate any field widgets.  In that case, it optimizes the
rendering by putting only the formatted value inside a cell:

<td>some value</td>

So, in that case, the only valid target for the attributes is the td:

<td class="hello">some value</td>

But when we are in edit mode, we actually have a field widget inside a
td:

<td><input>some value</input></td>

And in that case, the natural home for the attributes is the field
widget.  This is quite important, because this is the way attributes are
done in the form view, and we do not want different behaviour.

<td><input class="hello">some value</input></td>
2018-01-05 14:42:55 +01:00
Nicolas Lempereur bc8f7a44d6 [FIX] mail,web: adapt email in m2m tags b92aaf1
Adapt commit b92aaf1 for framework changes in saas-16.

That commit made Many2ManyTagsEmail widget display name_get gotten
dynamically. This allow to have 'show_email' context key working and
having the email displayed.

This commit use the new views (as of saas-16) to do the same change.

opw-801558
fixes #21812 fixes #21523
closes #21969
2018-01-04 18:09:56 +01:00
Nicolas Martinelli 38e73da092 [IMP] web: support variable digits
In v10, a `Float` field with `widget="monetary"` option uses the decimal
precision of the field. In v11, however, it uses the decimal precision
of the currency. However, in many cases `widget="monetary"` is used in
the sole purpose of displaying the currency symbol. The precision of the
field sould be kept.

This commit introduces the support of the decimal precision of the field
for this specific use case thanks to the `field_digits` option:

```
<field name="pouet" widget="monetary" options="{'field_digits': True}" />
```
If such an option is used, the field precision will prevail over the
currency precision.

Related to #21686
opw-800279
2018-01-04 11:32:04 +01:00
Stéphane Bidoul (ACSONE) bb10cd50c2 [FIX] web: issue with id field in x2m form
When the 'id' field is present in a x2m form, the x2m actions generated
on create of the parent object are incorrect.
2018-01-03 13:22:09 +01:00
Christophe Simonis 362f0489d0 [MERGE] forward port branch 11.0 up to fe22a0f9ca 2018-01-03 12:28:52 +01:00
Goffin Simon 0e943241fe [FIX] web: rotate graph label
When there are too many labels to display on the x-axis, they overlap
and it simply becomes unreadable. By slightly rotating them, this can be
avoided in most cases.

Back-port of this commit 388e258ce8

opw:802925
2018-01-03 09:40:23 +01:00
Christophe Simonis f02ed9ab9a [MERGE] forward port branch saas-16 up to 0af13af5de 2018-01-02 16:54:38 +01:00
Sanjay Jamod a8527a16b6 [FIX] web: Fix column_invisible issue (#21693)
[FIX] web: Fix column_invisible issue

This commit fixes an issue with the column_invisible attribute.

When we choose product variant for BOM for any particular product, 
at that time from the BOM Lines column "Apply on Variants" is hidden,
but when we unset product variant from BOM Form, 
at that time the column 'Variants" set to visible. but in this case, it is set to hidden always.

PR 21693, OPW 779555
2018-01-02 16:37:35 +01:00
Christophe Simonis 0af13af5de [MERGE] forward port branch saas-15 up to ddd293065e 2018-01-02 15:36:25 +01:00
Christophe Simonis ddd293065e [MERGE] forward port branch saas-14 up to ba2a83ddfa 2018-01-02 15:02:26 +01:00
Christophe Simonis ba2a83ddfa [MERGE] forward port branch 10.0 up to e336dc38ca 2018-01-02 13:56:49 +01:00
Christophe Simonis e336dc38ca [MERGE] forward port branch 9.0 up to 62aa3be24c 2018-01-02 13:20:04 +01:00
qsm-odoo 9a42dff490 [FIX] web: LESS 1.4.2 compatibility
Broken with https://github.com/odoo/odoo/commit/23e6dd36d7477f13fe42fdcaae890ffb690d05a4

Indeed CSS guards are used while LESS 1.4.2 only supports mixins guards.
2017-12-29 15:29:56 +01:00