summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/basic_fields.js
AgeCommit message (Collapse)Author
2018-09-18[MERGE] forward port branch saas-11.4 up to a1b384d66beChristophe Simonis
2018-09-17[MERGE] forward port branch saas-11.3 up to 2de573440ebChristophe Simonis
2018-09-17[MERGE] forward port branch 11.0 up to f2b8caff07bChristophe Simonis
2018-09-17[FIX] web: datepicker: correctly use libAaron Bohy
The datepicker lib has been updated to tempus dominus (BS4) recently, but our code hasn't been adapted correctly to the requirements of the new version of the lib. As a consequence, the datepicker didn't close itself when the input was focused out anymore. This required a slight change in the DomainSelector widget as it produced a crash when a focused datepicker widget is removed from the DOM (before the datepicker is destroyed), e.g. by a call to html() on one of its parent. Task 1878254
2018-09-14[FIX] web: JournalDashboardGraph widget crash Mk.IIMOENS Alexandre
Hardening of commit:995610c065bf0242cb5023cfad2940234395739e The JournalDashboardGraph requires nv, which is lazyloaded. However it requires nvd3.js which is loaded after nv.d3.js. A function called in destroy is defined by nv.d3.js, which can make the crashhappen with the right (wrong) timing. opw 1873749
2018-09-07[MERGE] forward port branch saas-11.4 up to d78f23df848Christophe Simonis
2018-09-07[IMP] web: FieldInteger and FieldFloat can use input of type numbersvs-odoo
This allow the browser/device to handle the experience of handling number in a more native way. FieldInteger and FieldFloat now inherits from NumericField because we want to format it or not dependent of the view (readonly or edit) and the NumericField will manage it. We do that because input type number can't take a value with comma on Chrome (FireFox is more permissive but not perfect because comma is the separator for decimal in this case). Task #1880376
2018-09-07[MERGE] forward port branch saas-11.3 up to 4850fb08385Christophe Simonis
2018-09-05[MERGE] forward port branch 11.0 up to 213759b03e5Christophe Simonis
2018-08-30[FIX] web: fix evaluation context of the domain selectorAaron Bohy
The domain was instantiated without being given any evaluation context. As a result, the uid variable was not defined, crashing the js if present in a user-defined filter. opw 1866852
2018-08-28[FIX] web: accept false value in comparisonMartin Trigaux
momentjs `isSame` method considers undefined values but not false our method _isSameValue does consider false Correct the error when running web tests Deprecation warning: value provided is not in a recognized ISO format
2018-08-28[FIX] web: prevent handle from crashing with text fieldSébastien Theys
289adeb63f51a9af26b8f383ba80089aa7aa6d87 introduced a bug where we tried to trigger an event on an element that didn't exist. Indeed there is no input if it's not in edit mode. This commit fixes it. PR: none Task: none
2018-08-24[FIX] web: force formatType for float_time after instanciationjem-odoo
Since in hr_timesheet, we are binding 'timesheet_uom' widget on existing one (and it might change according to the session info), we came to the case a formatType is different from the one of the widget in the registry. Then, the AbstractField fallbacks on the field type as formatter. Example; timesheet_uom widget is blind on float_time, but their keys are differents in field registry, so the formatter will be 'float' and not 'float_time'. This commit override the formatType determined by the AbstractField for the float_time widget.
2018-08-23[FIX] web: BS4, restore slider checkboxesqsm-odoo
Take advantage of the new BS4 checkbox structure to simplify the widget too.
2018-08-22[FIX] web: properly resize textarea when its value changesSébastien Theys
Before this commit, a textarea would not resize when its value changed if the event was different than "input" or "focus". This commit fixes it by also listening to the "change" event, and by triggering it at appropriate times. PR: #26430 Task: 1869469
2018-08-22[FIX] web: allow o2m navigation to work from required inputsSébastien Theys
In a one2many, pressing ENTER or TAB from a required input (of type text or char) that is on the last editable column of its line would fail to navigate to next line. The issue was that the validation of the required field would happen before the change to its value was actually applied. This commit fixes it. PR: #26430 Task: 1869469
2018-08-16[FIX] web: render JournalDashboardGraph when in DOMAlexandre Kühn
The lib 'nvd3' renders graph when they are attached to the DOM. However, widgets are rendered in fragments and appended to the DOM when ready (to prevent flickering). Before this commit, we used a `setTimeout(0)` and cross fingers that the widget was attached to the DOM when the `render` method was called. With this commit, the render method is called when it is attached to the DOM. Task-ID 1868252 Closes #26410
2018-08-16[IMP] web: add/remove from favorite outside of i tagDavid Monjoie
When paced inside the i tag, the text used to inherit from the style of the star, which means the text was yellow when starred.
2018-08-13[IMP] base, *: use a many2one for the company report layoutChristophe Matthieu
Before this rev. one could set the report layout on the company using a hardcoded list (background, clean, standard, etc.). Other modules (typically accounting modules) could add options in this list. The used template was built on the layout key. Now, the layout is a many2one field to a newly created model `report.layout`, which is linked to a view with the layout architecture. This gives more control to customize reports and create a new layout (without creating a python module that extend the layout selection).
2018-08-13[IMP] web: float_factor and float_toggle widgetsjem-odoo
This commit provides new js widgets for list, kanban and form views on float field. 1/ 'float_factor' displays the normal float field, but takes a conversion factor as option. The displays value is the normal one multiplied by the factor. You can use the widget like <field name="my_float_field" widget="float_factor" option="{'factor': 2}"/> 2/ 'float_toggle' displays a button (in edit mode) looping on a range of given value at each click. A conversion factor is optional (default will be 1) to display a converted value, but sent to non converted one to the server. You can use the widget like <field name="my_float" widget="float_toggle" option="{'range': [0, 0.5, 1], 'factor': 2}"/> 'range' and 'factor' are put in the options. In simple read mode, the widget display the value as a traditionnal text (like a normal char field). This commit provides tests and documentation for those 2 widgets. Task #39079
2018-08-06[FIX] ClipboardJS update for Bootstrap Modals focus issue in ChromeDavid Beguin
Since Bootstrap 4, ClipboardJS does not copy the value in the clipboard anymore as Bootstraps modals give the focus to another element. As the focus need to be given back to the correct element, ClipboardJS has to be updated as the container parameter is only added in v1.7. We were in 1.5. That container parameter allow to give the focus back to the correct element. See doc on https://clipboardjs.com/ + Issue : https://github.com/zenorocha/clipboard.js/issues/155
2018-08-01[MERGE] forward port branch saas-11.4 up to 8d9366197e1Christophe Simonis
2018-07-30[MERGE] forward port branch saas-11.3 up to b4555df336dChristophe Simonis
2018-07-27[FIX] web: empty input for empty password fieldAlexandre Kühn
Revision on https://github.com/odoo/odoo/commit/4b3588feb2b7e260bf237b0f3944c90cdc47c3b5 In order to not replace characters with '*' in edit mode (because of `input` with type 'password'), the above commit did not format the value at all. The formatter of a char with the option 'isPassword' turns all of its characters into '*'. That is not intended for password inputs, because the content is hidden by the browser with the 'password' type. The issue with not using the formatter is that an empty field has the value `false`, so an empty password field produces an non-empty password input with its value to 'false'. This commit fixes the issue by forcing empty string for empty password values. Note: if you use an integer field with password, falsy values (e.g. `0`) become empty strings in the input value.
2018-07-27[FIX] web: edited password fields should not contain '*'Alexandre Kühn
Before this commit, when someone was editing a password, the stored password may not be the expected one by the user. Steps to reproduce: 1. Open "Outgoing Mail Servers" form. 2. Set a password (e.g. "yop"). 3. Save, then edit. 4. Add "y" at the end of the password field. > Expected value: "yopy" > Actual value: "***y" This is due to the use of the char field formatter, which displays passwords by replacing the characters with '*'. It is not necessary to do this in edit mode, because it uses an input field of type 'password'. The browser automatically hides the value of such inputs. Any changes on a input field in edit mode uses the value of the input, so the value of an password input should contain the password, without '*'. This commit fixes the issue by using the formatter in edit mode for the input of type 'password'. Task-ID 1869565
2018-07-27[REF] *: BS4, adapt the label component structureqsm-odoo
The '.label' elements have been replaced by '.badge' elements without the 'badge-pill' class.
2018-07-27[REF] web, *: BS4, use custom BS4 checkbox everywhereqsm-odoo
Before this commit, Odoo used checkboxes in three different ways: - A simple <input type="checkbox"/>, mainly in the frontend. The style is browser dependant. - Same as above but with the BS3, checkbox structure. The style is still the same, but the alignement is supposed to be better (which is not always the case). - The Odoo official structure: ``` <div class="o_checkbox"> <input type="checkbox"/> <span/> </div> ``` which allows to have a cross-browser checkbox style and correct alignements. The goal after this commit is to only use the BS4 *custom* checkbox structure to achieve the same goal as our official structure (and remove that one): ``` <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" id="customCheck1"> <label class="custom-control-label" for="customCheck1">...</label> </div> ``` /!\ Labels are now required (use a zero-width space if necessary)
2018-07-27[REF] *: BS4, adapt col-related classesqsm-odoo
col-lg-* -> col-xl-* col-md-* -> col-lg-* col-sm-* -> col-md-* col-xs-* -> col-* col-lg-offset-* -> offset-xl-* col-md-offset-* -> offset-lg-* col-sm-offset-* -> offset-md-* col-xs-offset-* -> offset-* col-lg-pull-* -> order-xl-1 col-md-pull-* -> order-lg-1 col-sm-pull-* -> order-md-1 col-xs-pull-* -> order-1 col-lg-push-* -> order-xl-2 col-md-push-* -> order-lg-2 col-sm-push-* -> order-md-2 col-xs-push-* -> order-2
2018-07-27[REF] *: BS4, 'img-responsive' -> 'img-fluid'qsm-odoo
2018-07-27[REF] *: BS4, adapt dropdowns and caretsqsm-odoo
- The dropdown structure was simplified, allowing to get rid of the 3-levels structure induced by <ul/> elements and dropdowns can now contain anything. The class 'dropdown-item' is now mandatory for each dropdown clickable element. The class 'dropdown-item-text' can be used to add same padding and style but without making the element have a clickable look. - Dividers now use the class 'dropdown-divider' - The way dropdowns are opened and hidden also changed (before the 'open' class was added on the `.dropdown-menu` parent, now the 'show' class is added on both the `.dropdown-menu` parent and the `.dropdown-menu` itself). - JS-wise, no click event handlers can be put on `.dropdown-toggle` elements anymore (instead, use handlers for dropdown events). - Carets are automatically put on `.dropdown-toggle` elements, so this commit replaces the `.caret` elements with this. This feature was possible to disable but would prevent us from adding a caret with scss. Also, this simplifies the DOM. The 'o-no-caret' class was also introduced to allow using the 'dropdown-toggle' class on non-caret elements. - Also adapt the scss to use $caret-width instead of $caret-width-base
2018-07-24[MERGE] forward port branch saas-11.2 up to 3c521f6d05cChristophe Simonis
2018-07-23[MERGE] forward port branch 11.0 up to 219d2296d67Christophe Simonis
2018-07-19[FIX] web: format value of statinfo widgetlen-odoo
The value of the statinfo widget is rendered by the qweb after a t-esc. Say if the python rounding returned 14.0000000001 (supposed to be a two digits precision number through the magic of floats) then the statinfo widget would print it as-is. We now format the value at assignation. opw 1865426
2018-07-09[FIX] *: fix some side-effects of ↵qsm-odoo
https://github.com/odoo/odoo/commit/9de1bc0eef6f5bfaa2a8d745431caa361ae91548 - JS Modals were not correctly built anymore, their .modal-body element was duplicated and many without-effect JS lines were introduced (as a side effect, the form view design was broken when inside modals) - Tests were changed to make bugs go unnoticed. For example, the media dialog functionnality was entirely broken because the .modal-dialog element was not receiving the correct class anymore. - The JS translation function is _t, not _ - Do not use the <title/> tag as a regular DOM element, it is meant to be unique, in the <head/> section - CSS rules were added to the utils.scss file, which is meant to contain functions and mixins, otherwise, the rule is duplicated in every asset - Some icons were still broken, as missed by https://github.com/odoo/odoo/commit/f90cf060a3cfeb37a67bec83264c0aaab8892b56 - Tests were changed to use [role="dialog"]/footer/header in their selectors without any reason, this commit restores some of that to avoid rebase conflicts with the BS4 work. - ... Note: other elements should still be discussed, like the direct use of the 'o_form_label' class in views definition... but those do not cause direct problems.
2018-06-29[MERGE] forward port branch saas-11.4 up to d54a3726ecaChristophe Simonis
2018-06-28[MERGE] forward port branch saas-11.3 up to 3cdcbce93cbChristophe Simonis
2018-06-27[MOV] web,im_livechat: Move clipboard widget to webYannick Tivisse
2018-06-27[MERGE] forward port branch saas-11.2 up to 12ddec3a767Christophe Simonis
2018-06-22[IMP] Improve compatibility with screen readers (accessibility) (#24574)kujiu
Today, Odoo is really tricky to use without seeing the screen, it must be improved to be usable. This PR forbid to use labels without a "for" attribute, add some title, rule and aria attributes in HTML. With that, Odoo will be fully usable with a screen reader. * [IMP] Labels must have a for attribute. Improve accessibility. * [IMP] Better error message when trying to read a missing cached value * [FIX] Add some aria-label and title attributes for screen readers. * [FIX] Template name is not included in the error message in case of SyntaxError in QWeb * [FIX] Improve the Tour failed at step error message to be more explicit. * [IMP] Add aria-labels * [FIX] Add missing aria-label on failing test * [IMP] aria-hidden means hidden. Fix all bad aria-hidden and hide aria-hidden for all. * [IMP] Color names on kanban views and many2many tags * [IMP] Add some checks on views for accessibility. * [IMP] Add `alt` attribute on `img` tags. * [IMP] Add aria-label and title on non-described icons * [IMP] Add button role to widgets with btn class * [IMP] Translate aria and formatted attributes. * [IMP] Remove wrong aria-labelledby * [IMP] Add menu role on dropdowns * [IMP] Buttons must be focusable * [IMP] Add aria attributes on progress bars * [IMP] Improve accessibility of basic widgets * [IMP] Change main layout to more semantic tags * [IMP] Add menuitem role when missing * [IMP] Remove wrong role='presentation' * [IMP] Improve accessibility of tab panels * [IMP] Add aria-invalid on invalid fields * [IMP] Add aria-sort on ordered columns * [IMP] Add role on alerts * [IMP] Use dialog role, header, main and footer tags for modals * [IMP] Add labels on o_status * [IMP] Improve accessibility of kanban view with feeds and articles * [IMP] Add alerts in case of new messages * [IMP] Add widget, navigation or img role to aria-labelled items
2018-06-21[MERGE] forward port branch 11.0 up to c5ed3729709Christophe Simonis
2018-06-15[MERGE] forward port branch saas-11.3 up to 50860317ccdChristophe Simonis
Note: 1aacc962620982528a3dfc90d2c1dd0027359375 has been ignored and will be forward-ported later
2018-06-15[FIX] web: fix ace editor when value is FalseJeremy Kersten
Avoid to crash the client web with setValue(false). false.match, false.split, false.length... will not works. Before this commit, _render call the setValue after comparing '' !== false
2018-06-15[MERGE] forward port branch saas-11.2 up to b170a753e18Christophe Simonis
2018-06-15[MERGE] forward port branch 11.0 up to b05e4d5f958Christophe Simonis
2018-06-13[IMP] web: Expose datepicker configuration to view declarationsJairo Llopis
The lower-level widget itself supports passing options to the underlying datepicker library. However this is not exposed to higher-level view declaration. With this patch, one can declare a field in a view such as: ```xml <field name="datefield" options='{"daysOfWeekDisabled": [0, 6]}'/> ``` That option would land in the widget and disable those weekdays. Documentation has been updated accordingly. Closes #25044.
2018-06-08[IMP] web: add decoration support for all field widgets (#25160)oco-odoo
It is sometimes useful to be able to customize slightly the color of a field depending on some conditions on the current record. For example, imagine that we want to show a VAT number field in green/red, if it was validated or not. To do that, we can add a field with an onchange, and simply add decoration-danger and decoration-success attributes to the field.
2018-05-29[MERGE] forward port branch saas-11.3 up to 37eed7c509fChristophe Simonis
2018-05-28[FIX] web: do not hide button in pdf viewer in some casesGéry Debongnie
The pdf viewer uses an external library to display a pdf file. This library displays a few controls, such as a 'Download' button. However, this button is sometimes displayed in the top bar, sometimes in the top right dropdown menu (depending on the size of the widget). For some unknown reason, the pdf viewer widget disabled the download button. But this was inconsistent: the download button was only hidden when it was in the tob bar, and not in the dropdown menu. With this commit, we simply remove this behaviour.
2018-05-15[IMP] web: add the Percentage widget in the registry as a basic fieldVincent Schippefilt
2018-05-02[FIX] web: allow focus to move to a field monetaryVincent Schippefilt
In the chart of account editor, which is an editable list with 2 contiguous monetary field, we could not change the first then move to the second using the TAB key: the focus was not set on the input of the second monetary field, and when it is, that input is destroyed and recreated so the focus was lost Before this fix, the user needed to hit TAB twice to move to the next field. After this fix, the user can navigate between fields monerary with TAB