summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/basic_fields_tests.js
AgeCommit message (Collapse)Author
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-06[FIX] web: tests: load template before FieldColor testsAaron Bohy
The ColorPickerDialog lazyloads its template. In the test environment, nothing was done (except for a single nextTick) to ensure that the template has been loaded before interacting with the dialog. This led to non deterministic failing runbot builds. Also correctly load the signature template before running its tests instead of doing two chelou nextTick(); closes odoo/odoo#36511 Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2019-09-03[FIX] web: datepicker: crash on invalid dateHarpritsinh Sisodiya
There is an open issue on the tempusdominus lib: https://github.com/tempusdominus/bootstrap-4/issues/223 It occurs when there is a valid value in a date(time) field, and the user unsets it by setting an invalid one. This rev. fixes the issue in Odoo by preventing to reach the buggy piece of code in the lib. In a few words, when the user sets an invalid date, we reset the previous valid date (which is what the lib tries to do anyway). Task 2057009 closes odoo/odoo#36211 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Aaron Bohy <aab@odoo.com>
2019-09-11[MERGE] forward port branch saas-12.3 up to 50e571acf7cChristophe Simonis
closes odoo/odoo#36491 Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-08-26[REF] web,*: native event dispatching in test utilsJulien Mougenot
*: mail,partner_autocomplete: adapted tests Added a new function to trigger the adequate type of event on an element (native JS event to DOM Nodes and jQuery event to jQuery objects), and refactored the generic event-triggering functions to call this new function.
2019-06-14[MERGE] forward port branch saas-12.2 up to 498b4b4350dChristophe Simonis
2019-06-17[MERGE] forward port branch saas-12.3 up to 48a9f5a6335Christophe Simonis
2019-06-11[MERGE] forward port branch 12.0 up to 7ef4ba03c4fChristophe Simonis
2019-06-06[MERGE] forward port branch saas-12.3 up to 409679866b2Christophe Simonis
2019-06-03[MERGE] forward port branch saas-12.2 up to 995aa1685eeChristophe 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-07-29[IMP] base: Configure document layoutJulien Mougenot
The onboarding modal for setting up the few base fields of a company has now been moved to a wizard It is accessible from the general settings, but also in the onboarding section of sale and account modules. The following company settings are editable with that wizard: - Set report **layout**: The user can chose the overall look of the report. The current choices are : *Standard* (default), *Background*, *Boxed* and *Clean*. - Set company **logo**: Changes the company logo. - Set report **colors**: The user can set the primary and secondary colors of the report through a newly added widget allowing to pick a custom color. When changing the **logo**, colors are automatically set to its most dominant colors. > A "Reset colors" button also triggers the color calculation. - Set report **font**: Changes the overall font of the report. Only Google Fonts are used for enhanced compatibility. - Company **tagline**, also called "header" - **Footer** - **Paper format** - Report **preview**: A mockup of a final report Automatically updates when changing **layout**, **logo**, **colors** or **font** Co-authored by: Julien Mougenot <jum@odoo.com> closes odoo/odoo#33863 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com> Co-authored-by: Lucas Perais <lpe@odoo.com>
2019-07-19[FIX] web: FieldDomain: open selection with field contextAaron Bohy
Closes #33658 closes odoo/odoo#34989 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-07-18[IMP] web: add new date range picker field widgetJigar Patel
Adds a new widget to support start & end date or datetime. closes odoo/odoo#33266 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-07-12[REM] web: Remove toggle_button widgetYannick Tivisse
This widget is not used anymore, as all the stat buttons have been removed from the views.
2019-07-09[IMP] web: add simple calculator on numeric fieldsCedric Snauwaert
Add a new behavior to numeric fields, possibility to enter value manually or to use a simple arithmetic expression that will be evaluated. Example: =20+3*2 In order for the computation of the arithmetic expression to be done, the value needs to starts with = and then an expression can be entered. We only support the basics mathematical operations + - * / ( ) ^ User locale and digits separator are taken into account. If the value entered can't be evaluated to a numeric, the field will be displayed in error. closes odoo/odoo#34538 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-04-12[FIX] web: do not open datepicker on focusAaron Bohy
Before this rev., the datepicker was opened when a date(time) field was focused (e.g. with keyboard navigation). We don't want this behavior anymore, and we want the datepicker to open only when the user clicks in the input. This rev. makes this change. Moreover, this allowed to refined the keyboard navigation (ESC) in editable list views: when a datepicker is opened, and the user presses ESC, we close the datepicker, but we keep the row in edition, whereas before this rev., the row was switched to readonly. closes odoo/odoo#32408 Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>
2019-05-17[MERGE] forward port branch saas-12.1 up to d785adba6c0Christophe Simonis
2019-05-17[MERGE] forward port branch 12.0 up to c545783b95bChristophe Simonis
2019-05-15[FIX] web: Error on invalid date format on date field inputGoffin Simon
Steps to reproduce the bug: - Go to any field Date - Enter wrong date Bug: A traceback was raised. Now a warning is raised and the wrong value is removed. opw:1974747 closes odoo/odoo#33362 Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-05-27[IMP] web: correct typoSwapnesh Shah
closes odoo/odoo#33070 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
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-13[MERGE] forward port branch saas-12.3 up to 60e71302a38Christophe Simonis
2019-04-30[IMP] web: close dropdowns on scrollJulien Mougenot
Dropdown from many2xxx and datepicker widgets now close on scroll to allow access of background information when scrolling. Related to task #1929483 closes odoo/odoo#32836 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.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-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-22[FIX] *: pass context in kwargs in rpc callsRaphael Collet
2019-03-25[MERGE] forward port branch saas-12.2 up to 230ad8c381eChristophe Simonis
closes odoo/odoo#32088 Signed-off-by: Christophe Simonis <chs@odoo.com>
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-01-31[MERGE] forward port branch 12.0 up to cb8fefa8999Christophe Simonis
2019-02-04[MERGE] forward port branch saas-12.1 up to 4524ad06a8aChristophe Simonis
2019-01-30[FIX] web: datepicker fallbacks to default english localeJulien (juc) Castiaux
When using the datepicker with norwegian locales, the dates are correctly formatted using the norwegian locale but the name of the months are shown in english. This cause a date validation error and thus it is not possible to change the date. tempusdominus.js uses moment.js to deal with dates, it sometimes copies/creates some and set their option according to the ones given at instantiation time and fallbacks on default options for that are not set. opw-1922437 closes odoo/odoo#30276
2018-12-07[REF] web: move ControlPanel inside controllers/actionsGéry Debongnie
This branch introduces a large-scale reorganization of the component tree generated by the web client. The short version is that now, the control panel is a child of the view controller and no longer a sibling. Graphically (and simplified), we go from this: webClient / | \ ... ... actionManager / \ controlPanel viewController / \ to this: webClient / | \ ... ... actionManager | viewController / | \ ControlPanelController / \ CPRenderer CPModel The motivation is that this work moves the code where it should be. Before this commit, it was kind of weird to have code in the controllers to render buttons outside of their root node (in renderButtons). Also, the action manager had to take care of coordinating search view states between view transitions. So, this work simplifies the code. It also makes it easier to extend. We see day after day that Odoo needs to take care of more complex UI needs, and in many cases, these needs were quite difficult to implement (we prefer spaghettis in our plates, not in our code). The changes in this branch should open the way to implement these features. For example, - it will now be easy to add the possibility of views (for example, the search view or a new ControlPanel view) to add custom buttons (of type action or object) in the control panel. - Another need will be to serialize/ restore the state of the search view across action boundaries (needed by the dashboard). - Another example is the possibility for views to customize easily the presence/absence of sub menus (filters/groupbys/favorites/ time range/...) - Another need is an easier way for views/client action to customize their control panel. This commit also contains a large rewrite of the search view (so it is more inline with our architecture and easier to maintain). Part of task 1893568 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com>
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
2018-11-29[MERGE] forward port branch 12.0 up to 82a1e1dcc33Christophe Simonis
2018-11-23[MERGE] forward port branch 12.0 up to b3052b690faChristophe Simonis
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[REF] *: update js test suite to use helpersGéry Debongnie
This rev. introduces robust helpers to use in the JS tests suite to interact with DOM and components, and starts using them (almost) everywhere. All the helpers are exposed though testUtils.js. There are 2 kinds of helpers: 1. Assertions ------------- * assert.containsNone, containsN, containsOnce check that the DOM (or a specific part of the DOM) contains a `selector`. It generates a correct error message automatically. ex: assert.strictEqual(form.$('.o_form_editable'), 1, "msg"); -> assert.containsOnce(form, '.o_form_editable'); * assert.isVisible, isNotVisible check that the DOM has an element visible or not. They also check that the element is actually in the DOM (before most tests didn't verify this). * assert.hasClass, doesNotHaveClass, hasAttrVAlue, check specific properties of a DOM element, and also validate that it is applied on a single existing DOM element (before most tests didn't verify this). ex: assert.notOk(form.$('button').hasClass('btn-primary')); -> assert.doesNotHaveClass(form.$('button'), 'btn-primary'); 2. Utilities ------------ The goal of the utilities is to centralize the definition of many standard components and interactions, ensuring that when we refactor the JS framework, we do not need to change all the tests. Existing mock utilities (addMockEnvironment, intercept, path, patchDate, unpatch and fieldsViewGet) are moved to 'testUtils.mock.*'. Existing DOM utilities are moved to 'testUtils.dom.*'. New dom utilities are created for opendDatePicker, click, clickFirst and clickLast. Helper `click` verifies that there is exactly 1 element visible in the DOM you click on, `clickFirst` and `clickLast` verify that there are more than one element on the DOM. ex: form.$('button').click(); -> testUtils.dom.click(form.$('button')); New Form utilities: (testUtils.form.*) clickEdit, clickSave, clickCreate, clickDiscard, all clicks on the control panel buttons of the form. `reload` reloads the form data. New modal, graph, kanban and pivot utils (testUtils.pivot.*, testUtils.kanban.*, etc.). New fields utils: (testUtils.fields.*) * editInput, editSelect: allow to change the value of a field, using a selector to identify it. They validate that the input exists and trigger the change event automatically. * editAndTrigger: allow to modify a field and trigger specific events after the value change * many2one (testUtils.fields.many2one.*) clickOpenDropdown, clickHighlightedItem, clickItem, searchAndClickItem: use a field name instead of a selector and do all the complex mechanism to open, filter and highlight many2one fields. Joint work with aab, dam, ged, mge, svs and vsc.
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
2019-01-08[IMP] web: use `showSearchInput` in model field selectorMartin Geubelle
The option `showSearchInput`, which is used on the model field selector to display a search input that filters the displayed fields, is not set by default. This includes the model field selector instantiated in the `domain` field widget. closes odoo/odoo#29986
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-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.