summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/basic_fields.js
AgeCommit message (Collapse)Author
2019-06-17[MERGE] forward port branch saas-12.3 up to 48a9f5a6335Christophe Simonis
2019-06-14[MERGE] forward port branch saas-12.2 up to 498b4b4350dChristophe Simonis
2019-06-11[MERGE] forward port branch 12.0 up to 7ef4ba03c4fChristophe Simonis
2019-06-07[MERGE] forward port branch saas-11.3 up to a2582c4252aChristophe 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-05[IMP] *: use new helper config.isDebug()Romain Derie
Before this commit, both config and session were aliases to odoo.debug. Now, config.isDebug() should be call, with possibility to pass a parameter to check if we are in a specific debug mode such as 'tests' or 'assets'. task-1934445 Coming with https://github.com/odoo/enterprise/pull/4281 Closes https://github.com/odoo/odoo/pull/33213
2019-05-06[MERGE] forward port branch saas-12.2 up to 78b3b650b0dChristophe Simonis
2019-05-22[FIX] web: pdf file not previewedParth Choksi
The pdf_viewer widget fails to load file and hence shows error. This is due to the wrong controller called(wrong URI passed), while loading a file using pdfjs. For files other than images, /web/content controller should be called since since odoo/odoo#31811. This is similar to the enterprise fix 793c76298a2b301a2 task-1932190 closes odoo/odoo#33354 Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-05-21[IMP] web, *: add utils to get dataURL (base64) from file/blobSébastien Theys
* = partner_autocomplete, point_of_sale, web_editor, website_forum, website_slides This can be used for example to preview an image from a file input field. It can also be used to send the base64 content of the input by RPC instead of having to rely on form submit as POST with multipart/form-data. Technically wrap FileReader.readAsDataURL in a Promise. This will also be used in task-1930726 PR: #33508 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-05-13[MERGE] forward port branch saas-12.3 up to 60e71302a38Christophe Simonis
2019-04-03[FIX] web: removed extra space from graphPriyanka Kakadiya
- when refresh a kanban dashboard page which contains graph, there is some extra div appends to the graph. - so if svg is there in the dom, no need to append it again. simply use the existing svg Related to Issue: 1943483 closes odoo/odoo#32279 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-05-07[FIX] web: correctly display list column nameMartin Geubelle
Rev. odoo/odoo@5dc971b introduced a `description` attribute on AbstractField. Sadly, the attribute was already used for something else (in `handle` and a widget in asset, to hide the column name). So the widget new description is now displayed in the list header (instead of the field name). A new attribute `noLabel` has been now added on AbstractField (currently only used in list) to fill the same purpose as the previous `description`. Task 1981757 closes odoo/odoo#33060 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-04-02[IMP] web,account: editable list: no more position absoluteAaron Bohy
Before this rev., widgets were absolutely positioned in table cells. This cause an undesired effect with text fields, as their textarea overflowed and overlapped the next lines. With this rev., wigdets are now statically positioned, and the cells height and width don't change when switching a row to edit mode. Part of task 1915702
2019-04-02[IMP] web: editable list: table-layout: fixedAaron Bohy
This rev. changes the layout of *editable* list views to a fixed layout. This means that we are now responsible of the width of each column. To do that, we associate with each field type a factor, and the higher the factor is, the larger the column will be (w.r.t. the others). This default value can be overriden in the arch. The fixed layout allows to remove the absolute positionning of widgets inside editable lists (done in the next commit). Part of task 1915702 Co-authored-by: Martin Geubelle <mge@odoo.com>
2019-05-02[MERGE] forward port branch saas-12.1 up to b11930047f6Denis Ledoux
2019-04-17[MERGE] forward port branch 12.0 up to 2830b93a3a7Christophe Simonis
2019-04-12[MERGE] forward port branch 12.0 up to 385342b575fChristophe Simonis
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-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-03-11[MERGE] forward port branch saas-12.1 up to 2b3296bbf8bChristophe Simonis
2019-03-08[MERGE] forward port branch 12.0 up to c023d0784f2Christophe Simonis
2019-02-22[MERGE] forward port branch saas-12.1 up to 0f4abc5c228Christophe Simonis
2019-02-21[MERGE] forward port branch 12.0 up to 84143a34b31Christophe 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>
2019-04-01[REF] reimplement journal dashboard widget with Chart.jsGéry Debongnie
This commit is one part of the task 'removing nvd3'. We use now Chart.js to draw charts. Task ID: 1946138
2019-03-13[MERGE] forward port branch saas-12.2 up to c9f832d9f03Christophe Simonis
closes odoo/odoo#31790 Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-03-06[REF] web: adapt code after jQuery updateVincent Schippefilt
Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2019-02-14[IMP] web Add widget signature on binary fieldjbm-odoo
Add a new widget for binary fields. It open a dialog box and the user can sign manually, or an signature can be draw automatically or he can upload a picture of his signature. Move fonts, controller, scss,templates about signature from portal to web to avoid redundance closes odoo/odoo#30222
2019-02-13[IMP] web, *: remove explicit references to `session_id`Martin Geubelle
Since rev. odoo/odoo@f4d541e the `session_id` cookie uses the `httponly` flag so it cannot be accessed through client side script. But before this rev. the `session_id` was still provided by the server to the webclient (in session_info, mostly) and was stored and accessible. This made XSS injection more dangerous than they should be as it was very easy to steal the `session_id`. As the browser automatically set the `session_id` on every request to the server, the webclient shouldn't need any explicit reference.
2019-02-04[FIX] bus, mail, web: missing super() call in destroy overridesXavier Morel
closes odoo/odoo#30792
2019-01-31[FIX] web: fixed leak on image fieldsVincent Schippefilt
During the unit tests, I have noticed that the test window was doing a lot of work after the test were completed, it was using CPU and using RAM in jigsaw pattern. Eventually after being left alone for a few hours, the window would just crash. This was due to an unlimitted chain of deferred running when an image field had a load error. The situation is as such: 1. The image is put in the DOM with an onError handler 2. There is an error, as the image is a dummy text for the tests 3. The onError is called, it clears the image field, then calls _render 4. _render re-adds an image with the same onError handler <---------- 5. The onError is called - again - it clears the image field - again | (wich does nothing this time because the value is the same) - | then calls _render - again | 6. The second time _render is called, go to step 4 -------------------- ... In the meantime, the widget has been destroyed by the test, so it should not do anything anymore. This fix breaks the loop, as well as bind the onError handled with 'one' instead of 'on'. closes odoo/odoo#30716
2018-11-28[MERGE] forward port branch 11.0 up to bb6f6c57f97Christophe Simonis
2018-11-29[MERGE] forward port branch saas-11.3 up to c0eef427111Christophe Simonis
2018-12-05[IMP] web: state_selection widget readonly if field readonlyPierre Masereel
The current implementation of the state_selection widget always makes it editable even if the field is readonly. We improved this behavior by removing the handle of click on the widget when the field is readonly, but keeping it even if the view is not in edit mode, because it used for example in project to change state even when view is not editable. closes odoo/odoo#29218
2019-04-24[IMP] web, *: add a description to generic widgetsJuhil Somaiya
A `description` key has been added on AbstractField and all generic field widgets ; it is used to display a more user friendly name (both in the webclient and in Studio). Non-generic field widgets have an empty string as description. Related task 1918327 closes odoo/odoo#30131 Signed-off-by: Martin Geubelle (mge) <mge@openerp.com> Co-authored-by: Mohammed Shekha <msh@openerp.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-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-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-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-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] 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
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