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.
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.
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).
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).
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
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.
- 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.
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).
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
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.
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.
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.
* 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>
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)
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.
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.
... 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.