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.
The code for selectCell was active, when the user clicked on a td. No
test caught that, because we simulated a click on a tr, not on a td.
I guess that the lesson of the story is that our tests should be as
close as possible to the real conditions, so we should simulate the
click on the innermost element.
Before this commit, the form view opened by a one2many did not check
that the required fields were properly set, so it could lead to pretty
strange results.
Before this commit, the rawify function assumed that any object is
necessary a record object. This was true until recently, when we
decided that dates should be internally stored as a moment instance.
Some fields need to do some model RPC calls (name_search, name_create,
...). Before this commit, they did not use the performModelRPC method
but an explicit trigger_up so that the BasicController (the
FieldManagerMixin) catches it and ask the BasicModel to perform the
RPC. This was designed to let the BasicModel handle the context.
This commit makes the context be automatically binded without the need
to explicitely call the BasicModel for each route in the
FieldManagerMixin. It also ensures that the field own context is
properly merged with the user/action/search contexts.
Now, the fields use the performModelRPC method and the
FieldManagerMixin catches the associated "call_service" event. Then, it
can get the full context from the BasicModel instance and let the event
continue its propagation. To know which field context has to be fetched,
the performModelRPC method is overriden by AbstractField to
automatically add the dataPointID and the field name in the options
parameter.
Hopefully, this commit makes it consistent. There were two problems
with the previous implementation:
- Contexts from field attr (if asked thanks to the options.field
parameter) were not evaluated with the right evaluation ctx
- "raw" contexts (from parent) had to be evaluated with another
evaluation context
Also rename the options.field parameter to options.fieldName.
FieldMany2One was declared as an extension of AbstractRelationalField
AND mixins.ServicesMixin... which was wrong since the mixin is already
added to the Widget class. This caused the extension of the mixin
methods to be lost.
We replace a bunch of formatting and parsing functions by an object
(parse or format) which can be used to dispatch on the correct type. It
allows us to remove the format_field and parse_field functions.
Also, we camelcase our new code and add some comments.