summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/basic_fields.js
AgeCommit message (Collapse)Author
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-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
2018-04-18[MERGE] forward port branch saas-11.2 up to fed775bc0c2Christophe Simonis
2018-04-18[MERGE] forward port branch 11.0 up to 8c64159b884Christophe Simonis
2018-04-18[FIX] web: don't ignore required attrs on image fieldsAaron Bohy
Before this rev., falsy image fields could be saved even if they were required.
2018-04-16Revert "[FIX] web: remove &shy; when saving phone number"Christophe Simonis
This reverts commit b8b0f947bf7f7abf930a1797fa55c7f7dd33faa2.
2018-04-16[MERGE] forward port branch saas-11.2 up to 90f8f17fb4fChristophe Simonis
2018-04-16[MERGE] forward port branch 11.0 up to ad825b673b5Christophe Simonis
2018-04-16[FIX] web: fix keyboard related crash in client actionsVincent Schippefilt
2018-04-13[FIX] web: remove &shy; when saving phone numberNicolas Lempereur
When Odoo display a phone number number, on phone or if VOIP is installed a invisible `&shy;` character was added from 9.0 up to saas-11.2 so an applications such as skype would not be concerned with the number. But if someone copy-pasted from this to somewhere else in Odoo, we would get incorrect number with this invisible caracter. So this change make a special case for the "FieldPhone" so the character is removed from data saved. opw-1834858 closes #24223
2018-04-10[IMP] web: keyboard navigation in form viewVincent Schippefilt
The goal of this commit is to allow fast entry of the same model using the keyboard for navigating through the form once, by blocking the user from advancing in the form if there is a required field or once they went through the form once to get them to a primary action (button) This commit includes the following changes 1) Enable moving forward from field to field using the TAB key 2) Entering the one to many and many to many using the TAB key a. When entering it, set the focus on the "add new line" link or button b. When adding a new line, set the focus on the field visible editable field of the new line c. Discard adding a new line with ESC key d. If the user leaves the first field empty and uses TAB, we will cancel the adding of a new line and move to the next field of the form 3) When a field is required and not filled in, do not allow the user to move out of the field using the TAB key (the user is still allowed to use the mouse though), mark the field as invalid instead 4) After going though the form once, using the TAB key on the last field will move the focus to the first primary button of the page 5) When the focus is on a primary button (EDIT/SAVE), the user cannot move the focus forward using the TAB key. Hitting TAB again will display a tooltip telling to hit ENTER to activate the button. The mouse is still available to move the focus. 6) When the user saves, the focus is placed on the first primary button of the form renderer (like VALIDATE for a new invoice) 7) On dialogs, primary buttons should stop the users from moving out of them, and showing a popup if the user tries 8) When closing a dialog, the focus will be moved back to the widget that opened it. This commit does not include the following features 1) Navigation with the keyboard on a selection one to man 2) Navigate between tabs in a form using the keyboard 3) Cancelling the adding of a new line in a many to many using the ESC key do not set the focus correctly 4) Enhancing the focusses fields (like blue underline)
2018-04-06[MERGE] forward port branch 11.0 up to d277adf4d59Christophe Simonis
2018-04-05[DOC] doc: update/add documentation on js frameworkGéry Debongnie
The state of the JS documentation was quite sad, not updated in a long time. With this commit, we rework a lot of the JS doc. Most notably, we add a section 'Javascript Cheatsheet' (help on some common customization tasks) and rewrite the 'Javascript Reference' totally. Note that the JS reference page also contains a reference on all field widgets. This work is just the beginning, it is probably not complete, but at least we will have a foundation.
2018-03-30[DOC] doc: update/add documentation on js frameworkGéry Debongnie
The state of the JS documentation was quite sad, not updated in a long time. With this commit, we rework a lot of the JS doc. Most notably, we add a section 'Javascript Cheatsheet' (help on some common customization tasks) and rewrite the 'Javascript Reference' totally. Note that the JS reference page also contains a reference on all field widgets. This work is just the beginning, it is probably not complete, but at least we will have a foundation.
2018-03-28[IMP] web: override size attributes in image widgetMartin Geubelle
Size attributes (e.g. `max-width`) are sometimes set in css (i.e. with classes, see `oe_avatar`). They must however be overriden if they are specified on the widget. Example: <field name="image" widget="image" class="oe_avatar" options="{'size': [180, 180]}"/> The `max-width: 90px` set on oe_avatar must be overriden in this case. Note that the attribute `img_width` and `img_height` have been depreciated as `width` and `height` are fulfilling the exact same purpose.
2018-03-21[MERGE] forward port branch saas-11.2 up to 500e3f49705Christophe Simonis
2018-03-20[MERGE] forward port branch 11.0 up to 2835d299792Christophe Simonis
2018-03-14[IMP] update ace editor to v1.3.1Géry Debongnie
Note that we do not do a custom build anymore, since we lazyload the files anyway. A custom build will save a few kb, but will not do any meaningful change to the user experience. However, it dies impact negatively our ease of maintenance, so standard build it is.
2018-03-12[FIX] web: 'toggle_button' widget in edit modeAaron Bohy
The 'toggle_button' widget is one of special field widgets that can trigger changes in readonly mode (in this case, toggle the boolean value when clicked). It was working fine in form views in 'readonly' mode, as in this case, the new value is saved directly, and the form view is re-rendered (a new widget is created with the new value). However, in 'edit' mode, the value isn't saved directly (the user has to click on 'Save' to save the changes), the widget is reset with its new value, and the reset wasn't correctly handled in this particular widget. Fixes #23400
2018-03-02[IMP] web,hr: Phone widget is always clickableAnkit Sathvara
With this commit, when a phone number is clicked (in readonly), - if voip is not installed, it opens an app according to the user choice (e.g. skype), and on mobile, it opens the phone app to call the number - if voip is installed, in desktop, it opens voip, and on mobile, it still opens the phone app to call the number, because webRTC is not supported. This commit also makes the employee form view use the phone widget for the 'Work Phone' and 'Work Mobile' fields. Task #30369
2018-02-12[MOV] web, mrp: move `pdf_viewer` widgetMartin Geubelle
This widget is generic enough to be used in other modules than mrp so we move it in the web module. Closes #22569
2018-02-07[IMP] account: Display full instead of cut bullets on dashboard graphsDhaval Panchal
Purpose ======= http://nimb.ws/q12J40 Bullets are cut in the middle, improve so we can see the full bullet.
2018-02-01[MERGE] forward port branch saas-11.1 up to 7e469eb77aaChristophe Simonis
2018-02-01[MERGE] forward port branch 11.0 up to f5e7b866860Christophe Simonis
2018-01-26[IMP] web,*: config: add XXS size to config.deviceAaron Bohy
In Less, the size_class XXS is defined and used in media queries. This rev. adds it in JS for sake of consistency. Code in addons comparing the size_class needed to be adapted due to the new XXS size_class. Moreover, we now use the helper 'config.device.isMobile' everywhere we should, instead of manually comparing the size_class. Finally, we changed the way the config.device has to be specified in the test environment. From now on, only the size_class should be set, and the isMobile flag is computed automatically.
2018-01-25[FIX] web: add target=_blank to url field widgetsGéry Debongnie
Url in the web client are supposed to open in a new tab. This was the way it worked in v10.0 and was lost with the refactoring of the new views. We just reintroduce that behaviour with this commit. Closes github issue #22389
2018-01-22[MERGE] forward port branch 11.0 up to 950d9b23690Christophe Simonis
2018-01-15[FIX] web: disable {bin_size: true} on binary fieldsAlexandre Kühn
Revision on 41fe7f9d1113d026b226b136b4477aaaf9f1f638 This commit intended to reduce the network load when reading records with binary fields. This was made possible by enforcing the contextual key `bin_size` to be set for records with binary fields. However, it is causing some issues (see #22222, #22231) which are: - write with bin_size:true generates a traceback - read/search_read with bin_size:true breaks some images on some views (e.g. base.view_partner_form) Since the problems outweight the gain of these changes, we revert them.
2018-01-12[MERGE] forward port branch 11.0 up to 3b80a059ff4Christophe Simonis
2018-01-12[FIX] web: contexts on field widgets + enforce bin_size for binaryAlexandre Kühn
Field widgets now have a key 'context' that let them extend the context of the dataPoint (e.g. list). In particular, widgets on binary fields enforce the contextual item {bin_size: True}, so that the server gives the size of the binary field as its value, instead of its content. This change on binary fields reduces network load when accessing a view with binary fields.
2018-01-12[FIX] web: binaryfile field in list viewsAlexandre Kühn
Revert partially 255e8ca3d92e3a77d7c2a145677623518bc2f978 Removed widget 'download_link', as it was a sub-version of widget 'binary': it did the exact same thing (representation of binary fields by means of a download link) in a much better-looking way (download icon + filename as text of the download link, instead of just a download link with text "Download"). Also, the values of binary fields might be already a human-readable binsize (e.g. 2.52 MBs), instead of its plain textual string representation in base64: The contextual parameter 'bin_size', when set to true, does not download the data of binary fields. As a consequence, the server provides the sizes of the binary, instead of their value.