Commit Graph
34 Commits
Author SHA1 Message Date
Sébastien Theys d08a18b791 [IMP] mail, *: tests: use contains in click and insertText
* = account, calendar, im_livechat, mrp, project_todo, sms, snailmail,
    test_mail, web, website_livechat

`contains` is more efficient than `afterNextRender` as it does not wait
for several extra animation frames, and it is functionally more
meaningful.

closes odoo/odoo#130451

Related: odoo/enterprise#44999
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-21 21:00:03 +02:00
Sébastien Theys 9a1efcbde7 [REF] mail, im_livechat, mrp: rename waitUntil to contains
`await contains` is shorter and reads better than `await waitUntil`.

Part-of: odoo/odoo#130451
2023-08-21 21:00:02 +02:00
Sébastien Theys 3f8544d906 [IMP] mail, im_livechat: tests: add assert to waitUntil
`QUnit` tests require at least one `assert`. This change allows to write
tests that only contain `waitUntil` without extra `assert` in the test.

`waitUntil` is more efficient than `afterNextRender` as it does not wait
for several extra animation frames, and it is functionally more
meaningful.

Currently existing tests that contain `waitUntil` have been adapted
accordingly. More and more tests should make use of it in the future.

Part-of: odoo/odoo#130451
2023-08-21 21:00:00 +02:00
Bastien PIERRE 65242e31e9 [IMP] *: Remove alias in JS files
Rename all imports with alias old system to the new js module system
Task ID: 3266759

closes odoo/odoo#127414

Related: odoo/design-themes#671
Related: odoo/enterprise#43716
Signed-off-by: Bastien Pierre (ipb) <ipb@odoo.com>
2023-07-27 11:58:34 +02:00
Pierre Pulinckx (pipu) 8bfa76a842 [REF] *: Unify _t and _lt
The goal of this commit is to prepare ground to remove
lazytranslate function _lt() and keep only _t()
for a better understanding of the use of the translation function.

In this commit,

the translate function _t() has been updated to return the translation
if they are loaded. If not, it throws an error.
the lazytranslate function _lt() returns _t() function.
Corollaries :
Steps in test tours are now a function that returns an array of steps
to avoid any interpolation of _t in this ones before translations has
been loaded.

Example :

registry.category("web_tour.tours").add("example", {
    test: true,
    steps: () => [
        {...},
        {...},
    ],
});

task-3292454

closes odoo/odoo#124157

Related: odoo/enterprise#43153
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-07-19 13:13:16 +02:00
Antoine Guenet 995bf2d883 [REF] web, mail: rename attachment_viewer to file_viewer
Since the attachement viewer was moved to core, this renames it to file
viewer to decouple it from the Attachment model/concept from the mail
module.

Part-of: odoo/odoo#119625
2023-05-23 16:31:21 +02:00
Antoine Guenet 8aec394f71 [MOV] mail, mrp, mail, web: move attachment_viewer from mail to web
The `mail` module's `attachment_viewer` is useful for more than `mail`
alone. In order to be able to use it in the `web_editor` module (which
doesn't depend on `mail`), we move it to the `web` module.

task-3109331

Part-of: odoo/odoo#119625
2023-05-23 16:31:21 +02:00
Jorge Pinna Puissant baebb6a5b0 [REF] web, *: Unique id for field nodes
Before this commit, the field node id (`field_id`) uses the field name
for the first occurrence on the arch, and add an underscore and a number
for the rest of the occurrences. This can create inconsistencies when
sombody assumes that the field_id is equal to the name, and don't take
into account the possibility of multiple occurrences.

Now, a unique id is created since the first occurrence, this remove all
ambiguity between the id and the name.

Part-of task-id 3179751

closes odoo/odoo#117799

Related: odoo/enterprise#39511
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-11 15:17:20 +02:00
7710c3331e [REF] mail, *: refactor Discuss
This commit refactors discuss code to use OWL components
and new tools and services in web/.
Functionally, Discuss app should work relatively the same as
before this commit.

closes https://github.com/odoo/odoo/pull/110188

Related:
https://github.com/odoo/enterprise/pull/38058
https://github.com/odoo/upgrade/pull/4423

closes odoo/odoo#110188

Related: odoo/upgrade#4423
Related: odoo/enterprise#38058
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Co-authored-by: Alexandre (aku) <aku@odoo.com>
Co-authored-by: Didier (did) <did@odoo.com>
Co-authored-by: Géry (ged) <ged@odoo.com>
Co-authored-by: Louis (wil) <wil@odoo.com>
Co-authored-by: Maël (mapa) <mapa@odoo.com>
Co-authored-by: Maryam (maki) <maki@odoo.com>
Co-authored-by: Sébastien (seb) <seb@odoo.com>
Co-authored-by: Thanh (tso) <tso@odoo.com>
Co-authored-by: Matthieu (tsm) <tsm@odoo.com>
Co-authored-by: Zelong (zel) <zel@odoo.com>
2023-03-17 11:47:09 +01:00
Joseph CaburnayandJulien Mougenot 3a798039d6 [REF] web_tour,*: convert web_tour to owl
* The tours are now run by the `MacroEngine` defined in `macro.js`.
  * This is accomplished by converting (at runtime) the user-defined tours to
    `Macro`s. See `tour_compilers.js` for the step (and tour-to-macro) compilation.
* API is kept the same as much as possible. Basically, declaring tours stayed
  the same with some exceptions:
  * `allowInvisible` can be provided in a step to allow consuming the trigger
    element even if it is invisible.
  * `isCheck` can now be used to replace the no operation `run` that is
    traditionally signals the runner to only perform a check.
  * Before, multiple `run`s can be called simultaneously. Now, each `run` method
    is awaited before proceeding to the next step.
* If the trigger element is `disabled`, the tour runner will *not* proceed on
  calling the `run` method and the runner will stay on current step until the
  trigger element becomes `enabled`.
  * However, the tour runner is okay with `disabled` trigger element if the step
    has `isCheck = true`. As long as the trigger element is found for `isCheck`
    step, the tour runner will happily move to the next step.
* Some tours are adjusted to properly run with this new tour runner.
* When the tour failed:
  * The dom string is not logged anymore.
  * However, a warning message containing the relative location of the step will
    be logged. This is better in helping the author in locating the failed step.

**Some guidelines learned during the development:**

* Each step may trigger a dom mutation. It's a good practice to insert an
  intermediate step that *checks* the existence of an element that result from
  the action of the previous step.
* Refrain from using the `run` method for assertions. `run`, in principle, is
  provided to perform actions that are not offered by the helper. Use the
  `trigger` for assertions.
* During dev, find `SHOW_POINTER_DURATION` and set it to `250`. This will show
  the pointer (pointing to the trigger element) for 250ms when watching the
  tour.

closes odoo/odoo#107618

Task-id: 3082036
Related: odoo/enterprise#37560
Signed-off-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
2023-03-15 13:19:45 +01:00
yhu-odoo 5bb0f96f19 [IMP] mrp: manual consumption improvement
Previously we set a component on MO to be manual consumption by comparing
the To Consume and Consumed, if they are not the same, we consider it a
manual consumption. Now if any input activity in the Consumed cell, we
will consider it a manual consumption.

Note that in the code, we make the css class change happended in the
list renderer instead of the field widget. We do that because we want to
change the background color of the whole cell not just the text of the
field.

Task-3116125

Part-of: odoo/odoo#113538
2023-03-01 17:01:16 +01:00
William Henrotin 3bc9d3dabe [FIX] mrp: make the timer editable
This commit makes the ongoing timer editable

Task: 2991906
X-original-commit: b2ce5adeead3255de765a6136116ffc7f36ea49e
Part-of: odoo/odoo#103872
2022-10-24 09:16:55 +02:00
William Henrotin 8d30502e1b [FIX] mrp: convert the Google Slides viewer in Owl
closes odoo/odoo#102398

Task: 2991906
X-original-commit: ba593c742c62db9cf9b310eaf5e104802821dad3
Related: odoo/enterprise#32383
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-10-06 18:01:09 +02:00
William Braeckman ee9a282c19 [FIX] web: fix file upload service event listeners
The event listeners were added to the upload object instead of the xhr
object making them being called before they were supposed to.

closes odoo/odoo#102061

X-original-commit: 804467d7b0a583ab36a47212d482b41d29ca2203
Related: odoo/enterprise#32247
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2022-10-04 17:01:29 +02:00
Arnold Moyaux 709d3ca147 [REF] mrp: timer to wowl
X-original-commit: 816212516340bf66e16f3fc9915293ab18f8cf4c
Part-of: odoo/odoo#101905
2022-10-03 15:19:02 +02:00
William Braeckman 44cfa03587 [IMP] mrp: migrate mrp_documents_kanban to wowl2
This views has multiple custom features such as file upload, attachment
viewer and download.
A lot of files have been rendered obsolete and have been deleted,
notably `file_upload_mixin` which has been replaced by the
file_upload service and hooks.

closes odoo/odoo#99769

Related: odoo/enterprise#31145
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-09-12 17:33:14 +02:00
Aaron Bohy 4f984568e1 [REF] *: adapt code to new kanban view
This commit makes various adapations in addons with respect to
the introduction of the owl kanban view. Mainly, some selectors
in scss and in tests needed to be adapted. Moreover, in some tests
that we haven't adapted yet, we must ensure that legacy form and
list views are still used (useLegacyViews).

It also contains some adaptations in kanban templates, e.g. the
replacement of moment by luxon, the removal of underscore...

Part-of: odoo/odoo#92475
2022-06-30 09:29:45 +02:00
Samuel Degueldre 6daa2d01b7 [IMP] web, *: use MutationObserver to neutralize image src in tests
*: mail, mrp

Previously, to prevent images and iframes from making  GET requests in
tests, we would listen for the DOMNodeInserted event. This event is
deprecated and should not be used. Additionally, we weren't listening
for attiribute changes for performance reasons, which would result in
some GET requests still being made when an src attribute was changed.

This commit changes the mechanism that is used to do this from mutation
events to a MutationObserver which is not deprecated, and now also
listens for attribute modifications as MutationObservers can be
configured to only listen for changes to certain attributes, greatly
alleviating the performance impact of listening for those.

This mechanism has also been enabled globally by doing it once in the
test setup code, instead of requiring one to call a specific helper, as
we never want to make real requests during tests.

Some tests have been adapted to this new behaviour.

closes odoo/odoo#85216

Related: odoo/enterprise#24665
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-02-23 15:07:59 +00:00
Rémy Voet (ryv) 068dadcd09 [REM] mrp: remove unused widget bullet_state
During the refactor for v14 the bullet_state was not used
anymore (used for product_availability of workorder).

task-2643681

Part-of: odoo/odoo#77174
2021-10-22 08:38:33 +00:00
Zelong Lin 51ff8b09db [REF] *: convert JS files to ES6 modules
* = hr, hr_holidays, sms, snailmail, website_livechat, account_invoice_extract,
approvals, documents, mail_enterprise, calendar, crm, mrp, note, website_slides,
crm_enterprise, sign, social, voip

task-2510656

closes odoo/odoo#72712

Related: odoo/enterprise#19241
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-08-24 14:31:55 +00:00
Arnold Moyaux 3355371f34 [IMP] mrp: editable timer 2020-07-27 15:03:05 +00:00
Ankita Raval 65513ef3f9 [IMP] mrp: mrp_document
Purpose:
Modernizes and facilitates files upload in manufacturing app.

In this Commit:
  - Show the image in Kanban.
  - Allow to access a preview of the file when clicking on it in the
    Kanban view.
  - Add a 'Edit', 'Delete' and 'Download' in kanban card dropdown menu.
  - Add Upload button in control panel to upload document which will
    create new record of `mrp.document` and also add a testcase for it.

task-1960733

closes odoo/odoo#42168

Related: odoo/enterprise#8977
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-03-04 10:12:46 +00:00
jpr-odooandpga-odoo 8bf1486da5 [IMP] mrp: added support embedded google slide on work center
This commit adds new `embed_viewer` widget which will be used display URLs
via embedded iframes.  You can add any valid URL to display page via iframe,
although widget automatically converts raw google slide URL into embedded URL.

Task ID: 1909010

closes odoo/odoo#29404

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>


Co-authored-by: pga-odoo <pga@odoo.com>
2019-08-01 13:34:58 +00:00
edae92c880 [REF] mrp: adapt code after jQuery update
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-03-06 20:07:17 +01:00
Géry Debongnie abf32b8b21 [REF] *: update js test suite to use helpers
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-19 11:24:28 +00:00
qsm-odoo ee65b44d9e [REF] *: BS4, adapt the label component structure
The '.label' elements have been replaced by '.badge' elements without
the 'badge-pill' class.
2018-07-27 12:36:54 +02:00
Martin Geubelle a7b521fe44 [MOV] web, mrp: move pdf_viewer widget
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-12 11:16:21 +01:00
Khoi Nguyen e73922855d [IMP] mrp: Allow page-setting fields for pdf widget
This revision allows the page number of a pdf file to be set via an
integer field. If the pdf widget is attached to the 'field' field, then
the page can be changed via the 'field_page' field.
2017-09-27 17:13:24 +02:00
Martin Geubelle fc82e1e40a [FIX] mrp: correctly replace inputs in pdf_viewer widget
In the extended template `HiddenInputFile` there are actually two inputs
(one for image only and another one).

This widget needs to replace both of them otherwise the file selector will
be opened twice.
2017-05-24 08:25:23 +02:00
Géry Debongnie 33710d540c [FIX] web: small fixes in test framework
We fix in this commit three small issues in the test framework.

1. throw an explicit error when we try to do a fieldviewget in the mock
server with a model that does not exist.  This will make it easier to
figure out what went wrong when copy pasting a test from one file into
another, and forgetting to change the model in the createView parameters

2. wrap the result of special methods in the mock server in a deferred,
so we can simply return a value when using that functionality.  Also, it
is more consistent with the rest of the mock server

3. for iframes, we no longer change the src attribute to #test:url.
This had the problem of actually loading the page.  Instead, we change
it into about:blank and we copy the old url into the data-src attribute for
reference.
2017-05-11 09:53:08 +02:00
qsm-odoo 250e716c3a [REF] web, *: restore views design
Since the new views merge, a lot of design elements were broken. This
was particularly impacting the fields in the editable list view; indeed
the editable list view is not using an inline form view anymore so the
fields in the list were not properly styled as the LESS was still
defined assuming the form view environment (for example the invalid
fields were red for o2m fields in form view but not in editable list
view even though they got the right CSS class).

This commit refactor the LESS following these rules:
- No more division of non-layout and layout rules. Dividing LESS rules
  in x_layout.less and x.less was a mistake. Many rules can be
  considered to be layout and not layout at the same time, developers
  always have to switch from one file part to the other, many CSS
  selectors (and rules!) are duplicated for nothing, ...
- Field style is extracted from x_view.less and put in the new
  fields.less file. As before, the fields_extra.less will contain the
  rules specific to community so that the enterprise repo can override
  those by replacing the whole file.
- Many classes have been renamed so that o_form_x_y becomes o_x_y as
  many classes can now be applied outside of form view. These classes
  should not be used in templates anyway.

The commit also changes the DOM of fields so that it is more minimalist
(no useless parent div, etc).

Input elements are not automatically styled anymore, they have to get
the o_input class explicitely. This allows to fix lots of small style
bugs of previous versions (required monetary field had not the proper
style, readonly m2m tags appeared as editable, ...). This also improves
the LESS code.

The editable list view should also completely stop flickering on chrome
and firefox.

The commit also removes the orange outline on list view dirty cells.

The commit also removes deprecated static xml, LESS and other code.

Notice there are still styles to restore/fix and LESS to improve.
2017-05-04 12:07:30 +02:00
Martin Geubelle 1690f317ba [FIX] mrp: adapt mrp_time_counter fields widget
This widget behaviour hadn't correctly implemented with the new views.
This commit also introduces some tests.
2017-04-27 16:56:48 +02:00
Martin Geubelle 5a78f4bad7 [FIX] mrp: adapt bullet_state field widget
This field widget has been adapted to the new views.
This commit also introduces some tests.
2017-04-27 16:56:47 +02:00
Martin Geubelle 5ec62a0b31 [FIX] mrp: reintroduce pdf_viewer field widget
This field widget has been adapted to the new views.
This commit also introduces some tests.
2017-04-27 16:56:47 +02:00