summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/basic_fields.js
AgeCommit message (Collapse)Author
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.
2018-01-10[MERGE] forward port branch 11.0 up to ff0abd214c8Christophe Simonis
2018-01-08[FIX] web: binary field format in list viewAlexandre Kühn
Binary fields were simply shown simply by their textual representation in list views, e.g. the base64 string. There was no formatter for binary fields, therefore it has been implemented so that it displays its estimated size. Binary fields in list views had a download link in v10.0. We provide this feature back by means of a widget called 'download_link'. It is also possible to define an option to set the field name having the filename as its value. Example: <tree> <field name="fname"/> <field name="datas" widget="download_link" options="{'filename': 'fname'}"/> </tree> with the following record: {fname: 'document.txt', datas: 'Cg=='}, we get a file named "document.txt" by clicking on the download link. Closes #21996
2018-01-04[IMP] web: support variable digitsNicolas Martinelli
In v10, a `Float` field with `widget="monetary"` option uses the decimal precision of the field. In v11, however, it uses the decimal precision of the currency. However, in many cases `widget="monetary"` is used in the sole purpose of displaying the currency symbol. The precision of the field sould be kept. This commit introduces the support of the decimal precision of the field for this specific use case thanks to the `field_digits` option: ``` <field name="pouet" widget="monetary" options="{'field_digits': True}" /> ``` If such an option is used, the field precision will prevail over the currency precision. Related to #21686 opw-800279
2018-01-03[MERGE] forward port branch 11.0 up to fe22a0f9ca9Christophe Simonis
2017-12-29[FIX] web: currency digitsNicolas Martinelli
- Set the currency rounding to 0.001 (3 digits) - Create an account move - Add an account move line, set an account When switching from edit/read-only mode, the rounding switches from 2 to 3 digits. This is because, in edit mode, the format method is the method of the float widget. Therefore, in this case, the formatting doesn't take into account the currency rounding. To avoid this, we simply use a `noSymbol` flag to avoid adding the currency symbol, while keeping the monetary rounding. opw-800279
2017-12-06[MERGE] forward port branch 11.0 up to f96a797fe62Christophe Simonis
2017-12-06[MERGE] forward port branch saas-16 up to b8540eefe3bChristophe Simonis
2017-12-05[FIX] web: BinaryFile not download when new recordLucas Perais (lpe)
Let's have: - on res.company a binary file field named x_file - on res.users a related binary field to company_id.x_file, and make it readonly - On the res.users form view, display the new field Before this commit in create mode, upon clicking on download the file, the server crashed, because the record id was empty. Then, the JS crashed in turn because of the unhandled 404 from the server. Since the id of a new record will always be unset, we choose to disable the download option in this very specific case OPW 777042
2017-12-04[MERGE] forward port branch saas-15 up to a447da75fd6Christophe Simonis
2017-12-04[REF] web: update widget to new guidelinesGéry Debongnie
- make delegate/undelegate events private - remove $el before start - make replaceElement private - remove one _ from __render_and_insert... method - update documentation - remove make and improve make_descriptive (also, it is private) - ...
2017-11-28[MERGE] forward port branch 11.0 up to 8fb25e185bbChristophe Simonis
2017-11-24[IMP] web: FieldChar trim its value by defaultAlexandre Kühn
With this commit, we change the behaviour of the web client with respect to spaces in char fields. Most of the time, starting and ending spaces have no value, and worse, make the data not so reliable. After this commit, field char will trim by default (so, if the user input a char as ' abc ', the string 'abc' will be sent to the server instead). Note that this only applies when the value of the field is changed. If someone open a form view, then switches to edit mode and save, nothing will change. This is the desired behavior most of the time. However, in some rare cases, this is actually harmful. For example, if we trim the 'decimal_point' field, it will not be possible to enter a whitespace as decimal separator. In those cases, we introduce a new attribute 'trim', which allow the developer to desactivate that feature.
2017-11-22[FIX] web: readonly monetary field onchange currencyAlexandre Kühn
Before this fix: A readonly monetary field was not updating its currency symbol when selecting another currency. Scenario: 1. Activate multi-currency with $ (default) and € 2. In hr_expense, go to My Expenses to Submit 3. Create a new expense 4. Select 'EUR' as currency => Unit Price is correctly updated with €, but not Total. With this fix: Total displays the correct currency in edit mode. Explanation: Monetary fields in readonly are relying on _formatValue() to display their value. _formatValue() uses this.formatOptions.currency, which stores the currency at loading of the field. We must update its value whenever there is a change of currency. opw-783378
2017-11-13[FIX] web: JournalDashboardGraph widget crashAaron Bohy
The JournalDashboardGraph requires nv, which is lazyloaded. Before this rev., a crash occurred when this widget was instantiated and destroyed before the loading of the lib was complete (because a function of the lib was called in destroy()). For instance, press F5 (to ensure that nv isn't already loaded), activate some throttling in the network tab, go to Accounting and as soon as the dashboard shows up, click on another menu. opw 781628
2017-10-27[MERGE] forward port branch saas-16 up to 8fdac4b6b2fChristophe Simonis
2017-10-25[FIX] web: image widget is dependent on its record's last_updateLucas Perais (lpe)
As a way to optimize loading, images are not necessarily fetched in db. They have, in their url a "unique" parameter, which is the last_update date on **the record** and controls on the python-side whether it should get the image from a cache or from the db. Before this commit, this __last_update field wasn't present in the view, so it wasn't fetched, and writes on a model's image worked but did not refresh. The image displayed was the old one. After this commit, when the image field widget is present, we force the loading of the __last_update field of the record. Upon update, the image displayed is the new one. OPW 777552 closes #20457
2017-10-25[MERGE] forward port branch saas-16 up to 7bfde6e05d1Christophe Simonis
2017-10-24[FIX] web: allow onchange to modify origin fieldGéry Debongnie
With this commit, we allow an onchange coming from a field to modify the same field. This was not working for field widgets derived from an input field.
2017-10-20[MERGE] forward port branch saas-16 up to dc2a6c6cd2aChristophe Simonis
2017-10-20[FIX] web: deal with `date` widget on datetimeMartin Geubelle
This use case was not correctly managed as the function evaluating if the value has changed compares datetime and date. This triggered an issue if the widget `date` was set on the field `date_order` on a purchase order for example ; it was not possible to create a record as the datapoint was set `dirty`. This rev. ensures that a `field_changed` is not triggered if the day is the same on a date widget. This rev. also adds support of `datetime` fields on date widget, which appears to be a valid use case. Fixes https://github.com/odoo/odoo/issues/20311
2017-10-20[FIX] web: correctly render the field imageMartin Geubelle
Before this commit, the image was directly built without using the corresponding template, which set some properties on the image (class, width, etc.).
2017-10-18[FIX] web: domain field should never be considered unsetqsm-odoo
Indeed, false was already considered as "[]" in edit mode.
2017-10-16[FIX] web: tab navigation with phone widgets in form viewKhoi Nguyen
This commit ensures that tab navigation works properly when editing a form view that contains input fields with phone widgets. Previously, pressing TAB would skip those fields.
2017-10-16[FIX] web: tab navigation with phone widgets in form viewKhoi Nguyen
This commit ensures that tab navigation works properly when editing a form view that contains input fields with phone widgets. Previously, pressing TAB would skip those fields.
2017-09-28[MERGE] forward port branch saas-16 up to 89df681b458Christophe Simonis
2017-09-26[FIX] web: fix o_row mechanism with phone fieldDavid Monjoie
The o_row class mechanism is supposed to be used to put another element next to a field, like a button for example. However, in the case of phone and email field, the o_text_overflow hack gets in the way. The problem that o_text_overflow is trying to solve is when you have a long email, the table used to display the form view fields tends to use very long cells (td) so it can display the whole email address. This behavior completely breaks the form view, even though the email address is clearly set to wrap in css. The o_text_overflow class is a hack that forces the table to think that the email is small, then defaulting to the width 50% css rules. If the email is too long, it is correctly wrapped inside the cell, without breaking the form view layout. However, when we need to add a button next to those fields, this hack gets in the way of the o_row class css rules, completely wrecking it. We looked for a fix with qsm-odoo for hours but were unable to find one that did not require a complete rewrite of the form view css rules. In the end, we decided to remove the hack from the phone field and keep it on the email field, as we think it is less common to have a very long phone number than to have a very long email.
2017-09-26[FIX] web, google_drive: fixed display of field linkLucas Perais (lpe)
Before this commit, a field handled with a widget url was given its value (href) as its text, fully displaying the url. Moreover, the display was odd and did not match that of buttons After this commit, if the field contains a text attribute, we use is as the text of the link. The link also correctly displays and looks like a button (in a form view) Of course, a test for this new field widget feature is implemented closes #19587
2017-09-25[ADD] web: link_button widgetMartin Trigaux
Add a widget to make a link to an external page in a tree view
2017-09-20[FIX] web,base: document template widget in settingsDeep Patel
Go to General Settings, click on 'Change Document Template', and in the opened dialog, click on a template. Before this rev., it automatically closed the dialog, which was not really convenient. This rev. introduces a new field widget (image_selection) for this use case, and ensures that the dialog doesn't close when a template is selected. Test written by @mba-odoo
2017-09-19[MERGE] forward port branch saas-17 up to 2a343d7c9c4Christophe Simonis
2017-09-19[MERGE] forward port branch saas-16 up to c3a48da767bChristophe Simonis
2017-09-19[FIX] web: FieldDomain: don't open record from selectionPratima Gupta
The FieldDomain allows to open a list in a dialog to display the records matching the current domain. In this dialog, clicking on a record should do nothing (this was the behavior before the new views). Before this rev., it actually tried to open the record and it produced a crash.
2017-09-18[FIX] *: fix a bunch of incorrectly documented docstringXavier Morel
Fix a bunch of ill-documented/incomplete/incorrect method docs Without this, the automatic doc generation does not work.
2017-09-06[REF] web: review graphs layoutstefanorigano
2017-08-31[IMP] web: lazy load nvd3, ace and fullCalendar lib to reduce asset sizeChristophe Matthieu
2017-08-31[MERGE] forward port branch saas-17 up to fe77df3ba48Christophe Simonis
2017-08-30[MERGE] forward port branch saas-16 up to 600d0159387Christophe Simonis
2017-08-29[FIX] web: always display handle widgetKhoi Nguyen
Before this commit, a list containing a handle widget would only display the handles associated with non-zero integer values. This is due to the fact that unset fields are hidden in Odoo, while a field is by default considered 'defined' if its value is truthy. We override the isSet method for the handle widget to always return true. This tells the handle widget that the associated integer value is always defined, thereby ensuring that the handle will always be shown.