Commit Graph
60 Commits
Author SHA1 Message Date
Vincent Schippefilt 029dd1a214 [IMP] web: edit translations in new dialog
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-09 13:09:53 +00:00
qsm-odoo 4f27e52cab [IMP] web_editor, *: introduce and restore new web_editor UI
* mass_mailing, note, website, website_blog, website_form,
website_mass_mailing, website_sale

This commit, unfortunately, mixes three things:

- Restoring as much as possible the scss organisation to allow styling
the web_editor UI properly.

- Fixing some bugs like a border around the page once the editor is
loaded, no ability to scroll the snippets, etc

- Introducing a whole new UI for snippet options: a left panel instead
of the old dropdown & button overlay.

Note: this commit also do some linting and ES6 convertion even though
some of it has been done in the parent commit.

Note 2: some elements that were removed are still styled in the POS apps
but this is because part of a feature was removed while leaving dead
code behind, this is handled in another PR which is to be merged
(https://github.com/odoo/odoo/pull/36136).

Part of https://github.com/odoo/odoo/pull/36068
task-1942370

closes odoo/odoo#36068

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-08-28 09:04:55 +00:00
1eb1c2b029 [REF] web_editor: adapt wysiwyg tests to older summernote version
These modifications crystalize the behavior of the old editor, even
if it makes less sense than the behavior of the saas-12.2 one.

In some cases, the only reasonable adaptation we could do for 13.0
was to delete the tests, as these tests relied on mechanisms of
the newer version of summernote introduced in saas-12.2 which
cannot be easily replicated in the older version from 12.0 that
we are reintroducing in this PR.

It is sad to see these tests go, but we knew this was going to be
something we would lose in reverting back to the older editor.

That being said, since these tests were not present back in 12.0,
we are simply back to the 12.0 state of things, not worse. Don't
weep for them though, they will be back in Odoo 14.

Part of PR 35677.

Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
2019-08-21 19:11:31 +00:00
912996fe90 [REF] web_editor, website: adapt wysiwyg to 12.0 editor
The wysiwyg abstraction layer was introduced in saas-12.2 by
commit f2969923. Its goal was to provide an external interface
for other modules that wanted to use the editor feature such
that the editor core itself could be changed without requiring
extensive changes in the other modules.

This commit is adapting the wysiwyg interface to instantiate
the 12.0 editor below it rather than the saas-12.2 one, thus
reverting the "new editor" part of f2969923 itself.

Part of PR 35677.

Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
2019-08-21 19:11:31 +00:00
Christophe Simonis 140ee6b8f0 [MERGE] forward port branch saas-12.4 up to 98a55917a6 2019-08-14 16:48:10 +02:00
Christophe Simonis b792ba7d9a [MERGE] forward port branch saas-12.3 up to 752b2553c6 2019-08-08 11:52:13 +02:00
Gorash 8e4b8be4e6 [FIX] web_editor: remove virtual corrector/completion keyboard glitch
For the ours need, we can not let the contentEditable behavior. Indeed,
this one does not have the same behavior according to the browser. The
DOM node could be erase, merge, cut, in them according to the keyboard
interactions. The problem is that if we have to manage these behaviors,
we have to manage everything. It was already the case in the previous
version, however before we created an editor by zone and by a hack we
mix the history.
In the case of the virtual keyboard of some OS / Phone, the events are
different and the autocompletion does not update (bug that prevents
modification interactions with javascript). In order to solve these
problems, we use another event for the insertion of the characters.
However, we must also force the update of the corrector by forcing a blur
and a focus.
The current version is a temporary version. We are currently working on a
version that uses a virtual dom and does not need to do excessive prevent
default.
2019-08-06 10:45:04 +00:00
Martin Trigaux aadc4a9f0b [MERGE] Forward port of saas-12.3 to saas-12.4 up to fe4caecb59
closes odoo/odoo#35059

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-22 10:05:49 +00:00
RomainLibert fe4caecb59 [FIX] web_editor: momentarily comment the assert
Having an assert that randomly breaks is quite annoying, as this assert
is not critical and breaks once every 100 - 120 builds. It can "safely"
be commented out before being fixed

closes odoo/odoo#35043

Signed-off-by: Romain Libert (rli) <rli@odoo.com>
2019-07-19 10:46:48 +00:00
Martin Trigaux beba36416f [MERGE] Forward port of saas-12.3 to saas-12.4 up to 40421be73c 2019-07-16 16:36:40 +02:00
Martin Trigaux 40421be73c [MERGE] Forward port of saas-12.2 to saas-12.3 up to cf8e74a1a7
closes odoo/odoo#34907

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-16 11:44:38 +00:00
Antoine Guenet e7828c3627 [FIX] web_editor: properly insert character in empty nested list
Fix a bug that can be reproduced like so:
- Insert list
- Type char
- ENTER
- TAB
- Type char
The character gets inserted _after_ the `br` instead of replacing it.

closes odoo/odoo#34805

Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2019-07-11 14:41:12 +00:00
fja-odoo 4ebda2ec2b [FIX] web_editor, web_unsplash: fix nested div
The div that is replaced with the existing.attachments template was not
the right target and kept nesting div into each other.
The parent div of the existing.attachments now has the
o_we_existing_attachments class (the target to be replaced by itself).

Part of #33983
2019-06-19 14:55:30 +00:00
Christophe Simonis 71a50a2214 [MERGE] forward port branch saas-12.3 up to 409679866b 2019-06-06 11:54:35 +02:00
Christophe Simonis c8d7ad9a6b [MERGE] forward port branch saas-12.2 up to 995aa1685e 2019-06-03 15:49:31 +02:00
Thanh Dodeur c212cfe899 [REF] *: removes datas_fname from ir.attachment
This commit removes the field `datas_fname` from `ir.attachment` as
it was unnecessary and most of the time the duplicate of `name` or
`url`.

Task #1909865

closes odoo/odoo#32976

Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>
2019-06-05 09:12:13 +00:00
Sébastien Theys 87a35d4263 [IMP] web, web_editor, *: add media image optimize dialog
* = website, website_blog

The goal is to give the user an opportunity to optimize his images before using
them.

For this we introduce a preview/configuration dialog after every image upload,
where appropriate default values are filled for the quality and resolution,
based on where the image is going to be used. Since this is not going to be
perfect all the time, we still allow the user to configure them, and we display
a preview to ease this process.

Indeed it is important for SEO and for usability in general that the images are
as light as possible in size.

Technically the original image is uploaded and saved first, and then it can be
optimized. This way the upload only happens once, and the preview can be
computed from the already saved image.

task-1930726
PR: #31208
2019-06-04 22:14:13 +02:00
Sébastien Theys 76cf2ae82a [IMP] web_editor, *: improve media dialog attachment upload
* = web_unsplash, website

Remove iframe upload and replace it with a proper RPC. The route is now only
accepting one file at a time, which makes it easier to maintain, and allows to
process the first file as soon as it is ready, instead of having to wait on
everything.

Also fix a bug where a document could not be uploaded because it would try to
parse it as an image.

Remove filter after search result from the JS and add the corresponding
conditions in the domain to avoid processing and returning unnecessary records.

If multiple attachments exist with the same URL, now display them all to avoid
confusion.

Compute all the necessary values in the python model instead of in the JS.

Allow SVG in the widget (the server already accepted them before).

Disable multiple image upload when not in multiImages mode.

task-1930726
PR: #31208
2019-06-04 22:14:13 +02:00
Sébastien Theys 191c556d6b [IMP] web_editor, *: improve file media widget views & selection
* = web_unsplash, website_blog

Rename "image" to "attachment" when appropriate in FileWidget

Improve image selection / highlight code (now based on attachment id)

Improve image grid view:
 - Remove the row mechanism and replace it by a single loop over the images.
 - Take advantage of row wrap for a responsive display.
 - Uniformize the height (prevent tall images from moving down everything).
 - Load a miniature of the images when possible, remove the loading placeholder.
 	This should significantly reduce the download size when opening the dialog,
 	at the cost of CPU usage on the server.
 - Split the existing image view into one view for the loop and one view for the
 	image itself. This way in a following commit we can reuse the image view
 	when adding a new one, instead of having to render everything again.

task-1930726
PR: #31208
2019-06-04 22:14:13 +02:00
Martin Trigaux 5a6a414e2c [MERGE] Forward port of saas-12.4 to master up to aadc4a9f0b 2019-07-22 14:47:52 +02:00
Martin Trigaux 5d57e1862f [MERGE] Forward port of saas-12.4 to master up to beba36416f
closes odoo/odoo#34924

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-16 15:45:24 +00:00
Yannick Tivisse 14067543d0 [IMP] uom: Remove parentheses on uom names
Purpose
=======

Parentheses in the label of units of measure sometimes make
reading needlessly uncomfortable.

Specification
=============

Remove parentheses in the name of every standard uom.uom and hardcoded
occurence on views/field names.

TaskID: 2030444

closes odoo/odoo#34492

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-07-15 12:57:34 +00:00
Christophe Simonis a97037c6d4 [MERGE] forward port branch saas-12.2 up to 78b3b650b0 2019-05-06 12:27:51 +02:00
Antoine Guenet 706bf85512 [FIX] web_editor: disable tooltips in keyboard tests and on option off
The link and media tooltips were not taking Summernote's `tooltip`
option into account. That option ensures that tooltips are disabled if
the option is off (which is for instance the case on mobile).
This fix ensures that these tooltips are disabled when the option is
set to `false`.
It also disables tooltips in the keyboard tests. They are not relevant
to the keyboard tests and occasionally caused the DOM to not be properly
cleaned after the tests were run (most likely due to their 2000ms
`setTimeout`).
2019-04-19 10:23:21 +00:00
Gorash 9fd27ff101 [FIX] web_editor: indent multiple lines at a time with editable as parent 2019-05-13 07:40:36 +00:00
Antoine Guenet 6951521278 [FIX] web_editor: properly unformat text at the start of the DOM
When trying to remove a format (bold, italic, underline), collapsed at
the start of the DOM, an error occurred because of a wrong range.
Ex.: `<p><b>Odoo</b></p>` -> when clicking before the word "Odoo", then
clicking the "bold" button, we expect to be able to start writing in
plain (not bold) text (for that, the DOM has to look like this:
`<p>\u200B<b>Odoo</b></p>`). We now have that proper behavior without
the accompanying error message and loss of selection.

Task ID: 1978515

closes odoo/odoo#33038

Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2019-04-30 08:45:05 +00:00
Sébastien Theys b0acd056e9 [IMP] web_editor: clean up media file widget selectors
Avoid selectors based on DOM structure, use classes whenever possible.
Register all the selectors in start to avoid searching the DOM multiple times.
No functional change.

PR: #33509
2019-05-27 16:32:52 +00:00
Sébastien Theys 277c30e7e6 [IMP] web_editor, website: clean up media dialog
Restructure the code in a more logical manner. No functional change.

PR: #33509
2019-05-27 16:32:52 +00:00
Sébastien Theys 8ab696dc82 [IMP] web_editor, web_unsplash: split media widget (image & document)
The common code is kept in a generic File widget, while the split allows for
easier customization.

PR: #33509
2019-05-27 16:32:52 +00:00
Christophe Simonis 8dd5a85267 [MERGE] forward port branch saas-12.3 up to 60e71302a3 2019-05-13 15:26:12 +02:00
Antoine Guenet 27eb8ba617 [FIX] web_editor, website: never indent/outdent list groups
The "comparisons" website snippet uses a list group with the class set
on a UL. In consequence, the web editor considers it as a regular list
and may try to outdent it, which is not the expected behavior with a
list group. This fix ensures that ULs with the `list-group` class cannot
be in/outdented.

closes odoo/odoo#32709

Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2019-04-25 10:03:14 +00:00
Antoine Guenet cb9263a823 [FIX] web_editor: properly merge a LI with text with a LI with text in P
A list item with text can be written as <li>text</li> or as
<li><p>text</p></li>. Issues occurred when both syntaxes need to be
merged together. Namely, the <p>text</p> was being appended to the other
list item, thereby creating a visible new line.
2019-04-25 10:03:05 +00:00
Antoine Guenet 41088bb311 [FIX] web_editor: properly handle delete in nested lists of all syntaxes
This addresses various bugs that occured with nested lists - including
lists that are nested with a UL within a LI (as opposed to a UL directly
within another UL).
2019-04-25 10:03:00 +00:00
Antoine Guenet 8e89ffb175 [FIX] web_editor: properly convert a checklist to an ordered list
The `o_checklist` class was preserved when converting a checklist to an
ordered list.
2019-04-25 10:00:43 +00:00
Antoine Guenet 17aff7b59b [FIX] web_editor: uncheck new checklist item on split
On ENTER in a checklist item, a new checklist item is created. The new
one should never be checked. This ensures that ENTER in a checked
checklist item never creates a checked checklist item but instead cleans
the class.

closes odoo/odoo#32684

Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2019-04-15 11:40:05 +00:00
mgh-odoo f217aa528f [FIX]web_editor: Fixed traceback due to 'field_html' widget while saving record
Previously, when user edited record having 'field_html' widget and
tried to save the record immediately, a traceback was faced sometimes
because content was not loaded yet. This commit fixes the issue
by calling super method if the content is not loaded yet properly.

Task: #1932687
Closes: #30833

closes odoo/odoo#31581

Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-03-05 09:09:33 +00:00
Antoine Guenet 4339101afe [IMP] web_editor: add tests for deleting all contents of format block
Implementing new behavior on delete all contents of a format block
revealed insufficient testing, which is now covered.

closes odoo/odoo#31277
2019-02-21 09:13:32 +00:00
Antoine Guenet 2a010c38f3 [FIX] web_editor: remove broken and unnecessary test
The next test was identical to the removed one, with the exception that
it inserts a character at the end, which really is the behavior we want
to test. The removed test was broken because it expected the range on
the parent, which is anyway equivalent in this case. This is confirmed
by the fact that inserting a character at either ranges indeed inserts
the character where it is expected to do so.
2019-02-21 09:13:31 +00:00
Raphael Collet 1ced3bfca4 [FIX] *: pass context in kwargs in rpc calls 2019-03-22 16:42:08 +00:00
Christophe Simonis 44515bc7be [MERGE] forward port branch saas-12.2 up to c9f832d9f0
closes odoo/odoo#31790

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-03-13 14:24:51 +00:00
David Monjoie 455a9c9d58 [FIX] web_editor: fix non-deterministic tests
Those tests were skipped because they were failing
non-deterministically.

This commit aims to make them deterministic by putting back some
guard promises that were lost during the jquery update adaptation.

This commit also fixes a lingering issue with one of the asserts.
We observed that sometimes, the "alt" and "title" attributes where
both present on the element but displayed in different order in
the string returned by wysiwyg.getValue(). This is because there
is no set order in the attribute returned by jQuery.html().
Because of that, I replaced the simple sring test by a thorough
manual comparison of the result that is expected to be equivalent.

closes odoo/odoo#31671

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-03-08 09:00:31 +00:00
Vincent Schippefilt 7a665ca92a [FIX] web_editor: temporarily skip two tests
Those two tests non deterministically fail on the jQuery branch.
We'll fix them after the merge.
2019-03-06 20:07:17 +01:00
2e8222dee7 [REF] web_editor: 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
Christophe Matthieu b49745e52d [IMP] web_editor: lazy load the wysiwyg
Issue: wysiwyg asset slow down the loading of the website, error
inadvertently introduced: https://github.com/odoo/odoo/pull/29775

The assets are now loaded assynchroneously, when the editor is needed,
its assets will be loaded.

closes odoo/odoo#30700
2019-02-14 15:11:19 +00:00
Antoine Guenet eea58a3cf8 [FIX] web_editor: on anchor split, rerange and clean data on getValue
Due to a wrong order of operations, after splitting an anchor (press
ENTER), the range was setting on the first anchor. Now it sets on the
second one (as the code - but not the tests - suggests was supposed to
happen). Tests were adapted to reflect that change.

In tests, after splitting the anchor, `Wysiwyg.getValue` didn't always
properly clean up `data-original-title`. Targetting empty
`data-original-title` attribute instead of `aria-describedby` attribute
should fix that issue.

closes odoo/odoo#30923
2019-02-07 10:20:57 +00:00
Antoine Guenet 48cb3c71d1 [IMP] web_editor: handle CTRL+A (and then DELETE) locally
This fixes issues with CTRL+A then delete.
Now CTRL+A selects all the contents of the unbreakable node in
which the range is contained. Deleting it all will replace the contents
with `<p><br></p>` so the user can start editing afresh.

Note: Only CTRL+A is handled: ``select all`` in contextual and edit
menus are still handled by the browser.

closes odoo/odoo#30648
2019-02-04 09:44:18 +00:00
Antoine Guenet a27837a000 [FIX] web_editor: properly disable the toolbar on snippet removal
Update editor toolbar on each change to properly disable it when needed

closes odoo/odoo#30594
2019-01-29 07:54:58 +00:00
Antoine GuenetandGorash eb0ea8efbe [ADD] web_editor,*: Tests for new structure of web editor
The refactoring also had to be done in order to create a set of unit
tests.
Each behavior can be tested, including the behaviors performed as a
consequence of keyboard interactions (for instance: Enter, Tab...).
This commit also contains some changes to test_utils that were
necessary given the new structure of the wysiwyg editor.

Co-authored-by: Gorash <chm@odoo.com>
2019-01-17 08:40:21 +00:00
Christophe Matthieu de444335b7 [REF] web_editor,*: Move and rename files to prepare refactoring
The refactoring of the wysiwyg editor and 'html' field allows us to
move some of the code that was in web_editor but only used in website or
in mass_mailing. Some parts are still in web_editor but will be
moved at a later time.
2019-01-17 08:40:21 +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