Commit Graph
9014 Commits
Author SHA1 Message Date
Alexandre Kühn 4f6f562c97 [IMP] base: generic Edit View menu item text in debug mode
With this commit, the menu item for editing a view in debug mode has been
changed.

Instead of "Edit List View", it is now "Edit View: List".

That way, the code is shorter, generic, and translatable.

Exception to above changes: search view, which is unchanged
(it remains "Edit Searchview")
2018-04-10 17:41:12 +02:00
Alexandre Kühn 8dbc1d95c3 [IMP] web: many2one as measure in graph & pivot only when desirable
With this commit, the fields many2one are not always measures in pivot
and graph views. By default, they are *not* measures.

In order to have them as measures, we should pass `additionalMeasures`
as a param to any of the views, which contains a list of fields to consider
as measures.

example:

    Suppose a model with the following fields:

        - `product_id` (many2one)
        - `categ_id` (many2one)
        - `sold` (float)

    By default, only the field `sold` is a measure
    in a graph or pivot view.

    In order to pass `product_id` as a measure of
    a graph view, you should instantiate this view
    as follow:

``
    var viewInfo = /* ... */;
    var params = {
        additionalMeasures = ['product_id'],
    };
    var graph = new GraphView(viewInfo, params);
``

An exception to the rule above is when the many2one field is of type `measure`
in the arch: this field is set as the default measure of the view, therefore
it is implicitly added as an additional measure.
2018-04-10 17:41:12 +02:00
Géry Debongnie 36b4468d15 [FIX] web: prevent crash in graph when grouping/aggregating on m2o
We recently added the possibility of aggregating the graph view on a
many2one field (with count distinct operator).  This is useful, but then
a rare situation could happen: the view could be grouped by the same
field.

In that case, there is a name clash in the read_group, and the result
will be that the [id, nameget] of a m2o field will be used as an
aggregate.

The readgroup method should be improved (its API is a mess), but
meanwhile, we have a solution for this issue: if we group by a m2o, then
it is guaranteed that each group has an aggregate value of 1 for the
same field.
2018-04-10 17:41:12 +02:00
Mathieu Duckerts-Antoine 47395c6e51 [IMP] web: allow using many2one as measure in pivot view
With this commit, we add the possibility of using many2ones as measure.
The way a many2one is aggregated is by using the count distinct
operator.

Some care had to be done to gracefully support the situation when a
pivot view is grouped by a m2o field F, and the same field F is used as
a measure.
2018-04-10 17:41:12 +02:00
Vincent Schippefilt bc1bba446a [IMP] web: keyboard navigation in kanban view
1. Added the ability to navigate within the kanban view using UP,
        DOWN, LEFT and RIGHT keys.
    2. By defaults, the focus should be set on the search input field.
    3. From the search input field, using the DOWN key, the focus goes
        to the first card of the kanban
    4. From the search input field, using TAB key, the focus goes to the
        create button
    5. From the create/import buttons, using TAB or DOWN key goes to the
        first card of the kanban, then UP and DOWN keys moves the focus
        from card to card in the same column or if it is not a grouped
        view from left to right.
    6. In grouped view, LEFT and RIGHT keys moves the focus to the next
        column
    7. When on a card, hitting ENTER opens the view of that card.

Not included in this commit
    1. Memorize the position on the kanban when opening an card, than restoring
        when going back to that kanban
2018-04-10 09:39:08 +02:00
Vincent Schippefilt e0924fd01d [IMP] web: keyboard navigation in form view
1. Added the ability to navigate within the List view using UP and
        DOWN keys.
    2. By defaults, the focus should be set on the search input field.
    3. From the search input field, using the DOWN key, the focus goes
        to the list
    4. From the search input field, using TAB key, the focus goes to the
        create button
    5. From the create/import buttons, using TAB or DOWN key goes to the
        first row of the list, then UP and DOWN keys moves the focus from
        item to item in the list.
    6. When on a row, hitting ENTER opens the view of that row.

Also in this commit
    1. When on the first row, hitting the UP key does nothing
    2. When on the last row, hitting the DOWN key does nothing

Not included in this commit
    1. Memorize the position on the list when opening an row, than
        restoring when going back to that list
    2. Navigation on grouped list using the keyboard
2018-04-10 09:39:08 +02:00
Vincent Schippefilt a4d00a56b6 [IMP] web: auto-assign and show access keys on ALT
This commits aims at adding an accesskey (a shortcut) to all buttons
in odoo. This is done by either by assigning an accesskey in the view
XML or by automatically assigning a key to the buttons using the first
available (not yet assigned as a shortcut key) letter of the text of the
button, failing that we use the latin alphabetical order to find the
first unused key.

Included in this commit:
    1. Using the ALT key, automatically assign
    2. When the ALT key is pressed, show the assigned shortcuts
    3. Assign a number to the menu items (enterprise)
    4. Activate number accesskeys without using SHIFT
    5. Extra logic to support the activation of the alphabetical
        accesskeys without needing to add the SHIFT key in the key
        combination (except for Firefox on linux)
    6. Assign a fixed accesskey to the search field

Not done:
    1. Executing the primary action on dialogs using SHIFT+ENTER
    2. Show the input using TAB on the appswitcher screen

Things to consider:
    1. Fixing more access keys on forms that share the same features
        (b.e. Validate in customer invoice and vendor bills)
    2. Not assigning keys to the chatter section
2018-04-10 09:39:08 +02:00
Vincent Schippefilt 02a063fd73 [IMP] web: keyboard navigation in form view
The goal of this commit is to allow fast entry of the same model using
the keyboard for navigating through the form once, by blocking the user
from advancing in the form if there is a required field or once they
went through the form once to get them to a primary action (button)

This commit includes the following changes
    1) Enable moving forward from field to field using the TAB key
    2) Entering the one to many and many to many using the TAB key
        a. When entering it, set the focus on the "add new line" link or
            button
		b. When adding a new line, set the focus on the field visible
            editable field of the new line
        c. Discard adding a new line with ESC key
        d. If the user leaves the first field empty and uses TAB, we
            will cancel the adding of a new line and move to the next
            field of the form
    3) When a field is required and not filled in, do not allow the user
        to move out of the field using the TAB key (the user is still
        allowed to use the mouse though), mark the field as invalid
        instead
    4) After going though the form once, using the TAB key on the last
        field will move the focus to the first primary button of the page
    5) When the focus is on a primary button (EDIT/SAVE), the user cannot
        move the focus forward using the TAB key. Hitting TAB again will
        display a tooltip telling to hit ENTER to activate the button.
        The mouse is still available to move the focus.
    6) When the user saves, the focus is placed on the first primary
        button of the form renderer (like VALIDATE for a new invoice)
    7) On dialogs, primary buttons should stop the users from moving out
        of them, and showing a popup if the user tries
    8) When closing a dialog, the focus will be moved back to the widget
        that opened it.

This commit does not include the following features
    1) Navigation with the keyboard on a selection one to man
    2) Navigate between tabs in a form using the keyboard
    3) Cancelling the adding of a new line in a many to many using the
        ESC key do not set the focus correctly
    4) Enhancing the focusses fields (like blue underline)
2018-04-10 09:39:08 +02:00
stefanorigano a5a788981a [IMP] web, mail: mimetype icons design
- Redesign all mimetype icons
- use SVG to reduce file size and improve rendering quality.
- Add a data attribute to attachments to detect the file extension (in somes
  cases just mimetype is not accurate)
2018-04-06 14:14:32 +02:00
Mathieu Duckerts-Antoine 5144414a3a [IMP] web: graph views can now aggregate many2ones
The read_group method was recently modified to allow more flexibility.
With this commit, we add the possibility of aggregating many2one fields.
These fields can be aggregating by counting the number of distinct IDs,
directly in postgres.

Also, note that we had to modify the mock server to implement the
corresponding functionality.
2018-04-05 15:59:40 +02:00
Dharmraj Jhala b67331fc18 [IMP] web: Allow user to set custom 'create_text' for x2m fields
For x2many relational fields(of type kanban), we shoud be able to set custom label for
'Create / Add' button by adding 'create_text' node option on particual field from xml.

Right now, 'create_text' is only handled for many2many fields, preventing users to set
custom label for one2many fields.

This commit allows users to set Create Button label for both m2m and o2m fields.
2018-04-05 15:15:07 +02:00
Mathieu Duckerts-Antoine e5b109b422 [IMP] web: update mock server to better match server semantics
The read_group method (from the server) is implemented in the mock
server, to allow easy unit testing in javascript.  However, the
behaviour was not exactly the same: a read_group call on a domain with
no records returns null for aggregates.  But the mock implementation
returned a value of 0.

We fix this in this commit, to allow more precise testing of Odoo
javascript.
2018-04-05 10:33:24 +02:00
Géry Debongnie 19946294fa [DOC] doc: update/add documentation on js framework
The state of the JS documentation was quite sad, not updated in a long
time.  With this commit, we rework a lot of the JS doc.  Most notably,
we add a section 'Javascript Cheatsheet' (help on some common
customization tasks) and rewrite the 'Javascript Reference' totally.

Note that the JS reference page also contains a reference on all field
widgets.

This work is just the beginning, it is probably not complete, but at
least we will have a foundation.
2018-04-05 09:22:09 +02:00
Géry Debongnie d86eb9e1a0 [FIX] web,doc: fix errors that prevented doc from building 2018-04-04 14:11:48 +02:00
Aaron Bohy f5b1d4945c [REF] web: FormRenderer: INNER/OUTER_GROUP_COL params
This rev. extracts two rendering parameters for the groups
corresponding to the default col value to apply (for inner and for
outer groups). This allows to easily override those default values
in extentions of the FormRenderer (for instance, in the renderer
of the new Dashboard view).
2018-04-03 15:19:42 +02:00
Aaron Bohy d4b918f314 [REF] web: BasicView: allow overriding arch parsing
This rev. refactors the way the view's arch is parsed in BasicView,
so that it can be extended specifications of the BasicView to
handle other tagnames that 'field' (which is basically the only
one handled in BasicView).
2018-04-03 15:19:42 +02:00
Aaron Bohy 409e7c18c3 [REF] FormRenderer: renderOuterGroup
This rev. extracts the part of the rendering that renders outer
groups (i.e. groups that contain groups) in its own function. This
allows extentions of the FormRenderer to use it (for instance, the
renderer of the new Dashboard view).
2018-04-03 15:19:42 +02:00
Aaron Bohy 69c9500e35 [IMP] ActionManager: keepSearchView option
This rev. introduces an option to doAction (keepSearchView). If set
to true, the searchView of the current action will be kept and used
by the new action (this only works if there is already an action
with a searchView, and if the new action is stacked over that one).

This is necessary for the new dashboard view.

A better solution would have been to export the state of the
existing searchView, and import it to the new one, but the current
implementation of the searchView doesn't allow to do that easily.
This will be done as soon as the searchView will be rewrote.
2018-04-03 15:19:42 +02:00
Aaron Bohy 5b3cb812be [IMP] web: SearchView: add/remove filter from outside
This rev. allows to add or remove filters to the SearchView from
the outside, and to make it display this new domain. This can be
used by views that trigger domain changes (e.g. this is the case
of the new DashboardView).
2018-04-03 15:19:42 +02:00
Mathieu Duckerts-Antoine 166319fa4a [IMP] web: GraphView: remove hack to render in DOM
The graph view uses the nv(d3) lib to render the graph. This lib
requires that the rendering is done directly into the DOM (so that
it can correctly compute positions). However, the views are always
rendered in fragments, and appended to the DOM once ready (to
prevent them from flickering).

Before this rev., the graph view circumvented this by performing
the rendering in a setTimeout(0), letting the framework append the
widget to the DOM first.

This rev. removes this hack and uses the on_attach_callback hook
instead, which is called when the widget is attached to the DOM.
This ensures that the rendering is always done in the DOM, and we
keep the rendering part synchronous.
2018-04-03 15:19:42 +02:00
Mathieu Duckerts-Antoine 8e017ee296 [IMP] web: add a percentage formatter
This rev. adds a new formatter for numerical values to fieldsUtils.
2018-04-03 15:19:42 +02:00
Géry Debongnie c5c2b4855b [REF] web: put willStart method before start (AbstractField) 2018-03-30 11:26:32 +02:00
Aaron Bohy fce1a799fc [FIX] web: ActionManager: call 'on_attach_callback'
for actions in target='new'. Before this rev., it was only called
on the dialog, but not on the controller rendered inside it.
2018-03-30 07:49:19 +02:00
Martin Geubelle 6676c3b189 [IMP] web: override size attributes in image widget
Size attributes (e.g. `max-width`) are sometimes set in css (i.e. with classes,
see `oe_avatar`).

They must however be overriden if they are specified on the widget.

Example:
  <field name="image" widget="image" class="oe_avatar" options="{'size': [180, 180]}"/>

The `max-width: 90px` set on oe_avatar must be overriden in this case.

Note that the attribute `img_width` and `img_height` have been depreciated as
`width` and `height` are fulfilling the exact same purpose.
2018-03-28 14:02:00 +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
Aaron Bohy ee0605f405 [IMP] web: add sessionStorage service
This rev. adds the 'sessionStorage' service, allowing to write and
read stuff in/from the sessionStorage (with a compatibility layer
to handle the case where the sessionStorage can't be used, e.g.
private browsing in Safari, like it is already done for the
localStorage).

This new service is necessary for the ActionManager to store the
current action, so that it can be fully restored on F5 (this comes
with the next commit).
2018-03-23 09:02:03 +01:00
Christophe Simonis cdbee48888 [MERGE] forward port branch 11.0 up to 39d9c362c5 2018-03-22 20:05:14 +01:00
Toufik Benjaa 4787bc7553 [FIX] reports: Remove dead code for non qweb reports 2018-03-22 15:33:18 +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
Jeremy Kersten 38e339258c [FIX] base: settings view match on label.text
Before this commit, search was broken because containsLike was searching on
the innerHtml. (3dd93ed129)

Settings use _wordHighlighter to change the background of the matching text
into the label, so the label was not only text, but html.

<label><span class="highlighter">Mul</span>ti-company</label>
    : looking for (mul)

After this commit, the match is based on the text content and not on the html.
2018-03-22 11:22:33 +01:00
Vincent Schippefilt 8fe220bf8b [IMP] web : replace jquery selector by native selector
the only goal of this change is not to use a jquery selector on the
body of the document.
Jquery adds an ID attribute to all the nodes it selects. This in turn
triggers the attribute change debugger in chrome, and creates a lot
of noise while debuging.
2018-03-21 14:48: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
Luis González 2835d29979 [FIX] web: Make top bar's menu items navigable when using the keyboard (#23732)
Sidebar's menu items are not currently reachable when using the
keyboard, because they are missing the attribute `href`, thus are not
indexed for tabbing navigation.

This change causes that attribute to be included, so the menu items are
reachable and navigable when using the keyboard.
2018-03-20 10:33:40 +01:00
Luis González baa1c515c5 [FIX] web: Add missing HTML attributes aria-* (#23752)
Some HTML attributes were missing, and are required to ensure good
compatibility with screen readers.

The following attributes are included:
- `aria-expanded`: this should be present in all dropdown menus
- `aria-label`: this should be present in all links and buttons which
  don't show text, but icons or images.
2018-03-20 10:29:17 +01:00
Christophe Matthieu ec199222c3 [FIX] web: ace: no duplicated char with composition (html/css editor)
Before this commit, there was an issue with input method using
composition in which typed characters were duplicated.
This was occuring until the composition ended.

This is a bug specific to Google Chrome v53+.
It has been fixed in the most recent version of ace.js [1],
and we just port the fix into our custom code.

Note that we do not simply import ace.js as a whole, because
we must update lots of custom code at the same time.
We plan to do so in the future.

Fixes #23629

[1] https://github.com/ajaxorg/ace/pull/3116
2018-03-20 09:44:10 +01:00
Alexandre Kühn 71616e8d4f [FIX] web: pick correct menu item on hashchange
Before this commit, we had the following issue:

    1. install CRM and Sales
    2. Sales > Customers > (open any form)
    3. Click on browser's "back" button

We are redirected to the contact kanban view in CRM
instead of Sales.

This is due to the fact that both menu items share the
same action. When the user uses the browser's "back" button
(AKA. it triggers an hashchange event), the web_client opens
the first menu_item that matches the action.

This commit fixes the issue by allowing us to open an action
by providing a menu ID:

    1. If it matches the action, then it opens this menu
       instead of the first match.

    2. If we do not provide any menuID, or this menuID does
       not match with the action, it falls back to the first
       menu matching this action.

Fixes #23639
2018-03-19 15:17:56 +01:00
Alexandre Kühn e2dd31cd7b [FIX] web: set correct menu_id on menu action
Before this commit, the menu_id displayed in the url was incorrect
when we click on a menu item for the first time.

This is due to the fact that the web_client was mistakenly using the
previous menu_id as the action's menu_id: the JS widget menu is not
up-to-date with the value of the current menuID, and the web client
was relying on its internal state instead of the server's response.

With this commit, the web client uses the server's reponse to
register the correct menuID that has been clicked.
2018-03-19 15:17:10 +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
Nicolas Lempereur ceac5d686d [FIX] web: ok mobile kanban w/o o_kanban_small_column
On mobile, kanban view always have its custom "menu" bar to cycle
between grouping if the kanban view is grouped.

But if the kanban view did not have the class `o_kanban_small_column`
the mobile CSS on record was not applied:

- all columns were always displayed one over the other
- switching tab did not hides other columns and show current one
- the style was the same than desktop (but on mobile and with column
  after first "to be loaded)

opw-1827142
closes #23691
2018-03-16 15:23:01 +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