Commit Graph
9712 Commits
Author SHA1 Message Date
Christophe Simonis ed2ddeccdf [MERGE] forward port branch saas-16 up to 1b50c829ef 2017-06-15 18:46:47 +02:00
Christophe Simonis 1b50c829ef [MERGE] forward port branch saas-15 up to 9713dc2e1f 2017-06-15 18:44:16 +02:00
Martin Geubelle 0c2e018d4c [FIX] web: display dashboard graphs in full-width
With the new views, the class `o_field_widget` is added on every field widget
and is styled with `display: inline-block`.

The dashboards used to display graphs in full-width so this behaviour is
restored.
2017-06-15 13:22:08 +02:00
Martin Geubelle d88d1abcf0 [FIX] web: reimplement group_by_tooltip option in kanban
This option hadn't been implemented in the new views.
It allows to display informative explanations as tooltips on column over.

It can be set on a many2one field in the kanban view, e.g.:

```<field name="stage_id" options='{"group_by_tooltip":
    {"<tooltipFieldOnStageModel>": "<ABeautifulTitle>"}
}'/>
```

An extra RPC needs to be done on the many2one relation to fetch these additional
fields and the data are stored in the datapoint under the key `tooltipData`.
2017-06-15 13:22:07 +02:00
Martin Geubelle 46751de506 [FIX] web: correctly style o_status class
The `o_status` style has been moved in a previous rev. in `fields.less` which
is only for `o_field_widget` nodes.

This class however is used in other context than a field (e.g. on a label in
the project.task.type form view) so its style needs to be placed at an upper
level.
2017-06-15 10:59:35 +02:00
Aaron Bohy f6525c6b6c [FIX] web: BasicModel: onchanges: send all values
Since commit ebd17217c4, values of readonly fields inside x2many
fields weren't sent for onchanges, whereas they should. This was
for example an issue on the stock.picking form view (which is in
state 'draft' by default). If the user added a stock.move, the
state field on the move wasn't sent for the onchange, and thus the
state field on the picking was set to false.
2017-06-15 08:39:50 +02:00
Aaron Bohy a3bea9a62b [FIX] web: Form: delete the correct record
When the user duplicated a record 'A', and deleted the new record
'A (copy)' directly, the wrong record was deleted: 'A' was deleted
instead of 'A (copy)', because de id of 'A' was bound to the delete
handler, and it wasn't updated after the duplication.

Also correctly updates the record's offset after the deletion, so
that it doesn't produce a warning when deleting the last record of
the dataset.
2017-06-14 10:15:37 +02:00
Aaron Bohy 70624772b2 [FIX] web: Pivot: allow to click on a cell
Before this rev., when the user clicked on a data cell of a pivot
view, it crashed. This was due to several problems, fixed by this
commit.
2017-06-14 10:15:37 +02:00
Christophe Matthieu 83115b2a10 [FIX] web: SelectCreateDialog uses the domain of the view when searching
before this fix: the domain is used when opening the dialog but it is not
used if the user update the filter or the group_by.
2017-06-13 15:47:47 +02:00
Aaron Bohy 708c1c2915 [FIX] web: false id should remain false in evalContext
'id' is a particular field that should not be considered like other
integer fields. For instance, in the evalContext, its value should
not fallback to 0 if it is false. This would break domains in attrs
like ['id', '=', False], which is supposed to be true on new (not
saved yet) records.

This was for example the case in the Product form view: go to Sales
Orders form view, add a line, on the product field choose 'Create
and Edit', try to save the product -> error: field Product Template
is required but not set (actually it is invisible), as its required
modifier says ['id', '!=', False], which was always the case.
2017-06-13 09:26:40 +02:00
Aaron Bohy ebd17217c4 [FIX] web: BasicModel: don't write on readonly fields
Ultimately, it seems that sending the value of readonly fields
when saving is not such a good idea. Suppose that there is a
computed field displayed as readonly in a form view. This field is
computed from other records, e.g. from a one2many field which is
editable in the form view. Finally, the inverse function of the
computed field creates the one2many records. If the user adds some
records to the one2many, then saves, the readonly computed field's
value is sent to the server as well, and thus the inverse function
is executed, which isn't what we want.

This commit essentially reverts 0494d61274, except that we now take
into account the readonly modifier to determine whether or not a
value is sent to the server, and not only the readonly attribute of
the field (which can be seen as a default). Before rev. 0494d61274,
we made a difference between write and create RPCs, for an unclear
reason. We don't do that anymore: readonly fields are never sent to
the server (same behavior as before the new views).
2017-06-13 08:24:59 +02:00
Aaron Bohy 5c4485d182 [FIX] web: Many2one in X2Manys: quick create then save line
A problem occured with a required Many2One inside an X2Many (e.g.
order_line field in sale.order form view). If the user clicked on
'Add an item' to add a row, then typed some text in the Many2One,
then clicked on 'Create ...' to quick create a new product, and
then directly clicked on 'Add an item' to add another row (before
the name_create returned), the first row was discarded.

This was because before the name_create returns, the Many2one still
has no value, and as it is required, the row was considered invalid
and then discarded.

This rev. ensures to wait for the name_create to return before
trying to save the row and to create a new one.
2017-06-13 08:24:59 +02:00
Christophe Simonis a47a95cde0 [MERGE] forward port branch saas-16 up to 76262f2043 2017-06-12 20:41:44 +02:00
Christophe Simonis 76262f2043 [FIX] web: handle correctly deactivation of duplicate option
This new behavior has been introduced by previous forward-port.
2017-06-12 20:10:11 +02:00
Christophe Simonis 50d8ea1d58 [MERGE] forward port branch saas-15 up to aae12c2bad 2017-06-12 19:37:28 +02:00
Christophe Simonis aae12c2bad [MERGE] forward port branch saas-14 up to 62fec71568 2017-06-12 19:19:42 +02:00
Christophe Simonis 62fec71568 [MERGE] forward port branch 10.0 up to fcc33f3e09 2017-06-12 18:55:24 +02:00
Christophe Simonis fcc33f3e09 [MERGE] forward port branch saas-11 up to 6ceecffcad 2017-06-12 18:52:53 +02:00
Christophe Simonis 6ceecffcad [MERGE] forward port branch 9.0 up to d9d455bea3 2017-06-12 18:18:05 +02:00
fwi-odoo b6a08dc982 [FIX] web: hide 'duplicate' action for ir.model.fields
It shouldn't be possible to duplicate ir.model.fields. Add attribute
´duplicate´ which can be set to false to hide the duplication option in the
action menu.
2017-06-12 11:14:55 +02:00
Odoo Translation Bot 5952c394e5 [I18N] Update translation terms from Transifex 2017-06-11 04:27:18 +02:00
Odoo Translation Bot 4dbc9b5472 [I18N] Update translation terms from Transifex 2017-06-11 00:27:53 +02:00
Christophe Simonis 4ae122b1b2 [MERGE] forward port branch saas-16 up to 78dc8f6871 2017-06-09 19:12:08 +02:00
qsm-odoo fc53b91b06 [FIX] web: adapt tests to 3741603495
The datepicker is now forced to be in the <body/>, so the tests had to
search it in there.
2017-06-09 17:55:52 +02:00
Christophe Simonis ab02bf34b0 [MERGE] forward port branch saas-16 up to cc38b93ab2 2017-06-09 17:11:47 +02:00
Christophe Simonis cc38b93ab2 [MERGE] forward port branch saas-15 up to 49f819a7a7 2017-06-09 16:43:27 +02:00
Christophe Simonis 49f819a7a7 [MERGE] forward port branch saas-14 up to b6c7d71899 2017-06-09 16:21:15 +02:00
Christophe Simonis b6c7d71899 [MERGE] forward port branch 10.0 up to cd1a8f6252 2017-06-09 13:28:06 +02:00
Christophe Simonis cd1a8f6252 [MERGE] forward port branch saas-11 up to 1d7260cbcb 2017-06-09 13:08:51 +02:00
Christophe Simonis 1d7260cbcb [MERGE] forward port branch 9.0 up to 77be3d8b39 2017-06-09 12:51:31 +02:00
qsm-odoo e64cf3d606 [FIX] web: temporary re-allow inline modals
Odoo modals are supposed to be instantiated thanks to the Dialog JS
class. This allows to not duplicate modal structures and to properly
handle multi modals (which bootstrap is not supposed to).

Problem since commit 7dcb8fea64:
The support for inline modals has been broken without providing a
solution for all cases. Indeed, some modals are placed directly inside
form view xml. See an example here:
https://github.com/odoo/odoo/blob/dd0533897e397dfd78ad456fea42a5a12db51246/addons/website_twitter/views/website_twitter_settings_views.xml#L24

While waiting for a new way to instantiate these inline view modals,
this commit restores their deprecated support.
2017-06-09 11:36:25 +02:00
xmo-odoo 45e94ec756 [FIX] web: CrashManager can crash if trying to show an empty message
If `d.message` is an empty string, `!!d.message` is false and the
crashmanager will try to display `d.error.data.message`… which does
not exist as it's a warning with an empty message not an upstream error.

That causes the crashmanager itself to crash, and even the warning
name/title to be lost.
2017-06-08 14:16:43 +02:00
Jairo Llopis c4c9347b99 [IMP] web: Expose char_domain dialog widget
This simple return allows submodules to be able to know when a dialog is shown and modify something in it.

Note from GED: I am aware that this is a IMP in a stable version, and I really don't like that... But it looks like it really helps many people, as shown by the PR, and the risk induced by this commit is definitely extremely low, so I will make an exception.
(PR: #15579)
2017-06-08 13:53:49 +02:00
Aaron Bohy 79e4a1f1b1 [FIX] web: ModelFieldSelector: add a way to clear the cache
The ModelFieldSelector keeps an internal cache for the fields_get.
This cache needs to be cleared in the tests environment because
a model with the same name may be defined several times accross the
tests modules, but they may contain different fields.

This could also be a problem with studio: when a field is created,
the ModelFieldSelector cache must be cleared as well (in addition
to the data_manager one).

We thus introduce a new 'clear_cache' event on core.bus. When
triggered, the ModelFieldSelector and the data_manager clear their
respective cache.

We use this event in the test environment to ensure that the cache
is cleared at the end of each test using a mockEnvironment. This
rev. also fixes an infinite loop in the override of destroy() in
the mockEnvironment, which occured when both session and config
were specified in the params.
2017-06-08 11:35:03 +02:00
Aaron Bohy 8648d16e45 [FIX] web: correctly display nocontent helper if create='0'
When the root node of the arch has attribute 'create' set to '0',
the generated DOM element must have classname 'o_cannot_create'.
This is used to correctly display the nocontent helper (when there
is no record).

Before this rev., the helper indicated that the user can click on
'Create' to create a new record, even if the create action was
disabled. This was for example the case in Point of Sale > Orders.
2017-06-08 10:48:31 +02:00
Aaron Bohy 99ae418bf2 [FIX] web: Many2one: wait for name_create before saving
The problem occurred in form views with a many2one field, when the
user reproduced the following steps:
 - type some text in the many2one
 - click on 'Create ...' in the many2one dropdown to quick create
   (name_create RPC) the record
 - before the name_create returns, click on 'Save'.

When this happened, the record was saved before the many2one was
updated with its new value. So the record was incorrectly saved,
and the view was again dirty as soon as the name_create returned,
even if it was in 'readonly'. So after saving, a 'Changes will be
discarded' dialog opened when the user tried to leave the form.

We fix this issue by making the controller wait for the name_create
to return, and for the many2one to update its value, before saving.

This issue could also occur in list views.
2017-06-08 10:48:31 +02:00
qsm-odoo 3741603495 [FIX] web: restore broken datepicker since lib update
There were two main problems with the datepicker since the lib was
updated:
- it appeared broken in the search view "Filters" menu
- it did not overflow the parent which scrolls

Indeed, before the update, the datepicker was placed in the <body/>.
Now this is a lib option. Unfortunately, the option is broken (I don't
know why they broke it since it worked before the lib update...). As the
lib does not expose its internal functions, the only found workaround was
to patch the lib code itself.

opw-745311
opw-745625
2017-06-07 16:09:16 +02:00
Harshad Modi 922a04dbd2 [FIX] project: fix traceback while setting cover image
from project task kanban view (PR #17165)
2017-06-07 10:15:04 +02:00
ppr-odoo ac1fad575e [FIX] web: apply modifiers on separator in FormRenderer
Before this commit, the separator tag ignored all modifiers.
2017-06-07 10:01:33 +02:00
Aaron Bohy 5aa1cf1890 [FIX] web: re-introduce wow effect
When clicking on buttons with classname o_wow (e.g. when marking
an opportunity as won).
2017-06-07 09:25:48 +02:00
Aaron Bohy cb9a8bdc79 [FIX] web: ModelFieldSelector: less tweaks 2017-06-07 08:08:49 +02:00
Aaron Bohy 25e7014650 [FIX] web: Form: correctly autofocus fields
The autofocus worked fine when switching from 'readonly' to 'edit',
but not when clicking on 'Create' from the multi-record view. This
was because in this case, we were trying to focus the field while
the view wasn't in the DOM yet. This rev. ensures that we wait for
the view to be appended to the DOM before trying to set the focus
on the default field.

Also ensures that the first visible field is correctly focused.
Before this rev., if the first field was invisible (or simply
not focusable), no field was focused.

Credit goes to @msh-odoo for the preliminary work.
2017-06-07 08:08:49 +02:00
Aaron Bohy 67747e6fa5 [FIX] web: FieldOne2Many: re-activate 'Add an item'
The 'Add an item' button of one2many editable lists is deactivated
once clicked (since rev. f9a1241) to prevent concurrent record
creation. It is re-activated when the record has been created.
Unfortunately, it might happen that the record is actually not
created, so in this case the button is never re-activated.

This happens for example on the customer invoice form view, if
the user tries to add a line before selecting a partner.
2017-06-07 08:08:49 +02:00
Aaron Bohy e9de309511 [FIX] web: editable list: setRowMode returns a deferred
This function should return a deferred, as indicated in the
docstring. However, in some cases, it doesn't. It then crashed
as the FieldX2Many tries to call done() on undefined.

This happens for instance on the customer invoice form view:
create a new record, select a partner, add a line, select a
product, directly click on the invoice date field (this will
trigger an onchange which will totally override the value of the
one2many). The FielX2Many calls setRowMode to switch the edited
row back to readonly, but this row doesn't exist anymore as the
one2many value has been overriden by the onchange, so setRowMode
wrongly returns nothing, and it crashes.
2017-06-07 08:08:49 +02:00
Aaron Bohy 98142f731d [FIX] web: BasicModel: default_get: fetch x2manys of x2manys
Suppose that a default_get returns the value [[6, 0, [1]] for an
x2many field (i.e. put id 1 in the relation). A read is performed
to fetch record of the comodel whose id is 1. Suppose that there
is another x2many field of the comodel. This x2many has to be
fetched (if not empty), and processed by the BasicModel (i.e. a
dataPoint must be created for it) as well.

Before this rev., the second x2many wasn't fetched nor processed,
and it produced a traceback for example in Expenses app, when
clicking on 'Submit to manager' from an expense form view.
2017-06-07 08:08:49 +02:00
Christophe Simonis 99c34c4119 [MERGE] forward port branch saas-16 up to 6f3eada2c3 2017-06-06 19:38:29 +02:00
Christophe Simonis 6f3eada2c3 [MERGE] forward port branch saas-15 up to f687a27b79 2017-06-06 19:23:03 +02:00
Christophe Simonis f687a27b79 [MERGE] forward port branch saas-14 up to c0e7f9b0b1 2017-06-06 18:57:56 +02:00
Christophe Simonis c0e7f9b0b1 [MERGE] forward port branch 10.0 up to a85790be5c 2017-06-06 18:49:36 +02:00
Christophe Matthieu 1b07daf2ed [FIX] calendar: can create an event with start_date as readonly
Before this fix, if the start field is readonly, the user could not create
an event. With this commit, it is also ensured that the context sends the
right default values to the view
2017-06-06 16:17:30 +02:00