summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/basic_fields_tests.js
AgeCommit message (Collapse)Author
2018-11-14[FIX] web: restore/remove skipped testsGéry Debongnie
Some tests were skipped these last months. This is a slippery slope. The best time to reactivate them is the moment they were skipped, the next best time to reactivate them is now. So, this is what this commit does. Three kinds of tests were skipped: - 3 password tests - 2 kanban progress bar tests - one keyboard navigation test Password tests -------------- When the auth_password_policy addon was introduced, two tests in web/ were skipped, because they would fail when the auth_password_policy addon is installed. Since then, a commit was done to change the way the password field works (commit 5bbbd25edf129912ed7cdccd1005ab61bfaf2124). With this commit, the password field is no longer an 'include', but a new field widget. This means that the skipped tests no longer fails. Kanban progress bar tests: -------------------------- In saas 11.2, the 'archive all' feature was removed, but it was readded in saas 11.4. The tests had to be slightly adapted to make sure they use the proper css selectors. Keyboard navigation test: ------------------------- It is now a functional decision not to allow moving from one cell to the next by using left/right arrow, so this test is no longer valid. closes odoo/odoo#28685
2018-10-17[FIX] web: JournalDashboardGraph widgets appear at kanban views updatesMathieu Duckerts-Antoine
closes odoo/odoo#27892
2018-11-02[MERGE] forward port branch saas-11.4 up to f6ca72b3ce9Christophe Simonis
2018-10-29[MERGE] forward port branch saas-11.3 up to 6136f0c02e5Christophe Simonis
2018-10-25[MERGE] forward port branch 11.0 up to 84500c27b1cChristophe Simonis
2018-10-22[FIX] web: trim tooltip text before comparisonChristophe Simonis
The error is triggered at least on Chrome 69 on macOS.
2018-10-22[MERGE] forward port branch saas-11.4 up to 3c108977c1eChristophe Simonis
2018-10-17[MERGE] forward port branch saas-11.3 up to 0de06a41326Christophe Simonis
2018-10-11[MERGE] forward port branch 11.0 up to 717f4583949Christophe Simonis
2018-10-10[FIX] web,mrp: move test to adequate moduleChristophe Simonis
2018-10-11[FIX] web: restore broken datepicker input behaviorMartin Geubelle
In Firefox, the input behavior and visual representation (navigation, caret placement, value selection, etc.) was broken when using a datepicker (easily reproductible on date and datetime widgets). This was due to the `focus` event being stopped on the input, which doesn't seem to be correctly supported by Firefox. The deleted code was supposed to toggle the picker when the field was clicked (see odoo/odoo@89093a1) (toggle on click and disable focus) but the lib correctly supports on focus without extra code. This also fixes the fact that the datepicker was not open on focus (only on clicked). In some tests where the field was the first in the form view, it is now correctly autofocused. Forward-port: not useful from 12.0 because the code has changed with BS4 and this has already been applied in odoo/odoo@6692919 and odoo/odoo@c63630d. Closes #23438 closes odoo/odoo#27657
2018-10-10[MERGE] forward port branch 11.0 up to a69f117bbf5Christophe Simonis
2018-10-09[FIX] web: fetch dependency fields in x2manyLucas Perais (lpe)
Image field widget need the __last_update field alongside them for caching purposes, though that field should never be present explicitly in the views Before this commit, the dependencies of field widgets were not merged into the model's fields definition, creating a traceback when adding an image field widget into a x2many list After this commit, there is no traceback and the image field works properly closes #27545
2018-10-10[FIX] web: do not warn on empty fieldMartin Trigaux
If no value is specified on the datefield, do not set a warnfuture message Remove code comment that was referring the condition present at b51b0d66c2f7 but no longer present. Add tests Fixes #27551 closes odoo/odoo#27593
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-02[ADD] auth_password_policy{_signup}: password strength widgetsXavier Morel
* generic strenght meter widget which can be included in various places * password field, taking over the isPassword special cases strewn throughout the codebase, this should probably become an actual thing in core /cc @ged-odoo, the meter is opt-in as most uses of `field[@password=True]` are passwords & secrets for third-party services or external servers for which a meter would not make sense * separate override of the ChangePassword wizard which isn't a regular view for some reason * direct implementation for signup pages (create user & reset password) Skip/comment/remove existing testing of @password fields: the policy replacement/augmentation needs to make an RPC call and does not support readonly use (because it doesn't seem to be used anywhere so that made sense?); and there currently is no way to augment or override/replace existing tests, so the tests will either fail when auth_password_policy is installed (current situation) or fail when auth_password_policy is not installed (if updated to be compatible with APP).
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-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
2018-09-17[MERGE] forward port branch 11.0 up to f2b8caff07bChristophe Simonis
2018-09-17[FIX] web: datepicker: correctly use libAaron Bohy
The datepicker lib has been updated to tempus dominus (BS4) recently, but our code hasn't been adapted correctly to the requirements of the new version of the lib. As a consequence, the datepicker didn't close itself when the input was focused out anymore. This required a slight change in the DomainSelector widget as it produced a crash when a focused datepicker widget is removed from the DOM (before the datepicker is destroyed), e.g. by a call to html() on one of its parent. Task 1878254
2018-09-14[FIX] web: JournalDashboardGraph widget crash Mk.IIMOENS Alexandre
Hardening of commit:995610c065bf0242cb5023cfad2940234395739e The JournalDashboardGraph requires nv, which is lazyloaded. However it requires nvd3.js which is loaded after nv.d3.js. A function called in destroy is defined by nv.d3.js, which can make the crashhappen with the right (wrong) timing. opw 1873749
2018-09-07[MERGE] forward port branch saas-11.4 up to d78f23df848Christophe Simonis
2018-09-07[IMP] web: FieldInteger and FieldFloat can use input of type numbersvs-odoo
This allow the browser/device to handle the experience of handling number in a more native way. FieldInteger and FieldFloat now inherits from NumericField because we want to format it or not dependent of the view (readonly or edit) and the NumericField will manage it. We do that because input type number can't take a value with comma on Chrome (FireFox is more permissive but not perfect because comma is the separator for decimal in this case). Task #1880376
2018-09-07[MERGE] forward port branch saas-11.3 up to 4850fb08385Christophe Simonis
2018-09-07[MERGE] forward port branch 11.0 up to 9b602ae648eChristophe Simonis
2018-09-07[FIX] web: FieldDomain: reset field with a new domainAaron Bohy
Before this rev., there was a crash when a FieldDomain was reset with a new domain (e.g. coming from an onchange). For instance, it crashed in Email Marketing > create new Mass Mailing > select mailing lists. Introduced by 68332a01. opw-1882850
2018-09-05[MERGE] forward port branch 11.0 up to 213759b03e5Christophe Simonis
2018-08-30[FIX] web: fix evaluation context of the domain selectorAaron Bohy
The domain was instantiated without being given any evaluation context. As a result, the uid variable was not defined, crashing the js if present in a user-defined filter. opw 1866852
2018-08-23[FIX] web: BS4, restore slider checkboxesqsm-odoo
Take advantage of the new BS4 checkbox structure to simplify the widget too.
2018-08-22[FIX] web: prevent textarea vertical resize on chromeSébastien Theys
Since we correctly compute the height of the field, we don't want to let the user resize it vertically. This was already working on Firefox because it doesn't require the field to be in the DOM to read the resize attribute, but Chrome does require the field to already be in DOM. Task: 1869469 PR: #26518
2018-08-22[FIX] web: give correct size to o2m textarea at initSébastien Theys
Before this commit, a textarea inside a one2many would only have the correct size after focus or on change. When we select a line, we want all of the textarea of the line to have the correct size even if they are not directly focused. Task: 1869469 PR: #26430
2018-08-22[FIX] web: properly resize textarea when its value changesSébastien Theys
Before this commit, a textarea would not resize when its value changed if the event was different than "input" or "focus". This commit fixes it by also listening to the "change" event, and by triggering it at appropriate times. PR: #26430 Task: 1869469
2018-08-22[FIX] web: compute the correct height for textarea autoresizeSébastien Theys
The box-sizing property was not correctly taken into account. - content-box is the standard behavior: border and padding are added after the height - border-box needs attention: border and padding must be included into the computed height Task: 1869469 PR: #26430
2018-08-20[IMP] web: mobile: add swipe support in form viewsVandan Shah
This rev. allows to navigate, in mobile, through records in form views by swiping. We also moved mobile-specific tests involving a form view to the mobile test suite, since those tests became async because of the lazy loading of the swipe lib (in the mobile suite, that lib is already loaded). Related to task #34727 Co-authored-by: Mohammed Shekha <msh@openerp.com>
2018-08-17[REV] "[FIX] web:tests: do not rely on `testUtils.patch` in tests"Alexandre Kühn
This reverts commit f1a0a32e4680e44a811905aeb7d29576afd1cc7b. This utility function has been fixed with commit 1edea9326c2617900a7000f6d0dc9b41ee36e641
2018-08-16[FIX] web:tests: do not rely on `testUtils.patch` in testsAlexandre Kühn
Revision on https://github.com/odoo/odoo/commit/10f43955d81ff3e7b5ab050656b312ec19f927c5 Commit above uses `testUtils.patch` in the test. However, this utility function does not seem to work. That sucks...
2018-08-16[FIX] web: render JournalDashboardGraph when in DOMAlexandre Kühn
The lib 'nvd3' renders graph when they are attached to the DOM. However, widgets are rendered in fragments and appended to the DOM when ready (to prevent flickering). Before this commit, we used a `setTimeout(0)` and cross fingers that the widget was attached to the DOM when the `render` method was called. With this commit, the render method is called when it is attached to the DOM. Task-ID 1868252 Closes #26410
2018-08-13[IMP] base, *: use a many2one for the company report layoutChristophe Matthieu
Before this rev. one could set the report layout on the company using a hardcoded list (background, clean, standard, etc.). Other modules (typically accounting modules) could add options in this list. The used template was built on the layout key. Now, the layout is a many2one field to a newly created model `report.layout`, which is linked to a view with the layout architecture. This gives more control to customize reports and create a new layout (without creating a python module that extend the layout selection).
2018-08-13[IMP] web: float_factor and float_toggle widgetsjem-odoo
This commit provides new js widgets for list, kanban and form views on float field. 1/ 'float_factor' displays the normal float field, but takes a conversion factor as option. The displays value is the normal one multiplied by the factor. You can use the widget like <field name="my_float_field" widget="float_factor" option="{'factor': 2}"/> 2/ 'float_toggle' displays a button (in edit mode) looping on a range of given value at each click. A conversion factor is optional (default will be 1) to display a converted value, but sent to non converted one to the server. You can use the widget like <field name="my_float" widget="float_toggle" option="{'range': [0, 0.5, 1], 'factor': 2}"/> 'range' and 'factor' are put in the options. In simple read mode, the widget display the value as a traditionnal text (like a normal char field). This commit provides tests and documentation for those 2 widgets. Task #39079
2018-08-03[IMP] Portal - Share link : Easily share the url of a documentMitali Patel
Purpose ======= - Quickly share the url to someone else (a client, a colleague,...) - Ensure that the recipient can access at least the portal view of the shared record. - Typically used when a client cannot retrieve the mail to access his order. The share link can be used in this case. Specifications ============== For any object inheriting form portal.mixin: - Add a button SHARE (not visible in edit mode) - When clicking on this button, a popup opens with : - A warning message for tasks and projects only (see below) - the link (like in gmail) that can be copied - Recipients - mail composer (with preselected template) ==> see below - button [Send Link] [Copy Link] Discard - After sharing document, put internal note like "Document shared to xyz,...." with template message - Anyone with the link, even anonymous user (not logged in) can have access to the document with the access token provided in the url. Impacted models: - account.invoice (Community) - project.project (Community) - project.task (Community) - purchase.order (Community) - sale.order (Community) - helpdesk.ticket (Enterprise) Warning messages and access rules: Allowed : - SO canceled or draft will be accessible with the link with access_token - If the customer account is B2B (signup not enabled), the recipient will anyway see the document as the user specifically wants the recipient to see the document. Restrictions : - For Project and Task, if the privacy is not public, then, there is a contradiction between the access_token mechanism and the privacy of the document. - A warning message will be displayed in the share wizard to inform the user if the document cannot be visible by the recipients and to ask him to set the privacy to 'Visible by following customer'. The send button will, in that case, be hidden. - To avoid to block the share for a new project, default privacy value is now set to 'Visible by followong customer' Technical implementation ======================== - Move the access_token mechanism (field + methods + mail controller) to the portal.mixin to be able to use it in a generic way for each object inheriting the portal.mixin - Generalise a part of the _*model*_get_page_view_values method into a single one in portal - Generalize the _*model*_check_access into the portal controller of the portal module - Remove the init_column + default value for the access_token > old records have an access_token, > new one won't but it will be generated on demand via the get_access_token Done for performance reasons - Add share button into action menu separately. + kanban view context menu (except for task and project where button not in action menu but 'simple' button for task and project because other modules already provide action to send documents by email, which is not the case for project and task.) - Add a sign_token used to authentify the recipient in the portal view chatter, if any. The message will be posted as if the user was logged in. - Set the _get_share_url as private for security reason - Add a redirect parameter to _get_share_url to get If false : The direct portal view url If True : The redirect url (mail/view/?) - Cleaning up unnecessary code - Bug fix : - Before, if user was not logged and record had partner_id, if partner id was null, post message was done as admin. Now, the post message is done as public user. - If the user had an uid but had no access_token, he could be able to gain the access token of the record. check_access_rights was missing in the get_access_action. Task ID : 30985 Closes #25629
2018-08-01[MERGE] forward port branch saas-11.4 up to 8d9366197e1Christophe Simonis
2018-07-30[MERGE] forward port branch saas-11.3 up to b4555df336dChristophe Simonis
2018-07-27[FIX] web: empty input for empty password fieldAlexandre Kühn
Revision on https://github.com/odoo/odoo/commit/4b3588feb2b7e260bf237b0f3944c90cdc47c3b5 In order to not replace characters with '*' in edit mode (because of `input` with type 'password'), the above commit did not format the value at all. The formatter of a char with the option 'isPassword' turns all of its characters into '*'. That is not intended for password inputs, because the content is hidden by the browser with the 'password' type. The issue with not using the formatter is that an empty field has the value `false`, so an empty password field produces an non-empty password input with its value to 'false'. This commit fixes the issue by forcing empty string for empty password values. Note: if you use an integer field with password, falsy values (e.g. `0`) become empty strings in the input value.
2018-07-27[FIX] web: edited password fields should not contain '*'Alexandre Kühn
Before this commit, when someone was editing a password, the stored password may not be the expected one by the user. Steps to reproduce: 1. Open "Outgoing Mail Servers" form. 2. Set a password (e.g. "yop"). 3. Save, then edit. 4. Add "y" at the end of the password field. > Expected value: "yopy" > Actual value: "***y" This is due to the use of the char field formatter, which displays passwords by replacing the characters with '*'. It is not necessary to do this in edit mode, because it uses an input field of type 'password'. The browser automatically hides the value of such inputs. Any changes on a input field in edit mode uses the value of the input, so the value of an password input should contain the password, without '*'. This commit fixes the issue by using the formatter in edit mode for the input of type 'password'. Task-ID 1869565
2018-07-27[REF] *: BS4, adapt the label component structureqsm-odoo
The '.label' elements have been replaced by '.badge' elements without the 'badge-pill' class.
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, '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-27[REF] web, *: BS4, update JS media queriesqsm-odoo
* website_quote, website_sale