Commit Graph
9669 Commits
Author SHA1 Message Date
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 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
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 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
Martin Trigaux ebc23b594a [FIX] web: display full error message
In case of a MemoryError, there is no error message, the user gets a
"Database restore error: "

without any details.

Instead fallback to the repr.

This way, a wrong password is
"Database restore error: Access denied"
and a memoryerror

"Database restore error: MemoryError()"

Closes #17393
2017-06-06 15:42:37 +02:00
Odoo Translation Bot 9ca236685d [I18N] Update translation terms from Transifex 2017-06-04 07:07:18 +02:00
Odoo Translation Bot 40f8a92d88 [I18N] Update translation terms from Transifex 2017-06-04 04:27:19 +02:00
Odoo Translation Bot c3e282852d [I18N] Update translation terms from Transifex 2017-06-04 00:28:17 +02:00
David Monjoie 2d26ed05a7 [FIX] web: fix handle widget functionality
Also added tests for handle in list view and inside an x2many.
2017-06-02 15:12:55 +02:00
David Monjoie 31f5819724 [FIX] web: fix mock server dropping x2many on update
Previously, when an update operation was performed, the list of
ids in the x2many field was emptied beforehand.

It kinda worked in lots of cases where one would expect it to
fail because in thoses cases the widgets send link_to commands
along with the update one, thus re-adding the removed line.

Now the behavior is more consistent accross the board. We start
with the current list of ids and apply the requested changes.
2017-06-02 15:12:43 +02:00
David Monjoie 6d75ccdb59 [FIX] web: mock server should not catch errors
Otherwise some changes can create rpc errors that are silently caught
and never seen as long as, out of (un)luck, the end result is the same.

Tests which need to create a server error can just simulate it using
the mockRPC mechanism.
2017-06-02 11:06:44 +02:00
Aaron Bohy 719e040dee [FIX] web: Many2One: search with input's value
When the user writes something in a Many2One input, after a short
delay, a name_search RPC is done with the value written in the
input, and results are displayed in a dropdown. Then, if the user
clicks on the input, the dropdown closes. If he clicks again, it
should do again a name_search RPC with the value of the input.
Before this rev., it was doing it with the empty string.
2017-06-01 20:45:06 +02:00
Aaron Bohy 1749ac2cd1 [FIX] web: allow to unset and reset same many2one value
Suppose that we have a many2one which is set (has a value) in
a form view. Before this rev., if the user unset the value (by
erasing the input content in edit mode), and then reset the same
value, the input remained empty, and the old value wasn't actually
reset.
2017-06-01 20:45:06 +02:00
Aaron Bohy 9966e4b333 [FIX] web: don't scroll when navigating in editable list
Problem occured with checkboxes in editable lists: when pressing
up, down, right or left with the focus on a checkbox, in addition
to navigating in the requested direction in the list, the page
scrolled (if there was a scrollbar of course). This was because the
event wasn't 'preventDefaulted'.
2017-06-01 20:45:06 +02:00
Martin Geubelle 1561c5f660 [FIX] web: add o_input class on calendar dialog input
Since the rev 250e716
the class `o_input` needs to be set on an input to be correctly styled.
2017-06-01 13:57:53 +02:00
Martin Geubelle 19cbbb21fb [FIX] web: handle ´domain´ widget rendering without model
When creating a new record where the ´domain´ widget is set in the view
with an associated model but this model field has no value, an rpc
(search_count) was done on an unknown model, that causes a traceback.

To avoid this, the rpc is not done if the model is not set.
2017-06-01 13:23:30 +02:00
Aaron Bohy 2f4d3d0e66 [FIX] web: Graph: don't ignore graph keys in context
Keys 'graph_mode', 'graph_measure' and 'graph_groupbys' can be
specified in the context and must be used by the graph view to
determine the default mode, meadure and groupbys. Before this rev.,
those keys were simply ignored.
2017-06-01 12:02:17 +02:00
Aaron Bohy 033aec0826 [FIX] web: Graph: correctly return graph's context
allowing to properly save the current state (mode, measure,
groupbys) of the view in the Favorites or add it to the dashboard.
2017-06-01 12:02:17 +02:00
Aaron Bohy 2a4a011256 [FIX] web: SearchView: add custom filter on datetime field
Function 'set_value' of datepicker had been renamed to 'setValue'
by commit 5f13b7f. There were still a call to that function that
needed to be adapted in the search filters, so it crashed when
trying to add a custom filter on a datetime field.

It would be nice to add a test for this, but the code of the
SearchView cannot be easily tested yet.
2017-06-01 12:02:17 +02:00
Parth Gajjar d24ea500e6 [FIX] web: basicmodel: properly link parent in m2m
In some cases, the parentID was not properly set, which is a problem
when we need to evaluate the parent in a context.

Note: I also added a better error explanation in the mock server, to
make it better for the developper to see what is wrong.
2017-06-01 11:26:53 +02:00
Olivier Dony 5dd2cc8e63 [MERGE] Forward-port saas-14 up to b9e2207267 2017-06-01 00:37:30 +02:00
Olivier Dony b9e2207267 [MERGE] Forward-port 10.0 up to 7e44444878 2017-06-01 00:15:27 +02:00
Aaron Bohy f9a1241721 [FIX] web: editable list: don't create invalid records
Clicking multiple times on 'Create' (in main list views) or 'Add an
item' (in o2m lists) might create invalid rows (i.e. rows with
required fields unset).

Creating a new record requires two sequential RPCs: a default_get
and an onchange (only if there is an onchange of one of the
record's field). When clicking twice to create a new record, that
sequence of RPCs is done twice in parallel, after unselecting the
current row (i.e. saving it if it is valid). However, in both
cases, there is no line to unselect yet (as both operations are
done basically simultaneously). When the first onchange returns,
a first new record is added to the list. When the second returns,
the second one is added and takes the edition, leaving the first
one, invalid, in the list.

This rev. ensures this doesn't happen by preventing concurrent
record creation.
2017-05-31 20:53:55 +02:00
Aaron Bohy 23613b411f [FIX] web: x2m editable list: wait for onchanges
... before saving a line.

Suppose that we have an editable list with one required field
(e.g. many2one) with an onchange. We add a record and select a value
for the many2one. Before the onchange returns, we click again on
'Add an item'. If we don't wait for the onchange to return before
unselecting the row (i.e. before saving it), a confirm dialog asking
if the changes can be discarded opens, because the line isn't valid
yet. This could easily be reproduced on the sale_order form view,
with some throttling.

This rev. ensures that we wait for the onchange to return before
saving the line, and thus before creating a new line.
2017-05-31 20:53:55 +02:00
Géry Debongnie 5ff7199562 [FIX] web: properly parse float with '.' as thousand_sep
In a slightly too naive way, we apparently tried to improve the
parse_float method while rewriting the new views.  This was done by
using a regexp to match all occurences of a thousand separator.

The way the regexp was built was fine, until the thousand separator is a
'.', which, if used as a regexp, matches all characters.  Also, sadly,
'.' is not so rare as a thousand separator...
2017-05-31 19:31:07 +02:00
Martin Geubelle a5f139a504 [FIX] web: client-side sort of x2many values
When a ´default_order´ is set on an embedded view for a x2many field,
the sort was only applied server-side, after saving the record. After
adding a record in a x2many, the records were thus not correctly sorted.

We reintroduce here the client-side sort after the x2many modification.
2017-05-31 14:10:13 +02:00
Martin Geubelle e116a69f25 [FIX] web: properly handle autocomplete attribute
With the new views, the attribute autocomplete on input was no
longer supported. We simply reintroduce its support in this commit.

The basic attribute values are 'on' and 'off' but one may want to use a
random string.

Note that an input with type='password' is a special case: the autocomplete
attribute should always be set to 'new-password' to remove autocompletion
(autocomplete='off' doesn't actually remove the autocompletion).
2017-05-31 14:10:13 +02:00
Martin Geubelle e3fdce9643 [FIX] web: add parent in context after 'Save & New'
When clicking on 'Save & New' in the form view dialog, a new default record
is created. The parent was not correctly set in this record, which causes an
error if `parent` was used in context.
2017-05-31 14:10:12 +02:00
bluesoft83 aed5563000 [FIX] web: error setting wraparound on undefined
In function _next, sometimes options parameter is not passed, so setting on undefined is causing error.  (PR #15716)
2017-05-30 16:56:51 +02:00
Aaron Bohy 9369afdada [FIX] web: Form: crash when clicking on buttons in dialogs
In view dialogs (e.g. click on the external button of a many2one
in edit mode), the attribute $buttons of the form controller is
undefined (the buttons are rendered by the dialog directly). The
code that (de)activate the buttons to prevent concurrent clicks
made the assumption that $buttons exist, so it crashed when it
doesn't.
2017-05-30 11:08:52 +02:00