| Age | Commit message (Collapse) | Author |
|
- Remove unnecessary "round_decimals". Will be process by format_value
- Fix json format value for digits attribute
|
|
The `DebouncedField` class has a `_onInput` method which is called when
the user is typing text and which is debounced so that its action
(setting the field's value) is not recalled too quickly.
The problem is that if we have to do other actions which should not wait
for the debouncing (or wait for another debouncing) when the user is
typing text, this would imply to namespace the "input" event to add
another handler, which is not very elegant.
Instead, this commit changes the `DebouncedField` so that the
`_onInput` handler is not debounced but instead calls a private method
which is debounced (`_doDebouncedAction`).
|
|
This reverts commit 839a07fbed4720fc71c070507c591295722df350.
Indeed, the system will need the `resetOnAnyFieldChange` option as the
`FieldMonetary` will need to be re-rendered if the currency changes.
This does not use the `_fetchSpecialData` system as it will be
refactored later and the currency can be fetched without RPC.
|
|
Before this commit, the `render` method of the monetary field added
the <input/> and currency elements without removing the previous
ones. As this was called on each related `onchange`, the DOM was
growing at each of these changes.
|
|
Before this commit, if a field was declared as a "Monetary" field in
the model, the `FieldMonetary` was adding the currency symbol in the
<input/> in edit mode.
|
|
The jQuery `html` and `text` functions already empty the element, so
no need to call `empty` before.
+ Lint the basic_fields.js file
|
|
|
|
|
|
|
|
This commit also adds the special_click property which is used to mark
a DOM element such that clicks on it will not be intercepted by the
list view.
Basically, we need this on elements which rely on bootstrap events,
since those need to bubble all the way up. If we catch them in
the list view, to open a cell or a record, then they never get to
bootstrap's level and so the widgets relying on these elements
cannot work.
We plan to remove it at some point, when we have more time to figure
out a way for the click event to reach bootstrap from inside the list
view without breaking the list view behavior itself.
|
|
|
|
The original reason why this widget was created is because sometimes,
the id is a virtual one, represented by string in the webclient. As
such, the integer widget could not render it properly since it could
not parse the integer from the string. This led to the following bug,
which in turn led to the creation of the id widget:
https://bugs.launchpad.net/openerp-web/+bug/919184
Now, virtual ids are not handled within the record data itself anymore,
making it a non-issue to render the id field in the webclient since
it is not given a value until a proper id is created. The virtual id
management is completely out of the view scope now, rendering this
widget useless.
|
|
|
|
|
|
like done previously for input fields.
|
|
Input fields notify their changes when the user is typing text at a
rate of max 1 per second (by default) and when a change is confirmed.
This last case was handled by listening to the "focusout" event. The
"change" event is however more suited to handle that.
This commit also solves a problem with the related test. Before this
commit, the test triggered some "input" events on an <input/>, then
waited some time so that the debounced action is executed, then
restarted triggering events... the problem is that this "some time" was
long enough to trigger the onchange but not necessarily long enough
to be sure another onchange can be started. Indeed, the mockserver get
rid of RPC delays but not of CPU delay. As two subsequent onchange
cannot be done at the same time (the second one is done after the first
one is finished (see Mutex)) and that this test simulates a 3ms delay
for the onchange, there is no guarantee that waiting x ms (even > 3ms)
will be enough, indeed sometimes we had this sequence:
1) trigger "input" event
2) trigger "input" event
3) start delay of 75ms
4) debouncing time (3ms) is finished: call `_setValue`
5) basic model mutex (already resolved)
6) start async onchange RPC
7) (1) -> (6) took more than 75ms CPU time, the delay started in (3)
is finished: trigger "change" event
8) call `_setValue` (no debouncing of "change" events)
9) basic model mutex... NOT resolved as the async onchange RPC
started in (6) did not had the opportunity to continue its
call sequence (no matter the time it would take)
To solve this problem, the 75ms delay had to be replaced by a non
arbitrary waiting: the mutex resolution. As the test does not know
about this mutex, the only way to be sure it is finished is to wait
for the `mockRPC` to be finished thanks to a deferred and then wait
for another callstack to be completed thanks to a 0ms delay.
|
|
When focusing a checkbox field and hitting the "enter" key, the
checkbox should change its status. Before this commit, this produced
a traceback instead as it was trying to call the `_onKeyDown`
function while it was defined as `_onKeydown`.
Also the `_onKeydown` method is in fact declared in the `AbstractField`
parent implementation, so there is no point in declaring the event
binding twice. Also, part of the `FieldBoolean._onKeydown` code was in
common with its parent `AbstractField._onKeydown` code so remove it as
there is no point in duplicating it.
Note: this `_onKeydown` method has to be refactored as it is breaking
form view navigation anyway.
Also modify an existing test to check the checkbox keyboard navigation.
|
|
+ Document and refactor the files using the new guidelines
* Now only non-technical names are used when building field chains and
domains (technical names can be used in debug mode).
* Better warnings are displayed when using the field and/or domain
selector widgets (also checks domain validity in both domain field
AND domain selector widget).
Also improve design (thanks to original work of @stefanorigano):
- Hovering 'remove' highlights the element that will be removed
- Hovering 'add node' btns shows where the new node will be created
- Restyle debug domain input field (make it similar to a text editor)
- Improve design and layout
- Resize inner fields
|
|
Before this commit, every field changes were sent upstream and triggered
a notifyChange, potentially causing multiple (onchanges) RPCS in rapid
succession.
It is useful to have a feedback of the new values of the fields even
without needing to lose the focus, but it should not be done for each
keystroke.
With this commit, we debounce the onInput handler, so the method
setValue is in practice debounced as well. We need to add a handler on
the focusout event to make sure that if the user changes input, the
setValue is immediately called.
Note that we had to add support for that in the test utils environment
(and not only in the createView method: field widgets can be
instantiated in other environment, such as the reconciliation widget)
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
The functions for parsing and formatting float_time were completely
duplicated between field_utils and basic_fields.
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
Previously, only the value in the python description of the field
could be used.
|
|
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.
|
|
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
|
|
The _rpc method is now the preferred method to do a rpc, so we need to
update all calls.
|
|
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)
|
|
Use this.rpc instead of Model object, with web.ajax if necessary.
nb: EventDispatcherMixin include now the custom_events managment instead
of widget
|
|
Widget has been broken by a rebase, making its test fail.
|
|
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.
|
|
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 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.
|
|
which is not supported by phantomjs.
|
|
Before this commit, the odoo web client used strings to represent dates.
Now, the date is parsed into a moment object when the value is read from the
server side. The widget formats the object to display the value. When the
widget value changes, the value is parsed to a moment object. The value is
automatically formatted to server value in ajax calls (toJSON method).
|
|
Add the implementation of the "FieldDomain" (widget='domain') in
basic fields file.
|
|
use 'web.field_utils' instead of 'web.formats'
|
|
This commit introduce a full redesign of all JS views. We started
basically from scratch. The goal was to unify all the various views
under a common framework, to make them testable, to make then usable in
different conditions (in studio, or in the frontend), and to make our
lives easier.
Some important points are:
- we introduced new coding guidelines (camelCase, 80 chars width, ...)
- we have a brand new testing framework (still QUnit based)
- kanban view moved to the web addon
- calendar view (formerly web_calender) moved to web as well
- the tree view was removed
- all new code should be documented
We hope that this code is the start of a new era for the Odoo web
client, we want to have a high quality codebase, well documented, well
tested, well designed.
Work done by the framework team: mostly aab, ged, chm, dmo, qsm
|