summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields
AgeCommit message (Collapse)Author
2019-07-25[FIX] web: hide dashboard tooltip on page changeJulien Castiaux
Go to CRM/Sales/Team Pileline. Place your cursor on the chart, a tooltip appears, move your cusror away, the tooltip disappear. Now clic anywhere on the interface so the page change (i.e. on "x Open Opportunities") and quickly while the page loads place your cursor on the tooltip, it appears but when the page change it doesn't disappear. The problem here is that the graph element is removed from the DOM which prevent the correct handling of the `mousehover` event used internally by nv.d3 to show/hide the related tooltip. The solution is to manually hide the tooltip when the graph element is removed from the DOM. opw-2042286 closes odoo/odoo#35172 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-06-27[MERGE] forward port branch saas-11.3 up to 2f2bc67c067Christophe Simonis
2019-06-27[MERGE] forward port branch 11.0 up to b1d43cc80e2Christophe Simonis
2019-06-27[MERGE] forward port branch saas-15 up to d090c92782aChristophe Simonis
2019-06-07[MERGE] forward port branch 11.0 up to bdc62d80314Christophe Simonis
2019-06-03[FIX] web: binary fields correctly resetsJulien Mougenot
When uploading a file to a binary file, then clicking on the "clear" button, then reuploading the same file... Before this commit: The actual input of the field was only changed on user input. This means that the "clear" action didn't reset the actual value of the input, and the browser's default behaviour when getting the same path twice is not to change anything. In the use case, you couldn't upload the same file until you uploaded another one. After this commit: The "clear" action now also clears the value, allowing reuploading the same file over again. closes odoo/odoo#33843 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-06-07[MERGE] forward port branch saas-11.3 up to a2582c4252aChristophe Simonis
2019-03-08[MERGE] forward port branch 11.0 up to e5f93b83c68Christophe Simonis
2019-03-07[FIX] web: add a fallback for `kanban_label_selection`Martin Geubelle
Before 11.0 the kanban view used to have its own widget registry. It is not the case anymore, but there are still leftovers from the past. For example, the widget `kanban_label_selection` is still used in many views, even though it is now called `label_selection`. As we are in a stable version, a fallback has been added for it in the field registry. Similar to odoo/odoo@5401c15 Closes odoo/odoo#30904 Closes odoo/odoo#25928
2019-03-05[MERGE] forward port branch 11.0 up to 27081bf6f5fChristophe Simonis
2019-03-04[MERGE] forward port branch saas-15 up to 1f1fa35c072Christophe Simonis
2019-01-23[MERGE] forward port branch 11.0 up to 984a99611eeChristophe Simonis
2019-01-23[MERGE] forward port branch saas-15 up to 3cba1862d44Christophe Simonis
2018-11-28[MERGE] forward port branch 11.0 up to bb6f6c57f97Christophe Simonis
2019-04-12[FIX] web: checkbox readonly is RO in list editableNicolas Lempereur
Since f4fbaf1efa the structure of checkboxes has been improved, now we have something like: ``` <input type="checkbox" id="checkbox-18" class="custom-control-input"> <label for="checkbox-18" class="custom-control-label">&#8203;</label> ``` With the first input invisible (whilst before it was visible and the clickable element). This cause an issue in an editable list view: - we have a boolean readonly field in a cell - we are on focused on a line (not in the boolean field cell) - we click on the boolean field => the check mark is toggled This is because when we switch cell, we try to activate the widget of the other cell. Before f4fbaf1efa this issue did not happen since the browser do not generate a click event when clicking a disabled checkbox. With this changeset, a disabled FieldBoolean is not focusable as is the case for other fields, so we can't "activate" it. Without the fix, the added test fails with: [clicking disabled checkbox did not work] opw-1958433 closes #32652 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-04-10[FIX] web: FieldFloatToggle cell multi languageLucas Perais (lpe)
Have a timesheet uom per Day Have a language with a different number format than English Click on grid cell to change its value Before this commit, the value was stuck on the highest value in range This was because the parsing of the value into float was not taking into account the real format of the float After this commit, it works in all languages OPW 1964657 closes odoo/odoo#32581 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-03-08[MERGE] forward port branch saas-11.3 up to ecd8c023b7cChristophe Simonis
2019-03-06[FIX] web: hide CopyClipboard widget button when pointlessMartin Geubelle
The widget has been moved in rev. odoo/odoo@15f3bbe but was not very generic. In particular, there was a traceback when clicking on the button if the field had no value (the button was displayed for readonly fields in create mode). The button is now only appended in readonly mode (a `button` inside an `input` or a `textarea` is not very DOM friendly) if the field has a value. Task 1941996 closes odoo/odoo#31635 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2018-11-27[FIX] web: progressbar updates on field resetLucas Perais (lpe)
Have a form record with a progress bar Modify the max_value of the progress, as well as the current_value bar through an onchange Before this commit, the new max_value was not taken into account After this commit, it is. closes odoo/odoo#29056
2018-11-26[FIX] web: propagate can_create into the search popupLucas Perais (lpe)
When creating a SO line and clicking on search more for product_id Before this commit, every user had the button "Create" to create a product.product After this commit, only user in groups that actually can create a product have the button OPW 1910371 closes odoo/odoo#28924
2019-03-06[MERGE] forward port branch saas-11.3 up to 3e54704e669Christophe Simonis
2019-02-27[FIX] web: avoid crash when clicking on colored m2m in listMartin Geubelle
With the BS4 update, a traceback occured when clicking on a m2m tag using colors in a list view. When using colors on m2m tags, the badge was wrapped inside a `dropdown-toggle`. However, there is no `dropdown-menu` by default (it is only rendered in FormFieldMany2ManyTags when clicking on the `.dropdown-toggle`, hence the traceback. The `dropdown-toggle` class is now only set if necessary. Task 1925313 closes odoo/odoo#31445
2019-02-04[FIX] bus, mail, web: missing super() call in destroy overridesXavier Morel
closes odoo/odoo#30792
2019-01-25[MERGE] forward port branch saas-11.3 up to 387d5cff90bChristophe Simonis
closes odoo/odoo#30566
2019-01-17[FIX] web: remove the report_layout from studio selectable widgetsNans Lefebvre
Open studio to modify the widget displaying a relational field. The report_layout widget can be selected, say, to display payment terms. Obviously it doesn't make sense. We remove its supported field, as the field is not generic (indeed there is only one use for it in the codebase). opw 1919369 closes odoo/odoo#30303
2019-01-09[FIX] web: decimal separator of percentageNicolas Martinelli
When a percentage if formatted, the decimal separator used is always `.`, while it should be the decimal separator of the language. opw-1908220 closes odoo/odoo#30030
2018-11-29[MERGE] forward port branch saas-11.3 up to c0eef427111Christophe Simonis
2018-10-16[MERGE] forward port branch 11.0 up to b29b545fe84Christophe Simonis
2018-10-10[MERGE] forward port branch 11.0 up to a69f117bbf5Christophe Simonis
2018-10-12[FIX] web: prevent URL click from opening a recordSébastien Theys
If we click on a link, we only want to open the URL, and not the record when the button is on a list. PR: #27230
2018-10-12[FIX] web: don't allow reference widget to be set on char fieldslen-odoo
The reference widget is expecting a models list as selection attribute in the field declaration. It does not exist in the case of the char field. Support for char fields was added to allow for external identifiers, but it only works in readonly. As a consequence, it tracebacks in Edit mode when used in studio. We thusly remove char field from the list of supported fields. opw 1892602 closes odoo/odoo#27708
2018-11-19[FIX] web: dateField datepicker don't propagate field optionsLucas Perais (lpe)
In a form view (account.invoice), have a date field as: <field name="date" options="{\'datepicker\': {\'warn_future\': true}}"/> Open a record with the field set to a value Click Edit, click save Click create Before this commit, the value of the field of the new record took the one of the previous record On account invoices, it resulted on having the popup "The record has been modified etc...." And it was not possible to create an invoice from another one this was because we passed the same reference object for the datepicker After this commit, there is no popup as the field do not take a value from the framework OPW 1906085 closes odoo/odoo#28759
2018-11-19[FIX] web: remove debuggerAaron Bohy
closes odoo/odoo#28798
2018-11-08[FIX] web: format function missing in percentage widgetJulien (juc) Castiaux
The format function was missing for the percentage widget type, so `field_utils.parse[this.formatType]` (see [1]) resolved as `undefined` which is not a function and so raised an error when the user was trying to update the field. This PR add that parsing function. Both `xx%` and `0.xx` are understood by the parser and resolve to the correct float value. opw-1895979 [1] https://github.com/odoo/odoo/blob/e220721a8ee80c02fe5aba5ed8c9f3f4ae54ea97/addons/web/static/src/js/fields/abstract_field.js#L399 closes odoo/odoo#28431
2018-11-06[MERGE] forward port branch saas-11.4 up to dc35de9d30bChristophe Simonis
2018-11-05[FIX] web: re-evaluate column_invisible after onchangeMohammed Shekha
Let's assume a form view with field A and B (a one2many list), with a column with attrs column_invisible depending on A. If the user sets A manually, everything works fine (the column is hidden/shown directly). However, if A is updated by an onchange (e.g. depending on the number of rows in B), it doesn't. This rev. fixes that issue. Related to Issue: 1851451 Co-authored-by: Priyanka Kaakdiya <pka@odoo.com>
2018-10-29[FIX] web: display of timezone mismatch select widgetLucas Perais (lpe)
On the user's preference, change the timezone to one that is different from the browser. Save the form. Go back to the user's preferences. Before this commit, every timezone was displayed inside the span that contain the warning icon, and leaked everywhere on the form view. This was because of the joint action effects of commits: 86897ca167338ca434e62827fa09f44ddbce324c 4dfabb8f7adde06a7936502af61534c9958ed4f7 Which provoked the field to be re-rendered in edit mode, but with an $el on which a span was added. `<option/>` elements were then added to both `<select>` and `<span>` This did not happen before v12.0 After this commit, there is no display glitch OPW 1895088 closes odoo/odoo#28108
2018-10-22[MERGE] forward port branch saas-11.4 up to 3c108977c1eChristophe Simonis
2018-10-18[FIX] web: File upload input on_clear event not propagatedTWA
The handler function was used directly in the code. The MouseEvent wasn't provided in that case. This FIX split the handler function and the processing function so that it doesn't interfere. closes odoo/odoo#27929
2018-10-17[MERGE] forward port branch saas-11.3 up to 0de06a41326Christophe Simonis
2018-10-09[FIX] web: Make datetimepicker configurable in datetime fieldssvs-odoo
The datetimepicker option was introduced to be able to customize the datetime picker widget in date/datetime fields. However, due to the way the _makeDatePicker function was coded, it did not work in datetime fields. Thank to Yajo for the initial fix closes odoo/odoo#27541
2018-10-03[ADD] *: support SVG imagesPedro M. Baeza
Introduce official support for SVG files in the framework, including the following parts: 1. When client-side SVG images are uploaded, the content is displayed until you save using data URI scheme according RFC 2397 [1]. This scheme requires to specify content format. Using hardcoded "image/png" works for all images types except SVG. Type-sniffing is done using "magic byte" detection via the first base64 encode byte, so that the proper data URI scheme can be used. This should not cause SVG-related security problems as the file is displayed through `<img>` tag, which does not allow SVG scripting [2]. 2. Make /web/image controller compatible with SVG 3. Add support for SVG files for company logo, which uses a dedicated controller. 4. Resizing of SVG files is a no-op, as it makes little sense for a vector-based format. We also want to avoid micro-alterations to the SVG document (in "natural" viewport parameters) as we would store multiple copies of the files in the filestore. 5. Because SVG files are inherently dangerous, upload of SVG files is restricted to administrators, either by blocking it directly before saving it in the database (binary fields with attachment=False), or by neutering them to text/plain mimetype (for binary fields with attachment=True) 6. Add tests for the SVG upload cases and for the non-admin uploads. [1] https://tools.ietf.org/html/rfc2397 [2] https://www.w3.org/wiki/SVG_Security Closes #26635
2018-10-01[IMP] product,(website_)sale: Product configurator default_get cleanupAurélien Warnon
Targets commit d3530eb07e24278117ab396ecb86a59deecc312d Purpose ======= [Follow up AL review] Removed the default_get override in the sale_order_line model. - The default values to create records are now specified by pefixing them with "default_" in the JS. That will use the built-in framework method, which is more simple/clean. - The "list_editable_renderer.js" file for the product configurator was removed and its content is now merged within the SectionAndNoteListRenderer. Updated fields: - [sale_order_line in sale/sale.py] "product_no_variant_attribute_values" to "product_no_variant_attribute_value_ids"
2018-09-27[FIX] web: human numbers and percentagesMathieu Duckerts-Antoine
A recent modification of the float and integer formatters allowing the rendering to be human readable causes a bug in the percentage formatter for large values. The reason is that the latter formatter uses formatFloat (wich can now produce 'numbers' like 3k) and then parse the result. In the case of 3k an error is raised since 3k is not recognized as a true number. This fixes avoid to parse the number in case it has been formatted to be 'readable'. Note that the parsing was essentially used to produces better percentages like 10% instead of 10.00%. This is not necessary in our case since utils.human_number takes care of the unwanted (not all) decimals for us (the original number is always rounded by utils.human_number).
2018-09-26[IMP] web: readable format of numbersMathieu Duckerts-Antoine
The functions 'formatFloat' and 'formatInteger' now format a number x like utils.human_number when a predicate 'humanReadable' is available in options and humanReadable(x) is true.
2018-09-26[FIX] web: fix date picker fields do not capture the focus event when invisibleVincent Schippefilt
Before this fix, in form view, when a datepicker was not visible (because they were on another page or literally invisible), when the user pressed TAB and the datepicker was positionned after the current field in the form, it was capturing the focus during the activate phase of the navigation_move. This is not correct for invisible elements. After this fix, only focusable datepickers get the focus during the activation phase of the navigation_move. co-author: aab-odoo (aab@odoo.com)
2018-09-25[IMP] framework js: improve X2Many 'CREATE' operation to handle multiple recordsAurélien Warnon
Purpose ======= The 'CREATE' operation lacked the possibility to handle multiple records. The 'context' parameter is now an array of dict that contains the context for each new record. This is usefull when you want to create multiple records into a list in a single call. Please note that the 'default_get' is still called once for each record in an async way.
2018-09-25[IMP] product,(website_)sale: Move product options configurator into sale moduleAurélien Warnon
Task #1871557 Purpose ======= - Configure a product from a sales order as easily as in the ecommerce The backend uses the same template as the frontend to configure a products and its options - Display optionnal products of optionnal products in the "sale options" section - Allow adding exlusions to some combinations of the product and/or to some combinations of the optionnal and accessory products Specification ============= PHASE I 1. Improve the "Add to cart" with optional products - When you add an option to cart, move the product to the cart & show the options of this option - Don't open the option wizard if no option available (in case this module becomes generic, it's better to skip this step when it's not needed) - Display the options right under their related product in the cart 2. Do not allow to add the product as an optional product for itself Why ? - No functional sense - Creates issues in the add to cart wizard 3. Exclude some attribute combinations within the product or with related options and accessory products - Rename VARIANT PRICES button -> CONFIGURE VARIANTS - When you click this button and select a value, open form view rather than inline edition - Form view of variant values: - Attribute - Value - HTML Color Index - Attribute Price Extra - Not Compatible with: o2m tab with 2 fields: Product AND Attribute Value (of this product) [m2m tag selection] - in any new line, autocomplete the current product by default - Tooltip: A list of product and attribute values that you want to exclude for this product's attribue value. Also applies on optionnal and accessory products. 4. New option to configure a product in a sales order line - This option is only visible if the corresponding option is activated in the sales settings - It opens a wizard to select a product template, configure related attribute values and select optional products (based on frontend view) - Attributes not compatible with other selected attributes should not be selectable - Must work like in the frontend
2018-09-25[FIX] web: improve automatic creation of new lines in x2many in formsVincent Schippefilt
This commit fixes a few issues with the previous implementation of the automatic addition of new lines in x2many inside forms 1. Before this commit, when there is a change of mode in a formview `edit` -> `readonly` -> `edit`, there may be some cases that mistakenly and automatically opens a modal. This case occurs in a form view with a x2many field whose 1st inner focusable element opens a modal (e.g. "Add an item"). In `edit` mode: 1. Open this modal from the x2many 2. Close the modal 3. Change mode to `readonly` 4. Change mode to `edit` > the same modal is automatically open. This is due to the tracking of the last activated field that persists after a change of mode. Since the last activated field in the 1st `edit` is the x2many, it is granted the focus at the beginning of the 2nd `edit`, which automatically opens the modal. This commit fixes the issue by resetting the tracking of the last activated field when there is a change of mode. As a result, at the beginning of the 2nd `edit`, the focus should always be on the 1st field. 2. Before this commit, if the focus was moved out of the form (to a modal for instance) then back, the form would re-activate the last field, which is the x2many and would re-add a new line. This behavior is not correct and now going back from a modal to a form does not add a new line. Co-authored-by: Alexandre Kühn <aku@odoo.com>
2018-09-25[IMP] web: x2many adds a new line by tabbing on a not dirty lineVincent Schippefilt
Before this change, when the focus was on the first field on a x2many field, and the user pressed TAB, the line would be discarded and the focus moved to the next field (at the level of the x2many) in the form. This was an issue because if the first field was required, the focus could not be moved out of the field with TAB so the user had to discard the line manually (with ESC) before moving to the next field This change works with 2 changes: 1. detecting if a line is dirty (has been modified by the user) and at the end of the line, decide to either - discard the line and move the next field, if the line is not dirty - commit the line and add a new line, if the line is dirty 2. allow users to use TAB through required field inside x2many so they can easilly go to the end of the line. Task id : 1872248