Commit Graph
108828 Commits
Author SHA1 Message Date
Christophe Matthieu 8f7a445a03 [IMP] web: simplification use loadViews instead of loadFieldView
Don't need to create a dataset to call loadViews
2017-04-11 19:44:38 +02:00
Aaron Bohy 64dd7d5443 [IMP] web: rpc: more permissive API for read_group
This rev. allows to specify some kwargs of read_group directly in
an Object given to kwargs(), instead of explicitly specify them
using the corresponding method (e.g. to specify the context in the
kwargs instead of by calling .withContext().
2017-04-11 19:44:38 +02:00
Aaron Bohy f7a8c1b276 [FIX] web: rpc: call route: don't override given params
When calling a route using the new RPC query builder (e.g. by
doing "this._rpc('/a/route').params({a: 'a'}).exec()"), if one of
the route kwargs was 'model', 'method', 'args' or 'kwargs', the
given value was overriden by undefined.
2017-04-11 19:44:38 +02:00
Aaron Bohy d75a7b850a [FIX] web: Kanban: allow cancelling a quick create 2017-04-11 19:44:38 +02:00
Aaron Bohy fc08507fdb [REF] web,*: convert Kanban widgets to new style
The remaining widgets were KanbanRecord and the two quick create
widgets. Now, all kanban files have been converted and refactored.
2017-04-11 19:44:38 +02:00
Aaron Bohy 8986428709 [FIX] web: test_utils: get_session fallback
The session can me mocked in the test environment (if a session
is given in the params). However, when it is not, it crashed
if one of the instantiated widgets requests the session with
getSession().

This rev. adds a fallback so that when this happens, the real
session (web.session) is given.
2017-04-11 19:44:38 +02:00
Aaron Bohy 9a3a402f5e [REM] hr_recruitement: remove useless files
The sass/css rules didn't apply (.openerp).
The JS redirects the kanban record clicks to a click on an element
that doesn't exist anymore.
2017-04-11 19:44:38 +02:00
Aaron Bohy 740a2b1265 [FIX] web: BasicModel: keep state of groups on reload
The 'isOpen' state of groups was already kept when reloading a
(e.g.) list view. The limit and offset should be kept as well.
2017-04-11 19:44:38 +02:00
Aaron Bohy 9ba78dfcce [FIX] web: reload view with correct params
When reloading a view by clicking on its icon in the view switcher,
some params of the view (e.g. limit) were reset to their original
value. So if the user previously updated that param (e.g. by
editing the pager), these changes were lost.

This rev. ensures that those original params are only given to the
view at its initialization, but not on reload.
2017-04-11 19:44:38 +02:00
Aaron Bohy d7fdff572f [FIX] web: grouped list view: group's pager
Before this rev., there was no pager rendered in groups that
contain more than 'limit' records.
2017-04-11 19:44:38 +02:00
Aaron Bohy 5fb2d32ef2 [IMP] web: MockServer: handle limit and offset
in _mockSearchRead
2017-04-11 19:44:38 +02:00
Aaron Bohy b2006c9940 [IMP] web: pager: disable edition if pager is disabled
When the pager is disabled, the user can't go to the next or
previous page. It shouldn't be able to manually edit the pager's
values neither.

Also
  - converts pager.js to the new JS coding guidelines
  - adds two tests
2017-04-11 19:44:38 +02:00
Aaron Bohy 357090428b [FIX] web: rpc: handle offset arg
Even if specified when building the rpc query, the offset wasn't
given in the arguments of the performed RPC.
2017-04-11 19:44:38 +02:00
David Monjoie 82bb35cf79 [ADD] web: add monetary widget tests 2017-04-11 19:44:38 +02:00
David Monjoie 859f11c740 [REF] web: extract _prepareInput from _renderEdit of InputField.
One might need all the preparation stuff that InputField does on
its input but might need something else as its tagName and handle
the input differently.

This commit gets the input preparation code out from the rendering
part of the widget so one can render a widget the way he likes and
call _prepareInput on his input.

This is used in monetary field which requires all the feature of
InputField but with the input actually being one level deeper in
the DOM than the standard InputField.
2017-04-11 19:44:38 +02:00
David Monjoie e17dd719cf [ADD] web: add monetary field documentation 2017-04-11 19:44:38 +02:00
David Monjoie 4eb2245c5d [ADD] web: add phone widget tests and documentation 2017-04-11 19:44:38 +02:00
David Monjoie d218902af5 [ADD] web: add email widget tests and documentation 2017-04-11 19:44:38 +02:00
David Monjoie 90a9a32a91 [ADD] web: add handle widget documentation 2017-04-11 19:44:38 +02:00
David Monjoie 868bcc90ba [ADD] web: add text field documentation 2017-04-11 19:44:38 +02:00
David Monjoie a47c342b9e [ADD] web: add float_time field tests and documentation
The functions for parsing and formatting float_time were completely
duplicated between field_utils and basic_fields.
2017-04-11 19:44:38 +02:00
David Monjoie c22b85dd73 [ADD] web: add float field tests and documentation 2017-04-11 19:44:38 +02:00
David Monjoie 93d09397af [ADD] web: add integer field tests and documentation 2017-04-11 19:44:38 +02:00
David Monjoie 8992b7751c [ADD] web: add boolean field tests and documentation 2017-04-11 19:44:38 +02:00
David Monjoie c7e4ffad4f [ADD] web: add date and datetime fields tests and documentation 2017-04-11 19:44:38 +02:00
David Monjoie 4126c31fda [ADD] web: add char field tests 2017-04-11 19:44:38 +02:00
David Monjoie 86963b5844 [ADD] web: add input field documentation 2017-04-11 19:44:38 +02:00
David Monjoie ef2d5c06ca [IMP] web: mock web.config in place like session
Some fields react differently depending on the values in web.config.
For example, the phone field will display a clickable phone link if
it detects a small screen (e.g. a smartphone) but won't do it on a
bigger screen.

To be able to test fields which react differently depending on the
values in web.config, we need a way to mock it. To do that, we
modify web.config in place with the value given for the test, and
we put back the original config when the field widget is destroyed.
2017-04-11 19:44:38 +02:00
David Monjoie 38300a9bb8 [FIX] web: prevent onchanges from re-rendering the current field
Input fields should not be re-rendered by the onchange mechanism
as they might exhibit formatting that you do not want to have when
typing.

The list view was not propagating the original event to the lower
functions like the form view does, so I added it there.
2017-04-11 19:44:38 +02:00
David Monjoie 160dd6a7e6 [FIX] web: apply digits option from view on float fields
Previously, only the value in the python description of the field
could be used.
2017-04-11 19:44:38 +02:00
Aaron Bohy 6e1875ac7e [FIX] web: MockServer: read_group __domain
read_group returns a __domain for each group, which is the
conjunction of the domain given for the read_group with the domain
matching the given group.

The MockServer didn't reproduce that behavior.

Moreover, the BasicModel did again that conjunction, leading to
domains with redundant subdomains.
2017-04-11 19:44:38 +02:00
qsm-odoo e1b68dae50 [FIX] web, *: fix domain building without CompoundDomain
* board, google_spreadsheet

Commit 8e0c7ccc77f358601b0701536fcb33842ca324a6 got rid of the
CompoundDomain class but did not adapt the code correctly.

- Domains have to be concatened, not regrouped in a big array
- String domains have to be converted to array
- "OR" joining must normalize subdomains first (add explicit "AND"s)
2017-04-11 19:44:38 +02:00
Aaron Bohy f738edb1d6 [FIX] web: list view: right align integer cells 2017-04-11 19:44:38 +02:00
Aaron Bohy b1cb25353b [FIX] web: BasicModel: list count when grouped
Before this rev., the count attribute of list dataPoints was
basically the length of the data Array. It means that for an
ungrouped list, it was the number of records in the list, and for
a list containing groups, it was the number of groups.

This caused a problem in the list view with nested groups, as the
counter in the group header is supposed to display the number of
records in the group, whether or not the group contains other
subgroups or directly records.

This commit changes a bit the semantics of the count attribute,
such that it always represents the number of records inside the
list (i.e. the sums of records inside subgroups if the list is
grouped).
2017-04-11 19:44:38 +02:00
Aaron Bohy 322b850ab6 [FIX] web: KanbanModel: don't allow nested groups
Nested groups is only for list views. In kanban, only the first
grouping level is taken into account.
2017-04-11 19:44:38 +02:00
Aaron Bohy 378d6813ff [IMP] web: list view: nested groups
Before this commit, only one level of groups was supported in list
views. This commit enables the nested groups support.
2017-04-11 19:44:38 +02:00
Aaron Bohy e21c73305f [FIX] web: list view: reload only once on sort
Before this rev, the list view was reloaded twice when the user
clicked on a column header to sort the records.
2017-04-11 19:44:38 +02:00
Aaron Bohy 1e9b695ef1 [FIX] web: BasicModel: always reload x2many fields
Before this commit, the relational data of a record was only
fetched once, and then retrieved from the cache.

This was premature optimization, that can lead to bugs as those
relational data displayed in the webclient might be desynchronized
with the actual data in DB.
2017-04-11 19:44:38 +02:00
Christophe Matthieu ce36786038 [FIX] web: _buildOnchangeSpecs must return only the present fields
Before: the method '_buildOnchangeSpecs' returned all fields, but some
models like 'res.users' have redefined the fields_get and add some fake
fields which cause a crash.
2017-04-11 19:44:38 +02:00
Christophe Matthieu 5e91027a86 [FIX] web: form view must load views for x2many without inline tree arch
* Load views before loading data.
* Load the view used by the mode (by default use kanban for mobile)
* Add attribute useSubview on the widget to load view of the related model
2017-04-11 19:44:38 +02:00
Aaron Bohy 6e6b6ab5f7 [FIX] web: FieldMany2one: focus() is public
The focus() method of the FieldMany2One was private (named
_focus()), but it is called by from outside by the
FieldMany2ManyTags (which called focus(), so it produced a
traceback).
2017-04-11 19:44:38 +02:00
Aaron Bohy 0111882af1 [FIX] web: BasicModel: recursively fetch x2manys
Before this commit, x2many fields embedded in x2many fields were
not fetched. This was for example the case for many2many_tags in
one2many fields.

This commit enables the recursive fetch of x2many fields.

There is still a missing piece, as the list of fields to fetch for
those embedded x2manys is still unknown. This will come in a
future commit.
2017-04-11 19:44:38 +02:00
qsm-odoo 942074557b [REF] web: remove useless resetOnAnyFieldChange option
AbstractField specializations were given an option that allowed them
to tell the system they need to be informed of any change which
occurs in the view (thanks to their reset method).
This is not useful anymore as the new _fetchSpecialData system does
the job a better way.
2017-04-11 19:44:38 +02:00
qsm-odoo 07c581975c [REF] web: use specialData system in domain field
The domain field needs two pieces of information that traditional
fields do not have without extra RPCs and computation: the value of
another field in the view to know the model to use and the number of
records matched in this model with the current field value. While the
first one can be retrieved synchronously by the field widget, the
second one required an extra RPC during the rendering phase.

The `_fetchSpecialData` system introduced in the `BasicModel`
implementation allows to stop doing this extra RPC during rendering.
As the RPC requires the model value to be done, the information
is also fetched by the `_fetchSpecialData` code and given directly
to the widget.

This also removes the utility of the `resetOnAnyFieldChange` option
used by this field widget.
2017-04-11 19:44:38 +02:00
qsm-odoo eb5d65cda7 [REF] web: factorize the special data cache saving code
The _fetchSpecialXXX methods all save values in the _specialDataCache
variable associated to a given record and fieldName. This code is
being regrouped in a private function now.
2017-04-11 19:44:38 +02:00
Aaron Bohy d4fdbad99a [REF] web: kanban: adapt code to new style
This commit adapts some kanban files to the new style and
guidelines.
2017-04-11 19:44:38 +02:00
Aaron Bohy c369b6ec2c [REF] web: kanban: split function _render_ungrouped
This function has to be split, so its behavior can be modified b
the kanban editor (in studio).
2017-04-11 19:44:38 +02:00
qsm-odoo 9636e05bf0 [FIX] web: use correct domain when fetching status values
The m2o choices that a status field works with are determined using the
associated domain. If the current value is not matched by this domain,
the current value should still be visible so the domain is
automatically extended to match this current value. The problem is that
the current value in edit mode or in create mode is not given by the
`data` attribute of the associated datapoint. Indeed, user changes and
default get are stored in the `_changes` key and it is those values
that must be used if they exist.
2017-04-11 19:44:38 +02:00
qsm-odoo 26f91c429c [FIX] web: cannot debounce prototype function of Widget
The `_onClickStage` method of the `FieldStatus` was debounced. This can
be done but not directly on prototype functions because they are shared
between each instances (just called with different `this`). This does
not produced any bug because there never are two instances of this
class which are used at the same time in the web client. The problem is
however present when trying to make tests as clicks on different
statusbar buttons in two different tests were filtered by the
debouncing.
2017-04-11 19:44:38 +02:00
Géry Debongnie aa371a3eff [IMP] web: various small improvements to mock server
* args are json stringified, so we can see in the log what exactly is
  going in the mock server
* better handling of unset fields.  Before this commit, if a field was
  missing in a record, and no default value was set, it was undefined.
  With this commit, it is set to false.  It is important, when we are
  working with domains such as ['some_many2one', '=', false]
* improve read_group so it can group data by day/month
2017-04-11 19:44:38 +02:00