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.
The FieldDate widget did not properly select the correct default value
when opening the datepicker. We did not notice it, because the test
hardcoded the february month.
We share the basic model record between views, and we have to make sure
that everything is properly coordinated. The main issue solved by this
commit is the fact that we can now edit a one2many record, then close
the dialog, then edit it again and finally cancel the changes, which
bring us to the previous step.
Also, we had to slightly improve the AbstractView API
Date and Datetime values are stored as moment instances, not
strings. This wasn't the case after an onchange, and it thus
produced a crash as we tried to call the format method on a string.
The onchange route returns field values, but it can also return
a warning, that needs to be displayed in a dialog. When it does,
the new values must be applied anyway, which wasn't the case
before this rev.
We generalized the 'warning' custom event handled by the webclient
so that it can display a warning in a dialog (and not only through
the NotificationManager).
When we have a many2one widget in a one2many, editable, the context was
not properly computed: it expected the parent to be a record object, but
in that case, it is a list object.
* hr_attendance, hr_gamification, hr_recruitment, mass_mailing,
project, sales_team
Before this commit, the kanban column did not know about the model
name which make customization impossible without a getParent. Kanban
records were supposed to know about this thanks to the options
parameter but this was broken. Now the model name is automatically
initialized from the given state.
Adapt all extensions which relied on this.
* account, mass_mailing, sales_team
These view extensions have already been ignored for around two years.
The new views development is a great opportunity to remove them.
This commit aims to correctly fill in the raw_value of each
field in the qweb_context use to render the kanban templates.
For relational fields, the absence of value should be false,
instead of an empty array. Moreover, the Many2One case is
different from the x2Many cases as in the first case the
datapoint is a record, and it the last ones it is a list.
We remove the res_id when exporting new records, as it is
meaningless outside the model (it's like "virtual_something").
This fixes a bug as the button box is now correctly hidden in
'create' mode.
In an editable list view, if there was a readonly field in the table,
positionned before editable fields, clicking on that readonly field
resulted in the editable field widgets being re-instantiated and
appended to the DOM (so there were several widgets per fields/cells).
The method 'setController' allows to change the default Controller
Widget used by the view. However, before this fix, calling it
changed the default Controller of all other Controller instances.
Before this commit, we only consider the BasicModel point of view to
determine if a record is dirty. It is good when we want to determine if
it is actually necessary to save the data, but not correct when we want
to know if some changes can be discarded.
With this commit, the form controller keeps track of its 'dirty' state,
coming from user interactions. It uses this flag to determine if
changes can be discarded.
With the new JS test framework, we had experimented with an autodestroy
feature, meaning that all views/widgets are automatically destroyed
after a while. By default, it was 50ms, because we could not hook some
code to run after the end of the current test.
For various reasons, this was not a good idea: some side effects, such
as modifications of the session or of the DOM (with modals) could
interfere with other tests. This commit disable the feature.
From now on, we will have to destroy each widgets created in a test.