Commit Graph
580 Commits
Author SHA1 Message Date
Siddarth GajjarandMohammed Shekha c75c2fa9e3 [IMP] web: add a badge based widget for selection fields
This commit introduces a new widget to be used for selection-based fields.
Valid choices are displayed using rectangular badges and not like the
standard list. This widget is valid for selection and many2one fields
like selection or radio widgets.

Co-authored-by: Siddarth Gajjar <sga@odoo.com>
Co-authored-by: Mohammed Shekha <msh@openerp.com>
2018-05-30 15:39:15 +02:00
Christophe Simonis e008ef302a [MERGE] forward port branch saas-11.3 up to 53300648ed 2018-05-30 12:18:52 +02:00
Christophe Simonis c2c9a60466 [MERGE] forward port branch saas-11.2 up to a2f275dfc4 2018-05-29 21:05:26 +02:00
Christophe Simonis a2f275dfc4 [MERGE] forward port branch 11.0 up to 4ea3838d89 2018-05-29 20:00:31 +02:00
Christophe Simonis f36e6917bd [MERGE] forward port branch saas-11.3 up to 37eed7c509 2018-05-29 17:34:43 +02:00
Martin Geubelle 66ccc6503d [IMP] web: correctly handle attributes on non inline view
Before this rev. the `column_invisible` and `default_order` attribute, set in a
x2m list view were only taken into account for inline views.

The technical reason behind is because non inline views are fetched after the
main view processing.

Non inline x2m list views now correctly handle these two attributes.
2018-05-29 15:55:05 +02:00
Lucas Perais (lpe) 94a7bef5db [FIX] web: domain evaluation in parented m2o in o2m list
Model A has a o2m to model B
Model B has a m2o parent_id on B

In A's form, add a B item,
then in the m2o, create record
Save and New
Click on the m2o

Before this commit, the python crashed on name_search.
This was because we sent the virtual ids to it

After this commit, there is no crash

OPW 1850212
closes #24948
2018-05-29 13:44:23 +02:00
Lucas Perais (lpe) 9654f6b8e0 [FIX] web: o2m editable decorated, paged, ordered supports adds/cancel
Have a decorated (conditional on field) editable list, with a default_order.
Have more records than the pager allows.

Add an item, and hit escape to cancel addition.

Before this commit, the cancellation crashed because the first record on the other page
was trying to evaluate the decoration for its row, which is wrong in the first place.
This was because creating a record increases the limit of the list, to be able to see the record
being created.
At cancellation though, that limit was never decreased.

After this commit, the whole flow happens without problem.

OPW 1844495
closes #24682
2018-05-28 17:25:51 +02:00
Christophe Simonis 37eed7c509 [MERGE] forward port branch saas-11.2 up to 58e3552246 2018-05-25 14:34:18 +02:00
Christophe Simonis 2bc6ea1b37 [MERGE] forward port branch 11.0 up to 02ee3fd88e 2018-05-23 19:33:40 +02:00
Alexandre Kühn c587c0029b [FIX] web: only abandon records on discard without savepoint
Revision on https://github.com/odoo/odoo/commit/9a9da5763b38a3bce54e9c4870af0032e38cacc3

The intent of the commit above was to no abandon records in a list on
discard when these records have been created from a `default_get`.

Also, the `default_get` may also perform an `onchange` that could create
more records. The records from this `onchange` must also be included in
the "do not abandon" rule.

However, the rule was too relax, so that any following `onchanges` from
a user interaction was also considered into this rule. As a result, it was
not possible to abandon such records.

With this fix, we restrict the rule to `default_get` (already the case) and
only the `onchange` right after a `default_get`. Any record created on an
`onchange` from a user interaction after a `default_get` should be abandoned
on discard.

Representation of creating the list:

                               savepoint
   |----------|-----------|-------||--------|------->
 create   default_get  onchange1         onchange2

record in the list is created by default_get or onchange1
    => do not abandon on discard
record in the list is created by onchange2
    => abandon on discard
2018-05-23 09:43:12 +02:00
Alexandre Kühn 8ac98fc78a [FIX] web: show names of many2one on default_get
Before this commit, some records in a list did not show the name of their
many2one fields.

This case occurs when the records in the list are created from a default_get,
and the records do not fit in a single page. In that case, the records in the
first page correctly display the names of their many2one fields, but not the
records in the other pages.

Fixes #24547
2018-05-18 17:30:34 +02:00
Alexandre Kühn 6f7031e9fb [FIX] web: pass unique ids on name_get rpc
Before this commit, when a list contains records with many2one fields that
contain the same values, duplicate ids were passed to the server on rpc
`name_get`.

For instance, if 40 records in a list refer to a Unit of Measure with id "1"
whose displayed_name is "unit(s)", the server receives a long list of ids with
simply the value "1". Also, the server responds with a list of displayed_name,
in this case a list of 40 strings "unit(s)".

With this commit, we always pass unique ids to the server on rpc `name_get`.
2018-05-18 17:30:34 +02:00
Christophe Simonis 644f0959d0 [MERGE] forward port branch saas-11.2 up to 1655202924 2018-05-17 14:23:37 +02:00
Christophe Simonis 1655202924 [MERGE] forward port branch 11.0 up to 59a8a1cd8e 2018-05-17 13:19:49 +02:00
len-odoo 25548eb7e9 [FIX] web: sort relational fields by their names
When sorting records according to a many2one field in a list view
embedded in a form view, the js would sort according to their ids,
in a seemingly arbitrary order.
Thus sorting records according to a field with values in ("a", "b", "c")
could be sorted as "a", "a", "c", "b" instead of "a", "a", "b", "c".
We make the comparison on the name of the field instead.

opw 1838860
2018-05-16 08:04:53 +02:00
Christophe Simonis 5a751fa200 [MERGE] forward port branch saas-11.2 up to aae54ecc15 2018-05-09 15:45:20 +02:00
Christophe Simonis 013ce7f889 [MERGE] forward port branch 11.0 up to f2e105eeca 2018-05-08 19:08:18 +02:00
Mohammed Shekha 2bd92cc581 [FIX] web: use correct href in link for m2o
With a better href, many2one in readonly mode  can be opened in new tab.

Related to task: #32919
2018-05-08 14:46:17 +02:00
Christophe Simonis ac63dfc8f4 [MERGE] forward port branch 11.0 up to 8dade01e2c 2018-05-04 16:10:50 +02:00
Aaron Bohy 6e15a9cd24 [FIX] web: one2many form view with action button
Assume a one2many field inside a form, displaying field A in its
list view, and a field B in its (dialog) form view. Moreover, there
is an action button in the dialog, which updates the value of B.

Before this rev., B wasn't correctly reloaded when the button was
clicked, because the BasicModel reloaded the fields on the list
view (i.e. field A), whereas it should reload the fields in both
views.

This fix is twofold. First, we force the viewType to 'form' when
the record is reloaded, instead of the default ('list'), so that
fields in the form view are correctly reloaded. Second, when we
open the form view in the dialog, we add the fields of the list
view to the dict of fields of the form view, so that the form
is aware of those fields and can ask the model to reload them
(still without displaying them).

Fixes #24189
2018-05-04 10:42:05 +02:00
Christophe Simonis ad802d0d55 [MERGE] forward port branch 11.0 up to c591e0de7d 2018-05-03 11:21:42 +02:00
Nicolas Martinelli f536592691 [FIX] web: inline views should share their fields
This causes issues (already 3, and counting...)

This reverts commit 27c9f838d3.

opw-1840984
opw-1841041
opw-1841000
2018-05-03 08:30:55 +02:00
Christophe Simonis 87e21ccdc5 [MERGE] forward port branch 11.0 up to 521414b1c1 2018-05-02 19:36:16 +02:00
Lucas Perais (lpe) 27c9f838d3 [FIX] web: inline views should share their fields
Have a One2Many
The views of that o2m define two inline views: the list and the form

in the list view, put a field that isn't in the form and used in a domain
Try to add an item to the list
The form pops up

Fill in the data and save & close

Before this commit:
It crashed when evaluating the domain on a field using the field that is not in the form

After this commit:
Subviews share their fields in a special object on the parent record
In our case, the form view checks in that shared resource if the fields it is supposed to initialize
are there.
Hence, this flow doesn't crash anymore

OPW 1837511
closes #24350
2018-05-02 11:09:50 +02:00
04c44c479d [IMP] base(_import),web: mute Add/Create button in x2m
... by setting it 'btn-default', because users hesitate between
that button, and those in the control panel.

Task 32950

Co-authored-by: dbh <dbh@odoo.com>
Co-authored-by: aab-odoo <aab@odoo.com>
2018-04-25 15:09:35 +02:00
Christophe Simonis b192431aee [MERGE] forward port branch saas-11.3 up to ec5e27bb7c 2018-04-24 17:42:41 +02:00
Christophe Simonis 1f22b81203 [MERGE] forward port branch saas-11.2 up to 7113b70762 2018-04-23 19:36:25 +02:00
Christophe Simonis e8bf128318 [MERGE] forward port branch 11.0 up to 3ab25b60bc 2018-04-23 18:15:25 +02:00
Christopher Ormaza 30490cae89 [FIX] web: handle nested x2m default values
The initial rev. odoo/odoo@2d3ecf2 that was supposed to handle this use case
was in fact only dealing with one command as default value for nested x2m, not
more.

The basic model can now handle multiple commands.

Closes #24241
2018-04-23 17:35:03 +02:00
Christophe Simonis e56be854ab [MERGE] forward port branch saas-11.3 up to 204935119d 2018-04-19 11:58:44 +02:00
Christophe Simonis c309ccd7b3 [MERGE] forward port branch saas-11.2 up to fed775bc0c 2018-04-18 18:30:35 +02:00
Christophe Simonis fed775bc0c [MERGE] forward port branch 11.0 up to 8c64159b88 2018-04-18 18:20:40 +02:00
Aaron Bohy 05589db823 [FIX] web: don't ignore required attrs on image fields
Before this rev., falsy image fields could be saved even if they
were required.
2018-04-18 17:40:09 +02:00
qsm-odoo 1a007c1a96 [REF] *: stop mentioning "LESS" where this is not required
* web, web_editor, website, im_livechat
2018-04-18 15:59:07 +02:00
Martin Geubelle cd934f307d [FIX] web: handle x2m commands with reference as default
Before this rev. it was not possible to define a value for a reference field
in x2m commands as default value.

Courtesy of @kaerdsar.

Closes #24070
2018-04-17 15:31:33 +02:00
Martin Geubelle 9e6c616130 [FIX] web: focus select in reference widget
In the reference widget, the focus was always on the input (many2one) even
though the first select (with the model) was not set.

Thanks to @kaerdsar for the original PR.

Partially closes #24070
2018-04-17 15:31:32 +02:00
Christophe Simonis 5dca782100 Revert "[FIX] web: remove &shy; when saving phone number"
This reverts commit b8b0f947bf.
2018-04-16 20:26:21 +02:00
Christophe Simonis 74033eb007 [MERGE] forward port branch saas-11.2 up to 90f8f17fb4 2018-04-16 19:50:50 +02:00
Christophe Simonis 5f2d080cf8 [MERGE] forward port branch 11.0 up to ad825b673b 2018-04-16 18:34:56 +02:00
Nicolas Lempereur b8b0f947bf [FIX] web: remove &shy; when saving phone number
When Odoo display a phone number number, on phone or if VOIP is
installed a invisible `&shy;` character was added from 9.0 up to
saas-11.2 so an applications such as skype would not be concerned with
the number.

But if someone copy-pasted from this to somewhere else in Odoo, we would
get incorrect number with this invisible caracter. So this change make a
special case for the "FieldPhone" so the character is removed from data
saved.

opw-1834858
closes #24223
2018-04-13 15:35:33 +02:00
Aaron Bohy 52cd52e624 [FIX] web: BasicModel: default_get on o2m with date field
Before this rev., a crash occured when a default_get returned a
command 0 (CREATE) for a one2many, with a value for a date(time)
field (e.g. [0, false, {some_date_field: '2018-12-08'}]). This
was because the related values (inside the commands) weren't
parsed. This only impacted date and datetime fields, for which the
parsing converts the string into a moment instance.

Fixes #23672
2018-04-13 14:59:48 +02:00
Lucas Perais (lpe) 8e5156938a [FIX] web: o2m list with field datetime from server
Have the create_date field displays on a one2many list
Try to add a record onto the list

Before this commit, when the virtual record is added onto the list
it crashes because the datetime field is undefined and cannot be parsed

After this commit, It doesn't crash though the value would have to wait the save on the main record
to be updated (because it is the create_date)

OPW 1834250
closes #24097
2018-04-13 13:41:39 +02:00
Aaron Bohy 9c1c2c55c2 [FIX] web: one2many: add new record with 'Save & New'
Consider the following scenario involving a one2many list (non
editable) inside a form view:
 - click on 'Add an item', a model opens,
 - fill the fields and click on 'Save & Close',
 - reopen the freshly created record,
 - maybe make some changes (this is optional, but makes sense),
 - click on 'Save & New',
 - fill the fields and click on 'Save & Close',
 -> the second created record isn't added to the list.

The problem comes from the fact that when the dialog is opened for
the second time (in this case by clicking on a record), the 'save'
handler registers an 'UPDATE' command. While this is correct for
the 'Save & New' click (as we update an existing record), this
isn't for the second record which doesn't exist yet, and thus
requires an 'ADD' command.

This rev. ensures that the two cases are handled in the 'save'
handler given to the dialog.

OPW 1829723
2018-04-12 14:37:35 +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
Christophe Simonis 860dfb5586 [MERGE] forward port branch 11.0 up to d277adf4d5 2018-04-06 15:36:10 +02:00
Alexandre Kühn 9a9da5763b [FIX] web: no record abandon on discard from default_get/onchange
Before this commit, when some records were created from an `onchange`,
we have the following weird behaviour:

    Suppose that this record has some required fields that are empty.
    When we click on this record, then somewhere else, the record
    disappears from the list.

This is because the records contains invalid fields, and it is wrongfully
assuming that the record to be discarded comes from "Add an item".

A previous commit [1] fixed a bit this issue with `default_get`, but since
it relied on a fragile heuristic, we decide to apply the correct fix with
this commit.

[1] https://github.com/odoo/odoo/commit/b09f0c99be2b13d33986414485556d87da186d65
2018-04-05 17:14:57 +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
Rémi Rahir f1a884e046 [FIX] web,account,google_calendar: correcting previous commit
corrects error added in c3d1eda017 .
Non-breaking spaces were explicitely added in the tests. This commit
restores the proper behaviour.
2018-04-03 18:05:52 +02:00
Rémi Rahir c3d1eda017 [FIX] web,account,google_calendar: chasing breaking spaces
Before this commit, some breaking spaces were present in the js code.
Such spaces are misinterpreted and worked by luck.

This has become a problem with exported js bunldes (e.g. the
external_lib bundle in im_livechat).

This commit replaces breaking spaces by regular spaces.
2018-04-03 15:52:17 +02:00