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
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
closesodoo/odoo#32382
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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
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
This makes the assets to be recomputed everytime somebody with a different
language load the page.
closesodoo/odoo#31782
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
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>
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
closesodoo/odoo#30222
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>
* 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
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
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>
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>
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.
closesodoo/odoo#28966
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
* 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.
closesodoo/odoo#28204
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);
});
```
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.
closesodoo/odoo#28824
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.
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
closesodoo/odoo#30413
* 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>
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.
closesodoo/odoo#28561
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
closesodoo/odoo#28195
(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
closesodoo/odoo#28024
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.
closesodoo/odoo#27877
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...).
closesodoo/odoo#28994
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).
closesodoo/odoo#27662
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
* 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