summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/basic_fields.js
AgeCommit message (Collapse)Author
2017-04-11[ADD] web: add percentpie widget tests and documentationDavid Monjoie
2017-04-11[ADD] web: add statinfo widget tests and documentationDavid Monjoie
2017-04-11[ADD] web: add label_selection widget tests and documentationDavid Monjoie
2017-04-11[ADD] web: add state_selection widget tests and documentationDavid Monjoie
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.
2017-04-11[ADD] web: add priority widget tests and documentationDavid Monjoie
2017-04-11[REM] web: remove id widgetDavid Monjoie
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.
2017-04-11[ADD] web: add boolean button documentationDavid Monjoie
2017-04-11[ADD] web: add url widget tests and documentationDavid Monjoie
2017-04-11[FIX] web: debounce field changes for FieldTextAaron Bohy
like done previously for input fields.
2017-04-11[REF] web: properly confirm value change of debounced input fieldqsm-odoo
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.
2017-04-11[FIX] web: typo in function name (FieldBoolean._onKeydown)qsm-odoo
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.
2017-04-11[IMP] web: domain & field selector usability (+ design)qsm-odoo
+ 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
2017-04-11[FIX] web: debounce field changes for input fieldsGéry Debongnie
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)
2017-04-11[REF] web: extract _prepareInput from _renderEdit of InputField.David Monjoie
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.
2017-04-11[ADD] web: add monetary field documentationDavid Monjoie
2017-04-11[ADD] web: add phone widget tests and documentationDavid Monjoie
2017-04-11[ADD] web: add email widget tests and documentationDavid Monjoie
2017-04-11[ADD] web: add handle widget documentationDavid Monjoie
2017-04-11[ADD] web: add text field documentationDavid Monjoie
2017-04-11[ADD] web: add float_time field tests and documentationDavid Monjoie
The functions for parsing and formatting float_time were completely duplicated between field_utils and basic_fields.
2017-04-11[ADD] web: add float field tests and documentationDavid Monjoie
2017-04-11[ADD] web: add integer field tests and documentationDavid Monjoie
2017-04-11[ADD] web: add boolean field tests and documentationDavid Monjoie
2017-04-11[ADD] web: add date and datetime fields tests and documentationDavid Monjoie
2017-04-11[ADD] web: add input field documentationDavid Monjoie
2017-04-11[FIX] web: prevent onchanges from re-rendering the current fieldDavid Monjoie
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.
2017-04-11[FIX] web: apply digits option from view on float fieldsDavid Monjoie
Previously, only the value in the python description of the field could be used.
2017-04-11[REF] web: use `specialData` system in domain fieldqsm-odoo
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.
2017-04-11[FIX] web: ace editor field was not properly saving changesqsm-odoo
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[REF] *: use _rpc method for all rpcsGéry Debongnie
The _rpc method is now the preferred method to do a rpc, so we need to update all calls.
2017-04-11[IMP] web, *: compute contexts and domains from datapointqsm-odoo
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[REF] web,*: remove 'web.model' and 'web.dataModelGéry Debongnie
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[FIX] web: priority widgetAaron Bohy
Widget has been broken by a rebase, making its test fail.
2017-04-11[FIX] *: apply changes from web_studioAaron Bohy
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[FIX] web: fix FieldDate widget default valueGéry Debongnie
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.
2017-04-11[REF] web,*: improve the way field_utils are doneGéry Debongnie
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.
2017-04-11[FIX] web: basic_fields: remove use of a es6 featureAaron Bohy
which is not supported by phantomjs.
2017-04-11[IMP] web: use moment object instead of string for dateChristophe Matthieu
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).
2017-04-11[IMP] web: adapt field domain to new APIqsm-odoo
Add the implementation of the "FieldDomain" (widget='domain') in basic fields file.
2017-04-11[REF] web: remove format.jsChristophe Matthieu
use 'web.field_utils' instead of 'web.formats'
2017-04-11[REF] web, *: redesign all JS viewsGéry Debongnie
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