summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/basic_fields.js
AgeCommit message (Collapse)Author
2020-09-24[FIX] web: Get correctly focusable elements on selection widgetsLuis González
When navigating fields using the keyboard, it's not possible to reach most of widgets for selection fields. That is because most of them consist of one main element containing several other ones, one per possible selectable value (e.g. buttons). When their focusable element is computed, the main element is taken, instead of its sub-elements, which causes the field to be skipped when navigating. This commit fixes the above, as well as some missing aria attributes and keyboard events, for the following widgets: - `priority` - `state_selection` - `statusbar` - `radio` opw-231112 closes #58302 closes odoo/odoo#58418 X-original-commit: 2471e7c176c5df0f310f2939f8a6cf6948c0ac0c Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-09-11[FIX] web: fix picture glitchhku-odoo
currently, whenever the view is change the picture zoomed in and still displayed, only disappears after having refreshed the page so, in this commit the employee picture should no longer to be zoomed in whenever change the view closes odoo/odoo#57571 Taskid: 2311308 X-original-commit: 8214332ccd86e52c4f18de8d5428a1a22f2ad21c Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-09-03[IMP] web: new widget for static image urls in char fieldsVictor Feyens
This new widget allows definition of Images through static urls stored in a Char field. It was implemented to provide a way to reduce databases footprint by using static files instead of duplicating them in the databases (& their backups).
2020-08-14[IMP] web: allow password fields to force the `autocomplete` valueOlivier Dony
Follow-up on 6edb7495346119e2ceb25f5b5b5568b4b890dd86, where default `autocomplete` values were introduced as default for password fields, according to the new autofill specs. This patch allows developers to force the "autocomplete" attribute value on password fields, in case there really is a need for a value that is not `new-password` (which BTW now triggers the password generator wizard in many browsers). It is useful for example when a backend form really needs to ask the user for their current password, so the correct `autocomplete` value is `current-password`, as on the login form.
2020-08-11[IMP] web: add smart date input on date fieldMichael Mattiello (mcm)
This commit adds smart date inputs for date and datetime fields. The goal of smart date input is to provide the user some shortcuts when setting dates. The rule is [+-]\d+[dwmy]? So we can enter inputs like: +3 to have today + 3 days -2w to have today - 2 weeks +1y to have today + 1 year +5m to have today + 5 months -4d to have today - 4 days closes odoo/odoo#55602 Task: 2270347 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-07-23[FIX] web: display 0 for FieldFloatToggleAnh Thao Pham (pta)
The field was hidden in UI when its value was not set or equal to 0. Display the field if its value is set to 0. [IMP] web: clean code
2020-07-10[FIX] web: fix zoomodoo attachToTarget/dashboard compatiblejvm-odoo
Issue - Install Employees & Dashboard - Add employees to kanban - Dashboard - Hover an employee picture There is only the picture visible on the page, the remaining space is white. Cause I found several issues. 1. The pictures are not shown on hover in employees But they are on dashboard. 2. $attach = all `.content` and on dashboard there is 2 `.content` so the flyout is append 2 times 3. The move method is trigerred on hover too, it hides the flyout if we are not in it. But with attachToTarget we are not in it so it's hidden all time. 4. If everything above is solved, the image is shown but not at the correct position because the flyout base position is not top 0, left 0 Solution 1. Reduce the minimum required size to 128px 2. use closest instead of parents 3. Don't hide if we have the option attachToTarget 4. Calculate the flyout offset and replace it correctly and set it to position fixed to handle scrolling OPW-2291493 closes odoo/odoo#54333 X-original-commit: 2c6d692ee40c97d2ae63da64db7623702948407e Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com> Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-06-23[FIX] web: daterangepicker not working in firefoxDhruv Patel
A recent commit [1] made the daterangepicker automatically close itself on scroll events. However, in firefox, a scroll event is triggered when the daterangepicker opens. This event is triggered inside the picker itself. As a consequence, the picker is closed directly. This commit solves the issue by only closing it on scroll events occurring outside the picker. [1] https://github.com/odoo/odoo/commit/e6730c6e928587cd7438340cc101c57fee34220b closes odoo/odoo#53497 Task: 2282571 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-02-27[IMP] web: better positionning of daterangepickerParth Choksi
Before this commit, the daterangepicker always opened below the input, even when there was not enough space to display it. Moreover, when the user scrolled while the picker was opened, it wasn't stucked to the input, so the picker was displayed at a random position after the scroll. With this commit, we compute the available space above the picker when opening it, and if there is enough space, we display it above, otherwise, we display it below. Moreover, we automatically close the picker when the user scrolls. task-2117229 closes odoo/odoo#42161 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-06-12[IMP] *: update notifications to optional titleJulien Mougenot
closes odoo/odoo#52826 Related: odoo/enterprise#11084 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-05-14[IMP] web_editor, *: make Colorpicker a Widgetfja-odoo
*: website, web Move the colorpicker dialog logic into a colorpicker *widget*, which the colorpicker dialog will now instantiate. Part of https://github.com/odoo/odoo/pull/46088 task-2195313
2020-05-12[FIX] web: correctly update input field after onchangeAaron Bohy
In a form view, have an x2many list with two fields A and B (e.g. A is a many2one, and B is a char). There is an onchange on the x2many that is triggered when the user sets A, and that sets B. In this scenario, let's assume that the user first writes something in B, but directly deletes it. Then, he sets A. Before this commit, in this situation, B wasn't updated with the value returned by the onchange. Indeed, B's field widget was still flagged as 'isDirty', because the user interacted with it, but it didn't commit its value, as it hasn't actually changed. Basically, it remained flagged as 'isDirty' forever, and thus couldn't be updated with the value returned by the onchange. This commit ensures that the 'isDirty' status is correctly updated when the change is actually undone. Task 1958793 closes odoo/odoo#51085 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com> Co-authored-by: pka-odoo <pka@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-05-12[FIX] web: select date/datetime value when tabbing inHardik Prajapati
before this commit, tabbing into the date or datetime field input it has only focus, value is not selected. after this commit, navigate through a view in edit mode with the TAB key, when focus comes into date/dateetime field input then input is focused and value of date/datetime field is also get selected. task-2246593 closes odoo/odoo#51062 X-original-commit: 962e4e18b559d90aa3456c77035659ac8017501d Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-05-08[FIX] web: Handle time select in modal with firefoxNasreddin (bon)
Issue - Install sale_renting - Create a rental order - Add a "rental" product - In Modal, change start or end time In Firefox, user not allowed to change the time; time select not reacting well. Cause The issue seems to be that in bootstrap when we click outside a modal, we focus on the modal: https://github.com/odoo/odoo/blob/27f67bfcb903/addons/web/static/lib/bootstrap/js/modal.js#L332-L337 and the FieldDateRange widget contains a <select/> tag and is added outside of the modal, so when we click on the select, bootstrap will focus on the modal which in firefox seems to lose the focus on the <select/> which get closed. Solution not propagating focusin event when the select of the daterange widget is focused => in my opinion this is the less risky solution, this could be done with a code such as (in the FieldDateRange._renderEdit method): opw-2240220 closes odoo/odoo#50906 X-original-commit: 5a1e9e32061996ca1770c9ae9b5a7e7f53c5048f Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-05-05[IMP] web: add RemainingDays field widgetAaron Bohy
This widget can be used on date and datetime fields. In readonly, it displays the delta (in days) between the value of the field and today. In edit, it behaves like a regular date(time) widget. Part of task 2195254
2020-04-30[IMP] sales_team, web: add and improve color widget to improve UX on crm.tagvho
The color picker help the user to choose a color instead of picking it by id. The title and arial-label "no-color" default value are removed from the picker_preview because they are not accurate. Instead name of currently set color is used. Task ID 2128166 closes odoo/odoo#47474 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-04-17[IMP] web: Numeric fields can be non-formattedLucas Perais (lpe)
This commit introduces a new option in fields inheriting from type Numeric which is `format`. By default, Numeric fields are formatted according to their subtypes and locale Adding, in a view, the option format set to a falsy value will prevent the field's value from being formatted. ``` <field name="int_field" options="{\'format\': false}"/> ``` Task 2050119
2020-04-03[FIX] web: Fix the zoom image stick top on search of employee.Nisha patel
Currently, the Employee picture stays on top of the card of the employee we're looking for. The image does not disappear after a search is validated. Steps to reproduce: >> On employee kanban focus cursor on search panel, then mouse over to employee image so it will be zoomed, now without mouse leave just type in the search panel and enter, the big zoomed image stuck on screen and don't even know how to make it go away. So in this commit, We fix that on keudown hide the zoom image so when user search on search panel it will hide the zoom image. OnShow of zoom bind the generic even keydown and on that just hide the image so it should not stick on screen. TaskID : 2212808 Closes : #48253 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-03-31[REF] web: convert FieldBoolean to owlMichael Mattiello (mcm)
This commit does 4 things: - adds a file for deprecated legacy fields. - moves legacy FieldBoolean into this file. - converts FieldBoolean to owl component. - adds a new xml file for component fields' templates. task id: 2193996
2020-03-25[FIX] web,mail: Harmful or incomplete aria-label attributesLuis González
Some elements contain superfluous `aria-label` attributes, which overrides any default useful information. For instance, some dropdown menus contain the `aria-label` "Dropdown menu" (e.g. the company switcher), which doesn't add any useful information, as dropdown menus are already labelled correctly using `aria-expanded`. This change applies on the following buttons: - Schedule an activity - View attachments - View followers - Switch company - Open user options from systray - The widget `state_selection` closes odoo/odoo#48317 X-original-commit: e3c7f66e89d7be39dfa4cc3d6b038c6f4a114aa5 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-03-24[IMP] web: trim FieldEmail widget valueMohammed Shekha
before this commit, email widget was not trimming value and due to which space aroung email value remain as it is added by user. after this commit, email widget will trim the value and remove leading/trailing space. task-2197432 closes odoo/odoo#47470 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-19[FIX] web_editor: allow widget text on field html in studioJeremy Kersten
Before this commit, widget='text' was not available in web_studio since 'html' was missing from the supportedFieldTypes list of the TextField. After this commit you can use widget text (and other derivated type of text). task-sbu-feedback closes odoo/odoo#48043 X-original-commit: 34bd90e7fc2aa094eac92b6f635c2d8d933ecb86 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-02-12[FIX] web: Avoid open too fast zoomjbm-odoo
Picture of employees are maximazed directly which is annoying when you move the mouse in kanban view. Add the ability to put a waiting time before opening the zoom in option of the field in the view (default value is 0). closes odoo/odoo#45229 Taskid: 2191289 X-original-commit: a264b17d8fe18464df439d896ecb7dea106caa5a Signed-off-by: jbm-odoo <jbm-odoo@users.noreply.github.com>
2020-02-06[IMP] web: show % symbol outside the input in percentage widgetMichael Mattiello (mcm)
Before this commit the % symbol was part of the input. We could write a value with the % symbol to divide the value by 100 (50% = 0.5, 50 = 50) This commit removes the % symbol from the input and adds it in a span after the input so we do not need to write the % symbol anymore. The value from the input will be saved as $value / 100 in database. task-2065078 closes odoo/odoo#43995 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-02-04[IMP] web: allow background-style images for custom modelsDamien Bouvy
The `FieldBinaryImage` assumes that the image mixin is used to manage its fields - this is mostly true, until you use custom fields. This commit makes using the 'background' option of the Image widget possible by fallbacking the thumbnail field's name to the name of the field itself instead of `image_128` when we're dealing with a custom field.
2020-01-30[FIX] base,web: url widget: add protocol in hrefDhruv Patel
With this commit, the url widget automatically prefixes the href url by http:// if no protocol is specified, so that clicking on the url will by default redirect to an external website. To prevent this behavior, one can still specify the new option 'website_path: true' on the url field node in the view arch. Thanks to this, we can remove a similar logic (only implemented on res_partner model) which automatically altered the value saved in database to force its 'http://' prefix. task-2153184 closes odoo/odoo#42118 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-28[FIX] web: fix email and phone widgets with empty valueDebauche Stéphane
When the value is empty in a related field, string of the element was displaying "false" instead of an empty string which is not what we expect. This commit fixes that issue. Task ID 2119333 PR #40949
2020-01-22[IMP] web: do not set text-muted on boolean_toggle clickMohammed Shekha
currently if boolean_toggle widget is inside listview and if it is clicked and set to false then listview row text set to text-muted, we want to remove this behaviour as it is inconsistent and breaks any decoration-xxx set on the treeview. task-2179066 closes odoo/odoo#43754 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-06[FIX] web: avoid parsing value if already numberAndrea Grazioso (agr-odoo)
When accessing stock_barcode module to validate pickings, is not possible to add floating point quantities for any localizaton which uses ',' as decimal separator. The numeric field is now defined via browser tags <input="numeric"> to make the numeric keyboard popup automatically on mobile devices (commit 8f5840369b28962ab2be9edfce7331a836c3df22) Adding the override to avoid further processing when the input is already anumber opw-2154657 closes odoo/odoo#42748 X-original-commit: 1ccc60deeb067f8d461d48cbf51719317c22cb90 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-01-08[MOV] web: move the widget ``color_picker`` from "planning" to webDebauche Stéphane
Task #2088538
2019-12-09[REV] web: reverts update to fontawesome 5.11.2Kevin Baptiste
This reverts commit ff1c35513aecef5fbc30f7c2f3834450e719714e. closes odoo/odoo#41480 X-original-commit: 116057b26e71db4692280463669f3e80d813ddcc Related: odoo/enterprise#7110 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-28[IMP] web: update to fontawesome 4.7.0 to 5.11.2Kevin Baptiste
FontAwesome 5 introduced new names for some icons as described on https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4#name-changes This commit replaces the old names to the new ones. closes odoo/odoo#35826 Taskid: 2050241 Related: odoo/enterprise#5180 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-10-16[IMP] web: many2many_binary, binary, image, add the option ↵Debauche Stéphane
``accepted_file_extensions`` Purpose ======= We want to add an option on the widgets - many2many_binary, - binary, - image This option specifies what file extensions the user can pick from the file input dialog box. Examples ======== ```xml <field widget="many2many_binary" options="{'accepted_file_extensions': 'image/*'}"/> <field widget="many2many_binary" options="{'accepted_file_extensions': '.png,.jpeg'}"/> <field widget="many2many_binary" options="{'accepted_file_extensions': 'application/pdf'}"/> <field widget="image" options="{'accepted_file_extensions': '.png,.jpeg'}"/> <field widget="binary" options="{'accepted_file_extensions': '.pdf,.svg'}"/> ``` How === Add an option (accepted_file_extensions) in the template ``HiddenInputFile`` (the widget many2many_binary is using this template) So, we can also use this new option in others widgets using ``HiddenInputFile`` In the many2many_binary, read the ``nodeOptions`` and set the widget attribute ``accepted_file_extensions`` We also have to fix some other widget, because an property ``image_only`` was already existing in the template ``HiddenInputFile`` (we just need to replace ``image_only=True`` to ``accepted_file_extensions='image/*'`` The widget ``FieldPdfViewer`` (pdf_viewer) now use the new option to filtrate PDF (instead of removing the <input/> and adding <input accept='.pdf'/>). Tests ===== We also test if the option is correctly set on the <input/> - binary - image - many2many_binary Impacted widgets =============== - many2many_binary - image: this widget use ``options="{accepted_file_extensions='image/*'}"`` instead of ``image_only=True`` - tablet_image: same as ``image`` Task #2082815 closes odoo/odoo#38351 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-10-16[IMP] web: increase file limit from 25mo to 64moGéry Debongnie
The fieldbinary widget has an internal max upload limit set to 25mo. This was set a long time ago, probably more than 5 years ago. Since then, a lot of things have changed and it may be more frequent for users to hit the limit. And it happens for some users, we had to increase locally their limit. Also, nginx is configured to accept files up to 64 mo, so it makes sense that the web client also uses that same limit. closes odoo/odoo#38856 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-10-11[IMP] web: CopyClipboardCharLong widget for long stringsArnaud Joset
- The copy CopyClipboardChar widget is not nicely rendered for very long strings (e.g. URL). - This commit modify the behavior of the CopyClipboardChar widget to display it nicely win such cases. TaskID: 2059972
2019-10-07[FIX] web: prevent browsers inputs autofillMathieu Duckerts-Antoine
We don't want the browser to fill inputs in the backend. Most of the time this is useless but sometimes it is even problematic. For example, focusing an input in a modal can trigger autofill not only in the modal but also in the whole page. If there is an input outside the modal and it is recognized by the browser as a candidate to fill, bad things occur. For that reason, we set the attribute autocomplete to "none" by default for input elements. Note that "off" does not work all the time because the browsers sometimes decide to ignore it. Task ID: 2076730 closes odoo/odoo#38039 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-09-25[FIX] web: allow line return in textareasJulien Mougenot
Before this commit, textareas in x2many would not allow line return when pressing enter. Now, it does.
2019-09-23[FIX] *: hide technical field widgets in non-debug mode (Studio)Juhil Somaiya
*: - account - barcodes - calenndar - hr_timesheet - mail - mass_mailing - partner_autocomplete - web - website_slides This commit removes description of fields that should not be shown in non-debug mode Studio. Only field widgets whose own description is set are displayed in non-debug mode Studio in "Widget" of sidebar. In other words, even if any ancestor has a description but not the current widget, it won't be displayed in the sidebar in non-debug mode. Task-Id 2056992 closes odoo/odoo#35902 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-09-20[FIX] web: field color: adapted for viewsJulien Mougenot
The FieldColor widget had been designed exclusively for the document layout configurator. Because of this, the widget would not display/behave correctly in other views. Before this commit: - in list views, the widget had a "white-space" attribute adapted for char fields, which gave it much more space than it needed - there was no handling of the widget in readonly state: it was always editable - its size in list views was a bit too large Now: - all styling problems have been adjusted for list views (unchanged for forms) - the widget is disabled when in readonly mode Task 2072466 closes odoo/odoo#36949 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-09-17[IMP] web: added increments to the minutes in daterangeJulien Mougenot
Minutes can now be chosen by increments of 5 instead of 10. Task 2068164
2019-09-20[MERGE] forward port branch saas-12.4 up to 4a1321bc99dChristophe Simonis
closes odoo/odoo#37127 Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-09-17[MERGE] forward port branch saas-12.3 up to d8ce75466e4Christophe Simonis
2019-09-16[FIX] web: progress bar featureLucas Perais (lpe)
The progress bar was pretty broken before this commit. > It was not possible to input the value as text > Moving the progress bar to modify value and saving crashed > modifying the max value crashed > The whole feature was ill-defined With this commit, we fix the crashed. It is now possible to write the field behind the progress bar by moving it in RO mode or by typing the input in RW mode *if it is the value we want to write on* It it is the max value that the field targets, we can do it in RO and RW mode, only with the input as text Note that this works *only if* the editable option on the widget is set to true OPW 2061846 closes odoo/odoo#36928 closes odoo/odoo#36970 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com> Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-09-18[FIX] web: list: multi edit boolean with ENTERAaron Bohy
This rev. solves the similar issue as 801c603218, but with boolean fields. Scenario: select several records, select a boolean cell, press enter to change the boolean value. Task 2068280
2019-09-18[FIX] web: list: multi edit input of date(time) fieldsAaron Bohy
The Date(Time)Fields listen to 'input' and 'change' events (like all InputFields) to keep track of changes. However, the datepicker already listens to the 'change' event. As a consequence, in multi edition in a list view, if the user changed the value of a date(time) field by directly editing the input, the fieldChanged event was triggered twice, and there were 2 dialogs asking the user if he wanted to save the change. This rev. makes the Date(Time)Fields stop listening themselves to 'input' and 'change' events, and instead completely rely on the datepicker widget. Task 2068280
2019-09-09[IMP] web: edit translations in new dialogVincent Schippefilt
Before this commit, translations were edited in a list view with a filter on the field that needed to be translated. After this commit, the translations for each fields are translated in a dedicated dialog. The changes done to the current language are taken into account immediately, both ways, from the dialog to the form and from the form to the dialog. Translating terms is also available in create mode, the user will be prompted to save before editing a translation Task ID: 2028152 closes odoo/odoo#36185 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-09-05[FIX] base: Fix zoom on image fieldsKevin Baptiste
The goal of this commit is to adapt the zoom on image to the new names of the fields made by PR #4865. TaskID: 2049581
2019-09-05[FIX] web: kanban: global click and 'image' widgetAaron Bohy
Let's assume a kanban view with oe_kanban_global_click className (i.e. clicks on the card open the record in a form view), and an image with the 'image' widget. This is for instance the case of the hr.employee kanban view. Before this rev., clicking on the image didn't open the record in form view.
2019-08-08[MERGE] forward port branch saas-12.3 up to 752b2553c6fChristophe Simonis
2019-09-03[FIX] web: add a single pixel to handle in listsJulien Mougenot
Before this commit, handle was cropped in some views, showing an ellipsis instead of the actual handle. Now, handle has enough space to display properly. closes odoo/odoo#36387 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>