Commit Graph
325 Commits
Author SHA1 Message Date
jpr-odoo ee0a5ca449 [MOV/IMP] web, mail: update attachment widget and moved the common scss code from mail to web
with this commit, we have updated the attachment widget view same as like chatter attachment view
moved the common scss code from mail to web for many2many_binary widget, which is used for attachment
and update test case according to the widget

Task ID: 1930087
2019-04-12 09:04:28 +00:00
Vincent Schippefilt eebb0c6152 [FIX] web: corrected the order of icons in systray
Since the merge of JQuery 3, the building of systray icons is non
deterministic.

After this fix, the menus are loaded correctly in order.

Task-ID: 1960741

closes odoo/odoo#32382

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-04-05 10:13:41 +00:00
Martin Geubelle 015958dc17 [IMP] web,base: put buttons in list group headers
It is now possible to put buttons in the list view group headers.
When the view is grouped by a many2one field, those buttons
appear next to the header title when the group is opened.

The buttons are specified in the views in a <groupby> tag in the
list arch, with the following structure:
    <groupby name="groupedField"> <!-- must be a many2one -->
        <button type="object" name="my_method" string="Button1"/>
    </groupby>

It is also possible to add `field`, inside the `groupby` which can
be used for modifiers. These fields thus belong on the many2one
comodel, like:
    <groupby name="partner_id">
        <field name="name"/> <!-- name of partner_id -->
        <button type="object" name="my_method" string="Button1"
		attrs="{'invisible': [('name', '=', 'Georges')]}"/>
    </groupby>

These extra fields are fetched in batch when grouping on the field.

Part of task 1915702
2019-04-02 11:55:57 +00:00
Mathieu Duckerts-Antoine 596206cdf6 [IMP] web: remove nvd3 library
It has been decided to use Chart.js instead of nvd3 to render charts.
Now that nvd3 is no more in use, we remove it.

Task ID: 1946138
2019-04-01 14:40:51 +00:00
Mathieu Duckerts-Antoine 604c43640a [IMP] web: use Chart.js in graph view
It has been decided to use Chart.js instead of nvd3 to render charts.
In this commit the graph view has been largely rewritten to benefit
from the options offered by Chart.js.

Task ID: 1946138
2019-04-01 14:40:51 +00:00
Christophe Simonis 5df4746c9a [MERGE] forward port branch saas-12.2 up to 230ad8c381
closes odoo/odoo#32088

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-03-25 11:13:41 +00:00
Christophe Simonis bbedcdb190 [MERGE] forward port branch saas-12.1 up to ff1bca32f3 2019-03-14 19:44:55 +01:00
Christophe Simonis ff1bca32f3 [MERGE] forward port branch 12.0 up to a26496b6e7 2019-03-14 17:43:32 +01:00
Martin Trigaux 7e2f9634d2 [FIX] web: do not use t-if inside assets
This makes the assets to be recomputed everytime somebody with a different
language load the page.

closes odoo/odoo#31782

Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2019-03-12 10:58:53 +00:00
380550f62f [IMP] web: don't swallow errors in async handlers
This commit adds a 'guardedCatch' function to the Promise API. This function
has to be used when we don't want to swallow real errors (crashes), like
'catch' does (i.e. basically all the time in Odoo). When the promise has
been rejected because of a real error, the rejected Promises chain bubbles
up to the top and triggers the 'unhandledrejection' event (triggered on
all browsers thanks to the unhandled-rejection-polyfill lib). We then add a
listener on that event to display real errors with the CrashManager.

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:15 +01:00
Aaron Bohy 96b0319239 [ADD] web: unhandled-rejection-polyfill lib 2019-03-06 19:53:21 +01:00
David Monjoie aa24779cfa [REF] web: update qunit to v2.9.1
The new version of qunit better reports failures of promises then
the previous version.
2019-03-06 19:49:01 +01:00
Aaron Bohy e5d077d5e6 [ADD] web: es6-promise polyfill lib 2019-03-06 19:49:01 +01:00
jbm-odoo 4960453db9 [IMP] web Add widget signature on binary field
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-14 12:59:10 +00:00
3a5f6bfa9f [IMP] web: add kanban searchPanel
This rev. defines a searchPanel widget used in Kanban views to
refine search according to specific dimensions. This wigdet is
displayed as a sidebar to the left of the kanban view.

Part of task 1892462

Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
2019-02-13 12:23:28 +00:00
Romain Estievenart 4dfd14ed00 [REF] web: extract calendar mobile styling
Extract mobile calendar styling into dedicated SCSS file.

Task ID: 1891955
2019-02-08 15:39:58 +00:00
qsm-odoo 7b960c66bb [REF] website, web, *: move part of website into web
* im_livechat, survey, website_forum

When website is installed, the JavaScript code has access to utilities
to define improved widgets which are automatically attached to existing
DOM elements on page load. Those mechanics are more and more needed in
portal which does not depend on website (as it is website which depends
on portal). This commit moves part of website JS to web, so that it can
be used by all 'frontend' apps whose only common dependency is web
(portal, survey, auth_signup, ...).

This PR also questioned several other similar issues which will be
handled later like:

- website should maybe not depends on portal but only on http_routing

- part of portal should be moved to http_routing and http_routing
  should be renamed (especially for frontend layouts, etc) so that apps
  like survey can reuse some common code

Part of https://github.com/odoo/odoo/pull/29442
task-1932066
2019-02-26 17:02:59 +00:00
qsm-odoo 3f4e760f34 [MOV] web, *: simple moves of JS files to 'public' folder
* web_editor, website, survey, im_livechat

Part of https://github.com/odoo/odoo/pull/29442
task-1932066
2019-02-26 17:02:58 +00:00
Andrea Ulliana 7f2ce89554 [IMP] web: add JS-related lib files for ace editor
In task handled in https://github.com/odoo/odoo/pull/29999, we will need
support for javascript files in ace editor. This commit adds the related
lib files.

See https://ace.c9.io/#extending-highlighters:
https://github.com/ajaxorg/ace/tree/master/lib/ace/mode
1. https://github.com/ajaxorg/ace/blob/master/lib/ace/mode/doc_comment_highlight_rules.js
2. https://github.com/ajaxorg/ace/blob/master/lib/ace/mode/javascript_highlight_rules.js
3. https://github.com/ajaxorg/ace/blob/master/lib/ace/mode/javascript.js

task-1919350
2019-02-05 14:12:16 +00:00
Géry Debongnie 86b6bd5ad1 [REF] point_of_sale,web: move backbone to pos
This rev. moves the backbone library from web to pos, as one of its
two usecases (the search view) has just been removed. From now on,
it is only used in the pos.

Part of task 1893568
2018-12-07 13:16:08 +00:00
40dd121938 [REF] web: move ControlPanel inside controllers/actions
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-12-07 13:16:06 +00:00
Géry DebongnieandAaron Bohy 48a50b4bc0 [IMP] web: add MVC Factory
This rev. adds a factory class to generate MVC components, to
properly standardize the way MVC components should behave (in the
odoo way). The most popular MVC of the webclient concerns views
(Model, Controller, Renderer, for each view type). However, we
wanted to generalize the notion of MVC (and extract it from the
views), as we will use it in a future commit for the ControlPanel.

Part of task 1893568

Co-authored-by: Aaron Bohy <aab@odoo.com>
2018-12-07 12:49:50 +00:00
Christophe Simonis e1f9499d26 [MERGE] forward port branch 12.0 up to 053bb45706 2018-12-05 18:46:15 +01:00
Robot Odoo 2bfbcf5245 [FIX] survey: fix various issues in customer view about datetimepicker
Survey has troubles displaying correctly the datetime picker widget
especially when more than one has to be instanciated. This merge fixes
several issues related to the datetime widget when displaying the survey
in customer (front-end like) view.

See sub-commits for more details about each change.

This merge is related to task ID 1912194.

closes odoo/odoo#28966
2018-12-04 12:55:29 +01:00
David Beguin 937db5386a [FIX] survey : Fix datetimepicker single id issue.
In survey template, the datetimepicker was created with always the same id.
So if two date fields were present on the same page, it created a
multidemensional vortex that broke an alternative reality, resulting in
not being able to fill in both date fields and other crapy stuffs.

Also, the sass file needed to work with tempusdominus library were not
loaded with the js file that comes with it. Resulting in an hugly calendar
(if it could be called calendar) widget.
As survey does not load backend nor frontend assets, it's necessary to have
both files (js and sass files) in common assets.

Task ID : 1911291
Closes PR #28966
2018-11-23 10:00:46 +01:00
Aaron Bohy 49e78f46ee [IMP] web: tests: backport of new helpers
This rev. is a partial backport of abf32b8b, so that the newly
introduced helpers are already available in 12.0.

closes odoo/odoo#28827
2018-11-20 10:17:37 +00:00
Christophe Simonis ce4cc24621 [MERGE] forward port branch 12.0 up to 82a1e1dcc3 2018-11-29 20:06:16 +01:00
qsm-odoo 2dcd8c8566 [REF] web, *: review the assets helpers organization
* survey, website_slides

While not changing their name or their amount, this commit reorganizes
the assets helpers to:

Avoid all file duplicates in different helpers
----------------------------------------------

Before, we had to put some files in different helpers, like our
bootstrap mixin overrides which were in the _assets_utils template and
in the _assets_bootstrap template.

Enforce the use of an helper when using bootstrap
-------------------------------------------------

Bootstrap functions, variables and mixins are now out of the
_assets_bootstrap template, which now only contains bootstrap css rules
and our bootstrap fixes and extensions.

Allow using the correct bootstrap utils in all assets
-----------------------------------------------------

In some assets (especially editor ones), we may want to use bootstrap
variables even though bootstrap is not included in those. This worked
before but using *default* bootstrap variables. Now, our overrides can
be properly included if necessary.

Note: this commit may also be a first step to allow for backend
bootstrap and frontend bootstrap to co-exist.

closes odoo/odoo#28204
2018-11-26 12:23:09 +00:00
Alexandre Kühn fb895f9119 [ADD] web:tests: test utils for drag/drop files
This commit adds test helper functions to drag and drop
files:

- `createFile`: create a file that can be used for drag and
  drop in tests.
- `dragoverFile`: to drag a file created from `createFile`
  over a DOM element.
- `dropFile`: to drop a file created from `createFile` on
  a DOM element.

These utility functions are available from `testUtils.file`.

Example of usage:

```js
var testUtils = require('web.test_utils');
testUtils.file.createFile({
	name: 'text.txt',
	content: 'hello, world',
	contentType: 'text/plain',
}).then(function (file) {
	testUtils.file.dragoverFile($el, file);
	testUtils.file.dropFile($el, file);
});
```
2018-11-26 11:34:00 +00:00
Aaron Bohy de924f41ee [IMP] web: testUtils: ensure backward compatibility
Rev. 7c3d5dc0 recently added new helpers to use in the tests, and
moved some existing helpers to testUtils sub groups (like .dom or
.mock).

This rev. adds a compatibility layer to ease forwardports.

closes odoo/odoo#28824
2018-11-20 10:44:24 +00: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
Aaron Bohy bcbb7ee3fe [REF] web: properly name relational fields test files 2018-11-19 11:24:28 +00:00
Xavier Morel 58e0c88ece [ADD] web: server-side-rendered qweb templates as views 2019-01-29 10:22:18 +00:00
Pierre Paridans 9f7e6bb798 [IMP] web: Deactivate swipe between form view in mobile
The swipe between the form view is taking too long to load, and the pager is a
more clean option to switch between form view.
Moreover, the swipe on tabs is not clear anymore.

- Deactivate swipe between form view
- Swipe should only be available on tabs when tabs are too long to fit in one screen.

Was originally introduced by https://github.com/odoo/odoo/commit/f4ee61f950dc1eeb7b3653ca96ea72721512b5e5

Related task: 1924764

closes odoo/odoo#30413
2019-01-25 13:02:46 +00:00
Christophe MatthieuandAntoine Guenet f296992317 [IMP] web_editor,*: Refactoring the wysiwyg editor and 'html' field
* Creating a new structure by transforming all the plugins in the
  library using the odoo inheritance system. Plugins are easier to
  implement with the AbstractPlugin to add Odoo behaviors.

* From now on, the methods of the library (in this case Summernote) can
  no longer be called by other modules or files. Only the wysiwyg
  widgets can access it, to simplify the updating process. The wysiwyg
  object serves as an interface.

* Depending on the options the snippets will be loaded or not, the
  editor will be in an iframe or not... all of this is transparent from
  the outside.

* Regarding iframes, all controllers related to editing have been
  removed: the new API no longer needs them. This speeds up loading,
  eases testing and removes complexity for the same
  features.

PUBLIC FEATURES

There are several public methods on the Wysiwyg class:
* Wysiwyg.prepare (WidgetParent): returns a deferred resolved when the
  library (xml, lazy, assets...) is loaded.
* Wysiwyg.getRange (DOM): returns the range (selection in the dom)
* Wysiwyg.setRange (startNode, startOffset, endNode, endOffset): creates
  a range (selection in the dom)
* Wysiwyg.setRangeFromNode (DOM, options) that creates a range from an
  element (option available to select all, start or end)

A jQuery selector was added: :o_editable, which indicates whether the
current element is editable. That is, if it is contained in a tag with
the attribute 'contentEditable = "true"' or in a tag with the class
o_editable.
Several methods are also present:
* focusIn: makes a focus and places the cursor at the beginning of the
  element
* focusInEnd: makes a focus and places the cursor at the end of the
  element
* selectContent: makes a focus and selects the content

HTML FIELD

The HTML field can receive different options:
* style-inline: {boolean} transforms a class into an inline style when
  saving and vice versa when reading.
* no-attachment: {boolean} prevents the use of attachments (in media
  dialog)
* cssEdit: {xml_id} to use a template containing the css to loaded in
  an iframe when editing
* cssReadonly: {xml_id} to use a template containing the css to load
  into an iframe when viewing in readonly
* snippets: {xml_id} snippets template (can be used with or without
  cssEdit)
* wrapper: {template} qweb static template (containing a tag:
  id = "wrapper") that will include the content during editing (removed
  on save)

MASS MAILING

A widget was created for mass mailing. There are now two fields:
body_html and body_arch.
body_arch contains the code with the class without conversion into
inline style, useful when editing and one with the inline style that is
visible in readonly mode and sent by email.
Advantage: no spreading errors, able to update css/theme, able to do
more changes when converting to inline style so that a maximum of mail
clients have an impeccable rendering.

Co-authored-by: Antoine Guenet <age@odoo.com>
2019-01-17 08:40:21 +00:00
qsm-odoo 0f6f108cbe [FIX] web: adapt BS import and assets to BS update 2019-01-09 14:03:47 +00:00
Vincent Schippefilt 98936f79a1 [REF] web: split relational fields tests into multiple files
The file relation_fields_tests.js was a huge 12K lines files for which some editors have a
hard time managing.

We have split it in 4 files to be more managable and removed remove unused data
and import.

closes odoo/odoo#28561
2018-11-12 12:36:53 +00:00
Christophe Simonis b106b7ce0b [MERGE] forward port branch 12.0 up to dd70c68426 2018-11-06 16:40:07 +01:00
Adrien Dieudonne 497dfb6917 [MOV] web, base_import: mobile tests should be in mobile suite
This fix some inconsistent error on runbot.

In mobile, some views* depend on 'jquery.touchSwipe' library which
is lazy loaded. As a result, the views become asynchronous...
It's why this library is already loaded before running tests in the
mobile test suite. So we can continue to use synchronous views whether
in mobile tests or not.

But some mobile tests weren't in mobile suite...
In desktop, 'jquery.touchSwipe' is lazy loaded and the first test will
load it for others. It's why the first one has to be asynchronous:
https://github.com/odoo/odoo/commit/da7b59045d246c159f93bc75e3f19c6b1221d31c

The inconsistency comes from the fact that all tests are sequential but
we can't garantee the execution order. So, if the test mentionned is not
the first executed one, an error will occur because the view is not
asynchronous.

Now, all mobile tests are moved in mobile suite to be sure that
'jquery.touchSwipe' is loaded.

We also set the default value for size_class because we want a
coherent environment. It is very rare to find mobile devices with
more than 474px wide.

*: form_view, kanban_view, res_config_settings

closes odoo/odoo#28195
2018-10-29 10:25:05 +00:00
Aaron Bohy 03fe95d6af [REF] web: small refactoring pass on some web components
(mainly views and ActionManager)

- add missing docstrings
- fix typos
- correctly order functions and imports
- put functions in correct sections
- stop using 'event' as argument of handlers
- don't call handlers directly
- remove trailing spaces/tabs
- move module created in stable version to its own file
- follow js guidelines in general

closes odoo/odoo#28024
2018-10-23 10:56:12 +00:00
Christophe Simonis 9dbb7d199c [MERGE] forward port branch 12.0 up to b81c2bce84 2018-10-22 17:57:08 +02:00
Vincent Schippefilt 2b0642d09e [IMP] web: remove es5 shim
The library es5 shim was usefull for older browsers that do not implement
completely the es5 specifications, like IE9.

As we do not support browsers older than IE11, that fully supports all
the features of es5, the library has become useless.

Removing this library will remove a little bit of noise in the callstack
when debugging.

closes odoo/odoo#27877
2018-10-19 08:49:56 +00:00
Aaron Bohy 06b91b7658 [FIX] web: benchmarks: add missing test_utils
Without those, the benchmarks suite can't run.

closes odoo/odoo#28996
2018-11-23 15:00:17 +00:00
Aaron Bohy fad35964bf [IMP] web: backport of new asserts
This rev. is a complement to the partial backport 49e78f46 of
abf32b8. In addition to the helpers, we also backport the asserts
(like isVisible, containsOnce...).

closes odoo/odoo#28994
2018-11-23 14:51:49 +00:00
qsm-odoo c7f72248a9 [FIX] web: clear all BS4 alerts
Commit https://github.com/odoo/odoo/commit/8caf84f70ada259f041b424d37686845604d182a
was not handling the case where there was an invisible DOM element
between the button box and the alert component. Let us clear all alerts.

This commit also introduces a way to properly fix/extend bootstrap in
future fixes/updates (some of our rules may already be moved in that
file once it is forward-ported to master).

closes odoo/odoo#27662
2018-10-11 16:31:24 +00:00
Alexandre Kühn 4e2dffadda [ADD] web:tests: user menu basic tests 2018-10-02 17:58:47 +02:00
RomainLibert b2870ae1eb [FIX] web: add shortcuts menuitem support
Since https://github.com/odoo/odoo/commit/19eacf7d23c9413de4430a3422b5ed74b37ef242, it was possible to click on a "Shortcuts" menu item
in community which triggered a call to _onMenuShortcuts whose
implementation was only defined in enteprise

As the keyboard shortcuts are available both in community and
enterprise, we should support this menu item
2018-10-01 15:13:57 +02:00
Xavier Morel 10228fe3ef [ADD] web: ability to become superuser (uid=1)
* requires that current user has group_system
* only visible in debug mode (?debug)
* available at login or via debug menu
* special systray color in superuser sessions

Closes #27254
2018-09-28 17:25:36 +02:00
Vincent Schippefilt 3092432daa [IMP] web: add a fix on underscore to support cancellableThrottle 2018-09-20 11:10:33 +02:00
Christophe Simonis a12c4d284c [MERGE] forward port branch saas-11.4 up to a1b384d66b 2018-09-18 11:42:52 +02:00