Commit Graph
1383 Commits
Author SHA1 Message Date
Lucas Perais (lpe) 07435b1104 [FIX] web: correctly display reference field in subview
Have a form view with a O2M.
The model at the 'many' end has a reference field

Have a record of the second model display in a modal
(by clicking on a record in the o2m list)

Before this commit:
The field reference was not filled up
This was because the fields to fetch on the modal creation weren't correctly set.
Obvisouly, it also created problem when trying to change the record on the modal:
spawning tracebacks because the reference field was not present in the local datas

After this commit:
The display of the reference field is as expected both in the original form and in the modal

OPW 1829822
closes #22468
closes #23896
2018-03-28 09:18:07 +02:00
Christophe Simonis 3a537c789a [MERGE] forward port branch saas-11.2 up to 55a14f9ce8 2018-03-27 19:41:30 +02:00
Christophe Simonis 87a0f4dc4c [MERGE] forward port branch 11.0 up to b33d5af4a7 2018-03-27 18:22:18 +02:00
Nicolas Martinelli cafc6c3ae0 [FIX] web: incorrect date in calendar
- Set the OS timezone to GMT-6
- Create a project task with a date deadline on D day
- The tasks appears at D-1 in the calendar

This was supposed to be fixed with 0c0fb63b0d, but actually no.

opw-1815446
opw-1828130
2018-03-26 09:02:36 +02:00
Christophe Simonis 845f4ef7d3 [MERGE] forward port branch saas-11.2 up to 8a7b845353 2018-03-23 10:31:00 +01:00
Christophe Simonis 8a7b845353 [FIX] web: correct forward-port of ef540eb006
Adapt tests and classes
2018-03-23 09:46:46 +01:00
Aaron Bohy 2a6ff8f8e4 [IMP] web: ActionManager: load window actions without id
Actions can be loaded from the state of the url (e.g. when pressing
F5). For window actions, it was working properly if the action id
or a record id (i.e. for form views) was given. In other words,
states like 'model=res.partner&view_type=kanban' couldn't be
loaded.

This can be explained by the fact that without an action id, the
context and domain of the action couldn't be obtained.

This rev. solves this problem by storing the current action into
the sessionStorage, so that important information like context,
domain and name can be retrieved if this action has to be restored
(i.e. if the user refreshes the page).
2018-03-23 09:02:49 +01:00
Christophe Simonis cdbee48888 [MERGE] forward port branch 11.0 up to 39d9c362c5 2018-03-22 20:05:14 +01:00
Lucas Perais (lpe) 8df055b584 [FIX] web: don't loose focus when editing cell in list
Have a list with readonly modifiers on at least one column.
Have the first record of the list be readonly as computed by the modifier
Create and edit a second record
Enter a value in the cell and hit TAB

Before this commit:
The focus on the targetted cell was lost and the rendering of the cell was in mode readonly
This was because the baseMode of the modifier dict was applied to one and only one node (== one column) and hence to *all* the records

After this commit:
The rendering and keyboard TAB navigation works as expected in the list editable
The baseMode concept has been sharpened and each cell now has one

OPW-1816569
OPW-1824979
closes #23809
closes #22859
closes #23436
2018-03-22 22:51:57 -08:00
Luis González ef540eb006 [FIX] web: Make accessible with keyboard the delete button on o2m fields (#23719)
* [FIX] web: Make accessible with keyboard the delete button on o2m fields

Currently, the delete button in one2many fields (trash icon) is not
reachable when using the keyboard, because it's neither a link, nor a
button or any other interactable HTML element, but a `<span>`.

This change causes that button to be an actual HTML button keeping the
same appearance, so it may be reached when using the keyboard.

* [FIX] web: Modify test to expect button instead of span as o2m trash icon

Since buttons to delete records in o2m fields (the trash icon) were
changed from `<span>` to `<button>` to be able to access them with the
keyboard, the test need to be modified so it expect the new element
type and doesn't break.
2018-03-22 12:18:35 +01:00
Christophe Simonis b51f2d38c2 [MERGE] forward port branch saas-11.2 up to 500e3f4970 2018-03-21 11:04:48 +01:00
Christophe Simonis a4a16f3ab6 [FIX] web: correct test to satisfy new class for remove button in m2m lists 2018-03-20 14:20:59 +01:00
Christophe Simonis e0345a4a3f [MERGE] forward port branch 11.0 up to 2835d29979 2018-03-20 11:45:11 +01:00
Aaron BohyandMathieu Duckerts-Antoine e9db6b6d9d [FIX] web: search menus always available
Before this rev., the search menus (Filters, Group By, Favorites)
were lost when the user came back to an action with the
breadcrumbs (e.g. go to My pipeline, open a lead, click on the
Meetings stat button, go back to My pipeline).

This was because the two searchviews shared the same jQuery element
containing their dropdowns. This behavior is there for a long time,
but the bug has been revealed by 7b6056a0, which changes the way
the action manager and controllers interact with the control panel.

Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2018-03-19 08:12:09 +01:00
Aaron Bohy 75802f9afc [FIX] web: ActionManager: concurrent window actions
This rev. strengthens the handling of concurrent actions of type
'ir.actions.act_window' in the ActionManager. In particular, the
two following cases are now handled:

 - execute an action A, its 'load_views' RPC takes a while, during
   that time, execute an action B: A can be dropped, meaning that
   it doesn't need to fetch its data, and thus it should not be
   appended to the DOM (nor appear in the breadcrumbs) ;
 - execute an action A, its 'read' or 'search_read' RPC takes a
   while, during that time, execute an action B: A can be dropped
   and should not be appended to the DOM (nor appear in the
   breadcrumbs).
2018-03-16 08:08:38 +01:00
Lucas Perais (lpe) 61216f116a [FIX] web: add many records in m2m list
Have a model with a m2m (field A)
  this m2m has also a m2m (and displayed as m2m tags in the view) (field AA)
Have a domain on field A, to trigger the search view selection
Click on add an item
Select everything in the modal, making sure that there is more than 40 records

Click on Select

Before this commit:
There was a traceback indicating the local data did not contain records >= 40
This was because the internal data repository was constrained by a limit

After this commit:
We adapt the limit of the local data repository and there is not traceback

OPW 1823400
2018-03-15 15:11:08 +01:00
Géry Debongnie 7287c672f5 [FIX] web: x2m: properly reset limit/offset to initial value
When we discard an element, we want to make sure that the new state is
not corrupted by previous user operations.  In our case, we possibly had
a limit and an offset values modified by the user.

This could lead to unpleasant situations, with incorrect data displayed
on the form view.

Note that this actually fixes a new bug introduced by commit
https://github.com/odoo/odoo/commit/e7fab234201e357da52c3576ad2e8fc9ceee9359
(this is the commit that introduces the tempLimitIncrement attribute)
2018-03-14 17:03:23 +01:00
Géry Debongnie 4586b876f2 [FIX] web: unselect current row before changing page
The issue here is quite simple.  If we are editing a multipage one2many
field, then we click on the pager, we need to properly unselect the
current row.

If we do not do that, then we can enter invalid data.  For example,
assume that there is a readonly field. We click on add, it creates a
(virtual) record with no value for that field.  When we click on the
pager, we select the next page, and bypass all validation.
2018-03-14 17:03:18 +01:00
Géry Debongnie 4fd9db52a2 [FIX] web: prevent issues with pager and x2m and limit
When we are in the process of adding a record, we do not want to update
the pager count.  The reason is that if the user is at the limit (so,
1-40/40, no pager visible), then click on add, there will be a pager
shown with 1-40/41.  Now, imagine that the record currently being added
as a required field, and the user clicks on the pager. In that case, we
need to discard the newly added record (bringing the total back to 40),
then move to next page, which does not exist anymore.

So, to fix this issue, we simply consider that a record being added
does not count, from the point of view of the pager.
2018-03-14 17:03:11 +01:00
Martin Geubelle 7afc5fd6ad [REF] *: put clickable in widget options for statusbar
The widget statusbar was using an attribute `clickable` on the field widget
to define if the statusbar was clickable.

This attribute is in fact not a field attribute but a widget option so it
has been moved accordingly.

Note that a retro-compatibility adapation is done in the field widget.
2018-03-14 09:38:23 +01:00
Aaron Bohy b574104ebc [FIX] web: don't push state of loaded client actions
Loaded actions (i.e. executed from url state, e.g. after an F5)
should not push their state back to the url. This was working fine
of act_window actions, but not for client actions, and this was
causing an issue in Studio as the same mechanism is used to prevent
the main Studio client action from pushing its state into the url
(to keep the state of the edited action in the url instead).
2018-03-14 08:31:39 +01:00
Lucas Perais (lpe) d4c8a7cfb4 [FIX] web: view dialog select among filtered entries
On an editable line with a many2one
Click to create a record
Click on create a record in the many2one
It opens the form view of the object in a modal, which has a many2many list, which choices are domainized
Click 'add an item' on this list
It should open a modal with the filtered choices
Click on any of the existing record

Before this commit:
There was a traceback in JS
That was because the event bubbled up to a parent, when it shouldn't

After this commit:
The whole flow unfolds without errors

OPW 1823205
2018-03-13 14:35:05 +01:00
Priyanka KakadiyaandMohammed Shekha 97fe1f0507 [FIX] web: FormView: handle string attribute on groups
Before this rev., this attribute was ignored for groups containing
sub groups.

Task 1786309
Closes #23514

Co-authored-by: Mohammed Shekha <msh@openerp.com>
2018-03-13 12:51:44 +01:00
Géry Debongnie e7fab23420 [FIX] web: better experience for one2many edition (paged)
A big problem with the o2m edition happens when the user has a full page
(so, in general, 40 records) and click on add.

If the o2m is in editable="bottom" mode (which is actually a really
common usecase), then the next record will be added at the end.
However, since we have a limit of 40, it will immediately go to the next
page.

The effect is even weirder when there is a required field in the tree
view.  In that case, the new record appears correctly, the user can edit
it, then, as soon as the required fields are set, it will immediately
disappear from the current screen.

In this commit, we have a really simple solution: we simply increase the
limit in this case.  An interesting thing is that it is actually temporary:
when the user goes to the next page, the limit is back to its original
value (due to the pager click: it resets the value to what the pager knows).
2018-03-12 13:53:39 +01:00
Aaron Bohy a0b06afcf3 [FIX] web: 'toggle_button' widget in edit mode
The 'toggle_button' widget is one of special field widgets that
can trigger changes in readonly mode (in this case, toggle the
boolean value when clicked). It was working fine in form views in
'readonly' mode, as in this case, the new value is saved directly,
and the form view is re-rendered (a new widget is created with the
new value).

However, in 'edit' mode, the value isn't saved directly (the user
has to click on 'Save' to save the changes), the widget is reset
with its new value, and the reset wasn't correctly handled in this
particular widget.

Fixes #23400
2018-03-12 12:56:00 +01:00
Aaron Bohy 414b1ef781 [FIX] web: scroll to top when using the pager
In multi pages list view, the scroll position is reset to top when
the user switches between pages. This wasn't working if he first
reset the limit, and then switched between pages.
2018-03-10 09:01:46 +01:00
4e204ed223 [IMP] web: restore scroll position
This rev. improves the way the scroll position is restored when
coming back to a view (e.g. open a kanban view, scroll, click on a
record to open it in a form view, go back to kanban using the
breadcrumbs):

 - generalize the scroll position handling from web_enterprise to
   web to make it available in the community webclient as well
 - also restore left scroll position, not only top (especially
   useful for grouped Kanban views with a lot of columns)
 - handle the case where the scrolling area is a sub element of
   the view (e.g. the grouped Kanban view in mobile).

Task 34037

Co-authored-by: Mohammed Shekha <msh@openerp.com>
Co-authored-by: Ankit Sathvara <asa@odoo.com>
2018-03-10 09:01:46 +01:00
Christophe Simonis 0f57bdba72 [MERGE] forward port branch saas-11.2 up to 42659dc70c 2018-03-09 16:25:58 +01:00
Aaron Bohy 0a66ca3909 [FIX] web: ActionManager: push state of loaded actions
Actions loaded from the url are flagged with 'pushState: false', to
prevent them from pushing their state back to the url, thus
producing an infinite loop. However, if the state of a loaded
action changes in the future (e.g. load an action in kanban view,
then switch to a form view), this state should be pushed to update
the url. Before this rev., this wasn't the case.
2018-03-09 08:33:22 +01:00
Christophe Simonis a0aa939d9b [MERGE] forward port branch 11.0 up to fcb48b7241 2018-03-08 19:00:04 +01:00
Géry Debongnie b17ba359db [REF] web,*: introduce the concept of AbstractAction
Before this commit, a client action was simply a subclass of Widget.
This is quite simple, but not really enough for the ActionManager. The
ActionManager needs to handle client actions in a different way that
view actions. Sometimes, it needs to check if a method exists before
calling it.

With this commit, we introduce a new abstraction: the AbstractAction
class, which defines a common API for all actions managed by the web
client.

Note that the API proposed in this commit is just the beginning. We will
introduce other methods in the future, to manage the focus, or the
scroll position, for example.
2018-03-08 16:48:54 +01:00
true-datura 67f67b5124 [FIX] web: 'image_small' field not displayed for non-latin translations
Before this commit, images in kanban view of the Contact app were not displayed
on non-latin languages, such as Russian.

This was caused by the is_bin_size helper that wrongly assumes that a certain
string is not a binary size, although it is (e.g. 64.2 Кб).

This commit fixes the issue by including such strings as valid binary sizes.

Bug found and fixed by @true-datura
Test by @alexkuhn

closes #23526
closes #22519
2018-03-08 14:29:36 +01:00
Aaron Bohy 4f084a2fe1 [FIX] web: ActionManager: F5 on form view in mobile
This rev. fixes two issues with the loading (e.g. after an F5) of
form views in mobile.

First, the form view being not a mobile-friendly view, it opened
the kanban view instead (if there were one defined in the action),
whether it should have kept the form view as they don't diplay the
same things (one is multiRecord, the other isn't).

Second, after fixing the first issue, the main (multiRecord) view
which was lazyloaded when loading a form view wasn't
mobile-friendly so if the user clicked on the breadcrumbs to go
back, he landed on a list view (if the list view was the first view
of the action), whether he should be on a kanban view, which is
mobile-friendly.
2018-03-06 09:13:02 +01:00
Aaron Bohy cdb01d52ea [FIX] web: create favorite filters in dialogs
This is a manual forwardport of rev. b466b3bc60.

Consider the following scenario: open in edit mode a form view
containing a many2many field displayed with widget many2many_tags,
on the many2many field dropdown, click on 'Search More' (it opens
a dialog), and in the dialog, try to save the current search in
the searchview's favorite menu.

Before this rev., it crashed because it tried to retrieve the
action's context (to add to the saved filter), whereas there is no
action in this case.

Actually, the action's context should never been used in this case.
What must be used is the controller's context (this mainly makes
sense for Pivot and Graph views).

Fixes #23293
2018-03-06 09:12:21 +01:00
Aaron Bohy 24904d406c [FIX] web: Calendar: control panel buttons in mobile
In mobile, we want a special 'Today' button to be displayed on the
bottom right corner of the control panel. Rev. ebe58d92 enforces
this by defining less layout rules on the control panel. However,
those rules apply globally, for all control panels, not only in
Calendar views. So it produces undesired behaviors in other views.

This rev. removes the undesired less rules, and instead appends
the 'Today' button in the pager area, which is in the bottom right
corner.
2018-03-05 13:15:08 +01:00
Vincent Schippefilt 02eef78bbd [FIX] web : remove useless reload of failed _callButtonAction
Before this fix, when a _callButtonAction failed, it would reload the model.
After this fix we will not reload if a _callButtonAction fails
2018-03-05 09:33:39 +01:00
Ankit Sathvara 6be9fa3967 [IMP] web,hr: Phone widget is always clickable
With this commit, when a phone number is clicked (in readonly),
 - if voip is not installed, it opens an app according to the user
   choice (e.g. skype), and on mobile, it opens the phone app to
   call the number
 - if voip is installed, in desktop, it opens voip, and on mobile,
   it still opens the phone app to call the number, because webRTC
   is not supported.

This commit also makes the employee form view use the phone widget
for the 'Work Phone' and 'Work Mobile' fields.

Task #30369
2018-03-02 15:45:42 +01:00
Christophe Simonis 36945a5853 [MERGE] forward port branch 11.0 up to c2e878e34c 2018-03-01 19:43:25 +01:00
Géry Debongnie 132137939c [FIX] web: prevent footer from being rerendered
In some cases, the footer in a form view dialog could be duplicated.
The reason was that the form view was rerendered completely, footer
included, by the renderer, out of the formcontroller control (it is the
formcontroller's job to move the footer buttons to the footer).

A possible fix is to work on the form renderer to make it aware that the footer
buttons are expected to be only rendered once, but it has the disadvantage to
be a fix specific to this issue, and any other form view behaviour with some
side effects may have the same issue.

This commit tries to prevent the form view from rerendering itself
completely in those cases. This also has the disadvantage of possibly
not being a complete fix, if some edge cases are missed.  However, I
have the feeling that we still want to avoid rerendering the full view
if possible.
2018-03-01 16:08:22 +01:00
Christophe Matthieu ad57bfd2e8 [FIX] web: mock_server name_search use limit kwarg
We need support the limit arguments for name_search in unit tests.
2018-03-01 13:45:19 +01:00
Christophe Matthieu 7922dcbe48 [FIX] web: increase unit test speed
The method removeSrcAttribute is critical, because each changes trigger
this one. this method must be optimized to the maximum to be the fastest.

Before this fix, removeSrcAttribute method search the image and iframe for
all body nodes instead of search only in the inserted nodes, and the method
are very slow.
2018-02-28 11:55:20 +01:00
Suraj Shukla ebe58d9267 [IMP] web: Calendar: mobile UX improvements
The following tweaks have been applied on mobile devices:

 - remove left and right arrow in control panel
 - enable swipe navigation (instead of left/right arrows)
 - replace 'Today' button by a calendar icon
 - remove static text 'Attendees:' in events
 - shorten header content in week mode to prevent them from
   overlapping
 - ensure that the calendar fits in the screen

Also introduce a mobile test suite for the calendar view.

Task #31449
2018-02-27 12:18:55 +01:00
Aaron Bohy 034c075e7e [FIX] web: default_get returning unknown field
Before this rev., it crashed when trying to create records of the
res.users model. This is due to commit ad1cceb.

The 'default_get' of 'res.users' always returns a value for field
'groups_id', whereas the docstring of 'default_get' states that it
only returns default values for fields given in arguments.

Rev. ad1cceb changed a bit the way the result of 'default_get' was
processed, by iterating over the values instead of over the fields
in the view. So, before ad1cceb, 'groups_id' was simply ignored,
and after, the BasicModel tried to process it and it crashed when it
attempted to retrieve its fieldsInfo, as this field isn't in the
view.

This rev. restores the previous behavior.

Fixes #23303
Fixes #23305
2018-02-26 12:45:10 +01:00
Alexandre Kühn 742ac28a44 [FIX] web: doAction always resolved with the action
Before this commit, doAction returns a deferred that is
resolved when the action is performed (the exact moment
depends of the type of the action).

However, the deferred was not resolved with the action.

This is misleading, hence a traceback in the web_client
when clicking on 'Run JS Tests' in debug mode (enterprise):
after doAction, the web_client should hide the home_menu
depending on the type of the action.

With this commit, any doAction returns a deferred that is
resolved with the performed action.
2018-02-26 09:16:00 +01:00
Aaron Bohy a16013be66 [FIX] web: multi pages ordered o2m with onchange
Let's assume a one2many displayed over several pages with a default
order such that a record, say R, that would normally be on page 1
is actually on another page. Moreover, there is an onchange on that
one2many which converts all commands 4 (LINK_TO) into commands 1
(UPDATE), which is standard in the ORM.

When the first line of the one2many was edited, the record R was
fully loaded, whereas it shouldn't have been (as it is not on the
current page). So basically, a useless read was performed.
Moreover, if there was an x2many field in the one2many list, a
crash occurred because relational data of R that shouldn't have
been read wasn't postprocessed by the BasicModel.

The useless read occurred because the one2many subrecords weren't
correctly sorted before checking if some of them/some of their
fields should be read. This is not the case anymore.

OPW-1816800
2018-02-26 08:14:08 +01:00
Christophe Simonis a0d7763e09 [MERGE] forward port branch saas-11.2 up to 932e641be1 2018-02-23 17:20:52 +01:00
Christophe Simonis 932e641be1 [FIX] web: remove tests related to removed feature
`Archive` feature has been removed with e5330857b7
2018-02-23 16:26:18 +01:00
Aaron Bohy ad1cceb4fb [FIX] web: one2many and onchange corner case issue
Let's assume a one2many list view inside a form view, displaying
a single char field A. There is an onchange on the form view
returning a command 0 (CREATE) for the one2many. The command 0 only
specifies a value for field A. The one2many list isn't editable, so
when a sub-record is clicked, it is open in a form view (in a
dialog). In this form view, an x2many field B is displayed in a sub
list or kanban view.

Before this rev., it crashed when the user tried to open the
created one2many sub-record (returned by the onchange) in the form
view, because of the presence of the x2many field B, which wasn't
correctly processed by the BasicModel (its value was undefined,
whereas it must be a valid, empty, dataPoint).

Moreover, the limit of the x2many field B wasn't set, so a pager
was displayed as soon as it contained at least one record.

Fixes #22050
2018-02-23 10:01:39 +01:00
Alexandre Kühn 89e2679f08 [FIX] web: tests: turn patchWindowGetSelection stateless
test_utils.js contains helper functions, which should be stateless
(good practices). This was not the case with patchWindowGetSelection
and unpatchWindowGetSelection, so instead we keep only the first
function which returns the second one.

From the test POV, instead of this:

    utils.patchWindowGetSelection();
    // ...
    utils.unpatchWindowGetSelection();

It now looks like that:

    var unpatchWindowGetSelection = utils.patchWindowGetSelection();
    // ...
    unpatchWindowGetSelection();
2018-02-22 14:23:03 +01:00
Alexandre Kühn 9445d2f04d [FIX] web: hide nocontent helper in grouped kanban with no column
Before this commit, the no content helper was displayed in grouped
kanban without any column.

It should be hidden, because the user expects to have a button to
create a task, which is intentionally hidden in this case.
(To sum up, the user is expected to create new columns before being
prompted to create new tasks)
2018-02-22 14:23:03 +01:00