Commit Graph
108770 Commits
Author SHA1 Message Date
qsm-odoo a52690c26c [FIX] web: mock server was replacing "falsy" values with default ones
When setting a field value to "0", the mock server was replacing it
with the field default value as "0" is a falsy value. Now it only
adds the default values where there is no value at all, as expected.
2017-04-11 19:44:38 +02:00
qsm-odoo c24d1f615c [REF] web: make getContext and getDomain part of dataPoints
Before this commit, the getContext and getDomain functions of a
dataPoint were only available from a BasicModel "get" call result.
As the code is moving towards the creation of a DataPoint class,
these two functions should be a part of the dataPoint itself.
2017-04-11 19:44:38 +02:00
qsm-odoo 49f7a9f657 [REF] web, mail: use field registry in views, not renderers
Before this commit, the AbstractField specialization to use to
instantiate a field was determined in the renderers. Now this is
regrouped in BasicView.

Note: renderers are still left free to not use the determined
Class (like Kanban and not editable List which instantiate widgets
only if the "widget" attribute is present).
2017-04-11 19:44:38 +02:00
qsm-odoo 228e18e81a [REF] web, mail: include evaled field options in datapoint
Field options do not depend on any context/data. They can so be
"computed" once and for all in the BasicView implementation instead
of in the AbstractField's one.

Also, remove the flag __always_reload and leave it be in the
options object (always_reload).
2017-04-11 19:44:38 +02:00
Christophe Matthieu 61b09bbe47 [IMP] web: handle required attributes and modifiers in form view 2017-04-11 19:44:38 +02:00
Christophe Matthieu 513dca4726 [FIX] sale: test depend of another module
It may crash when we install only the sale module
2017-04-11 19:44:38 +02:00
Christophe Matthieu f0cfe7c174 [FIX] web: load missing fields when opening form view dialogs
Problem was that sub form field has usually more fields than the list view in
one2many, so we have to load missing fields
2017-04-11 19:44:38 +02:00
Christophe Matthieu 454b215389 [FIX] web: properly transfer field properties
Before this commit, the field properties (attrs, fieldNames, fields)
were not correctly given to sub views in many case

expected:
* use widget many2many on one2many field
* create record when click on save in formDialog
* do not send create command to the server
* use the fields defined in the field node (instead of tree view fields)
* use the fieldNames instead of the record to get field values
2017-04-11 19:44:38 +02:00
Aaron Bohy 53d8d38f93 [IMP] web: test readonly attr on list field's node
This works since a recent commit, which wasn't designed to solve
this issue, as we weren't aware of it.
2017-04-11 19:44:38 +02:00
Aaron Bohy 3f147cbfa0 [FIX] web: list editable: no flicker when editing
The test checking that the cells width remains the same when
entering the edition mode was broken, because we didn't hardcode
the width for readonly cells.

This commit ensures that we force the width of all the cells of
the edited row.
2017-04-11 19:44:38 +02:00
Géry Debongnie 9fb1228b6c [FIX] web: don't display nocontent helper if no help message
Without help message, it looks silly
2017-04-11 19:44:38 +02:00
Aaron Bohy 2d2e9c93c3 [FIX] web_editor: various fixes and new tests
- use 'nodeOptions' instead of 'options' in FieldTextHTML as
  'options' doesn't exist, it has been renamed into nodeOptions
  in AbstractField.
- mock iframe route in test to prevent the test framework from
  displaying an error (unimplemented route), and so the test from
  being red.
- test that the url given in the node options is correctly used.
- remove useless and broken code introduced by last rebase.
2017-04-11 19:44:38 +02:00
Aaron Bohy 7c04deef5e [IMP] web: test_utils: catch iframe src
Trigger an RPC with the corresponding route so that the arguments
specified into the route can be tested.
2017-04-11 19:44:38 +02:00
qsm-odoo 825cd69dc0 [FIX] web: allow to build a domain from a number
Some views were trying to make fields invisible thanks to
`attrs="{'invisible': 1}"`.
This is not supposed to be valid as an attrs value is supposed to be
a domain and not a number. To make the fields always invisible, use
the "invisible" *attribute*. This also allows the client to make the
fields invisible without any domain computation.

However, to keep supporting those kind of attrs and to be more generic,
the Domain class is adapted by this commit to consider numeric domains
to be valid (numbers different than 0 are considered "true" domains and
0 is considered a "false" domain).
2017-04-11 19:44:38 +02:00
qsm-odoo 6da2e588b1 [REF] web: some linting and documentation 2017-04-11 19:44:38 +02:00
qsm-odoo 0a3012cd79 [FIX] web: ace editor field was not properly saving changes
Two changes were ignored:
- The first change
- The last done undo

This commit refactores the field so that:
- The ace setValue function is called only if the value really changed
  (prevent losing focus / undo stack / retrigger "change" event / ...)
- As the ace setValue triggers multiple "change" events, only consider
  the last one
- Same rendering function for edit/readonly modes
- Only listen to "change" events in edit mode
2017-04-11 19:44:38 +02:00
Aaron Bohy 6cf0273427 [FIX] website: formats has been replaced by field_utils 2017-04-11 19:44:38 +02:00
Aaron Bohy f35a44f265 [IMP] web: re-enable commented tests
That code actually works now...
2017-04-11 19:44:38 +02:00
Christophe Matthieu 23f3d95248 [REF] web: factorise some code in BasicModel
Each data information coming from the server was serialized, and need to
be deserialized in the proper format.  This was done in 3 different
places.
2017-04-11 19:44:38 +02:00
Christophe Matthieu cac00211fe [FIX] web: properly transfer options to SelectCreateDialog
The fields_view option was not transferred, resulting in the wrong form
view opened when trying to create a sub record.
2017-04-11 19:44:38 +02:00
Christophe Matthieu 7a1d7cb241 [FIX] web: allow edition of one2many with widget many2many
It is quite rare, but it happens that a one2many field has to be edited
with a many2many widget: it allows the fact that records are directly
created, and only later linked to the main record.  But the BasicModel
only used the field type to determine which commands it had to send.

In this commit, we introduce a magic flag _forceM2MLink, which, if set
to true, tells the BasicModel to treat the field as a many2many.
2017-04-11 19:44:38 +02:00
Géry Debongnie 86a87aa8b0 [REF] *: use _rpc method for all rpcs
The _rpc method is now the preferred method to do a rpc, so we need to
update all calls.
2017-04-11 19:44:38 +02:00
Géry Debongnie 78c97e6cc4 [IMP] web: remove perform(Model)RPC
and replace them with a new, private, _rpc method.  Also, extends the
rpc builder to be able to send arbitrary parameters.
2017-04-11 19:44:38 +02:00
Géry Debongnie 1ec265eb92 [REF] web: move ServicesMixin out of mixins.js 2017-04-11 19:44:38 +02:00
Géry Debongnie 6cc324513e [REF] *: remove mixins from web.core
It is better to directly import web.mixins
2017-04-11 19:44:38 +02:00
Aaron Bohy aa5700bb7c [REF] account_asset: convert widget to new API
Also change the view template as according to the doc, the widget
attribute is only available for field tagnames.
2017-04-11 19:44:38 +02:00
Aaron Bohy 6448568954 [FIX] web: x2many list/kanban views: action buttons
There is no list (resp. kanban) controller for x2many list (resp.
kanban) renderers embedded in form views. So the action buttons
events need to be handled by the form controller. To do so, we
uniformize the event API of 'button_clicked', but the handler
remains specific in each type of controller.
2017-04-11 19:44:38 +02:00
Aaron Bohy cbfdc36ad0 [REF] account_asset,sale: invisible attr in form view
When the invisible attr doesn't need to be evaluated (e.g. = "1"),
it is better not to specify it within the attrs as they are
automacally re-evaluted at each field changed.

We directly write "invisible=1" instead.

The JS framework supports both, but we encourage the later one.
2017-04-11 19:44:38 +02:00
Christophe Matthieu 53e4765765 [FIX] web: catch image in unit test and convert into performRPC
avoid image not found error in console
2017-04-11 19:44:38 +02:00
Christophe Matthieu 04f1e50ff3 [FIX] web: date value must be parsed to moment object 2017-04-11 19:44:38 +02:00
Christophe Matthieu a9475e14af [FIX] web: basic_model: try to call name_search without name value 2017-04-11 19:44:38 +02:00
Christophe Matthieu ed9f34018a [IMP] account: usability of bank statement reconciliation widget
* add a link to create bank reconciliation model if none is defined yet
2017-04-11 19:44:38 +02:00
Christophe Matthieu 09731b7860 [IMP] calendar change view grammar.
* Remove filter tag
* Use color attribute on the view who add a filter/legend
* Filter is automatically added when 'avatar_field' option is used on a
field tag, and the default template display the avatar.
* Can overwrite the template (add tag template who contains qweb with
<t t-name="calendar-box">...</t>
2017-04-11 19:44:38 +02:00
Aaron Bohy bf320d2a0d [REF] web_tour: use rpc.query helper
+ linting pass
2017-04-11 19:44:38 +02:00
Géry Debongnie 25fecd932a [REF] web, *: remove calls to performmodelrpc
The this.performModelRPc method is deprecated, so with this commit, we
remove some calls.
2017-04-11 19:44:38 +02:00
Aaron Bohy 47ec89d7fa [FIX] point_of_sale: missing return 2017-04-11 19:44:38 +02:00
Géry Debongnie d6089b6b69 [FIX] website_sale_wishlist: remove use of Model
The new way of doing rpc is through the rpc function, the web.Model
module is deprecated, so we need to update all calls.
2017-04-11 19:44:38 +02:00
qsm-odoo 5804ed100e [IMP] web, *: compute contexts and domains from datapoint
This commit tries to refactore the management of contexts and domains
in the webclient.

- Get rid of CompoundDomain: use standard array manipulation to
join multiple domains or use the Domain class (to be improved)
- Get rid of data.js build_domain and build_context methods
- Link this.record to the data point from the basic model for all
fields (not only relational fields)
- Add a getContext and a getDomain function to the basic model
data point (localData element) so that AbstractField implementations
can use them thanks to their this.record element.
- Remove the autocontext binding for field RPCs (see FieldManagerMixin)
2017-04-11 19:44:38 +02:00
Géry Debongnie e574027056 [REF] web,*: remove 'web.model' and 'web.dataModel
Use this.rpc instead of Model object, with web.ajax if necessary.

nb: EventDispatcherMixin include now the custom_events managment instead
of widget
2017-04-11 19:44:38 +02:00
Géry Debongnie 0df9968433 [ADD] web: introduce new RPC framework
With this commit, we introduce a new way to perform a RPC.  During the
history of the Odoo web client, many ways to do a rpc have been
introduced, for various reasons.  Let us mention the Model class (to
perform a call on a specific method from a model, the web.ajax module
(low level primitive), the dataset.call method, the this.rpc method (was
removed at some point), the session.rpc method and maybe some others.

With this commit, we reintroduce the this.rpc method, with  a
'mid-level'  API: not really high level (not automatic domain/context
calculations), but still higher level than direct web.ajax calls.

This new method is intended to replace all other RPCs in Odoo web
client.  Of course, web.ajax will still be available, but it is
discouraged to use it directly.  Using the rpc method means that the
rpcs are done through an event bubbling up, which means that the call is
testable.
2017-04-11 19:44:38 +02:00
Aaron Bohy 00a172b40d [FIX] web: adapt 1a9a082d to new fields 2017-04-11 19:44:38 +02:00
Aaron Bohy 722cb7cd83 [FIX] web: priority widget
Widget has been broken by a rebase, making its test fail.
2017-04-11 19:44:38 +02:00
Aaron Bohy 2e540eb3c1 [FIX] *: apply changes from web_studio
The new views and widgets (at least some of them) first landed
in web_studio (v10), and they we moved later to web, so changes
in web_studio need to be applied in web.
2017-04-11 19:44:38 +02:00
Aaron Bohy 8d2336abb3 [FIX] web: default_get on x2many may return a list of ids 2017-04-11 19:44:38 +02:00
Aaron Bohy 928af2b51f [IMP] web: ajax service: ensure widget is alive
... before resolving/rejecting the deferred once the RPC is done.
Doing this in the ajax service is equal to wrap every rpc with
this.alive() in the former versions.
2017-04-11 19:44:38 +02:00
Aaron Bohy 979d82abe8 [FIX] report: use this.performRPC 2017-04-11 19:44:38 +02:00
Aaron Bohy 5a604cde53 [FIX] web: typo in the event data
With this commit, the handler to call after a do_execute_action
is now correctly executed.
2017-04-11 19:44:38 +02:00
Aaron Bohy d97c50148b [REF] web: less: form view's statusbar
Move the statusbar rules to community as both webclient now
share the same js basecode for the statusbar.
2017-04-11 19:44:38 +02:00
Aaron Bohy 39ac2dd9bf [FIX] sale: adapt sale tour to new views 2017-04-11 19:44:38 +02:00
Aaron Bohy b1bba768f2 [FIX] web: correctly apply changes on relational fields
The relational record may contain relational fields as well.
2017-04-11 19:44:38 +02:00