Commit Graph
2767 Commits
Author SHA1 Message Date
jerome hanke (jhk) 17f62f6441 [FIX] mail: abstract getAvatarSource has default
Steps to reproduce:
- install sales
- create a new quotation

Previous behavior:
the avatar next to the author's name is empty in the mailthread

Current behavior:
avatar is displayed as expected

opw-2187231

closes odoo/odoo#44407

X-original-commit: 24ba9f9954a71eba46d44fe242cd2e6dba125da6
Signed-off-by: mightyjol <jhk-odoo@users.noreply.github.com>
2020-01-31 15:27:19 +00:00
Sébastien Theys 4f5334a081 [FIX] mail: adapt "history" test with non deterministic issue
Follow up on 255f7219a9

The issue is still happening.

With the current commit, we will be able to know for sure if it happens because
we don't wait long enough, or because the messages are never appearing.

closes odoo/odoo#44471

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-02-03 11:12:03 +00:00
Alexandre Kühn f61b4669a9 [FIX] mail: no traceback on click channel mention from chat window
Before this commit, when clicking on a channel mention from a chat
window, it crashed with the following error:

`TypeError: channel.detach is not a function`

This happens due to `MailService.joinChannel()` returning a promise
that is resolved with channel ID, instead of a channel object.
`channel.detach()` becomes `<Number>.detach()`, which is treated
like `undefined()`, hence crash.

closes odoo/odoo#44329

X-original-commit: 710fda06c3b30ff2267fcc1d123f15ce031b6f3a
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-01-30 15:23:02 +00:00
Julien Mougenot 5f6571a6fe [FIX] web,mail: only apply modal activity for Dialog modals
Before this commit, the CSS rule handling the "activity" of the modals
(their z-index compared to the one of their backdrop) was global and would
interfere with front-end or custom modals which do not use the static Dialog
methods giving them the "active" class.

Now, the rule has been inverted: the z-index of a modal is only changed when
it is given an "inactive" class, thus only impacting the modals instantiated
via Dialog or Owl Dialog classes.

closes odoo/odoo#44067

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-28 11:35:14 +00:00
mcm-odoo 5aa0822a9d [REF] mail: migrate activity renderer to owl
In order to prepare the future, we want to convert everything in Owl.
This commit converts the activity renderer.

closes odoo/odoo#42278

Task: 2149408
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-28 07:42:56 +00:00
Sébastien Theys 255f7219a9 [FIX] mail: fix non deterministic issue in discuss history test
Follow up on 2f3e6e9ea8

The issue is still not fixed. Here is a new attempt.

closes odoo/odoo#43869

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-01-23 16:48:29 +00:00
15c934a1ab [IMP] (website_)mail: improve routes and management of mail followers
Purpose of this commit is to improve model of followers, notably management
code and its use in routes. Indeed it is quite an old model and code had
to be cleaned a bit to improve code readability and maintenance.

In this commit we

  * remove unnecessary code examples in gamification about followers: using
    that model as example of code for goals is probably not a good idea as it
    is technical;
  * rewrite routes called by JS are simplified to better match JS
    implementation;
  * introduce computed fields to fetch related partner or channel name,
    email (partner only) and active status;

LINKS

Task 1933771
Task 2078313

closes odoo/odoo#39808

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Remy Voet <ryv@odoo.com>
Co-authored-by: jgi-odoo <jgi@odoo.com>
Co-authored-by: Xavier-Do <xdo@odoo.com>
2020-01-21 16:40:06 +00:00
Tiffany Chang (tic) b786adf2e9 [IMP] Mail: Add optional activity domain for systray
Addition of this optional 'domain' value for systray activity related
lines allows the restriction of which activities will be included in
the view opened when the line is clicked on.

One use case is when a model is split between 2 systray activity lines.
In this case we most likely do not want the same activities of the
model to show up when we click on either line. For example, say we
have 2 modules using the same model, but the module instances of that
model are distingushed by a field.Selection value. Then we would only
want to show the activities related to each module when we click on
their appropriate systray activity lines based on that field.Selection
value.

Task: 2169498
2020-01-21 12:43:41 +00:00
Sébastien Theys 7588e3a20e [FIX] mail: reintroduce fatype for message status "envelope"
This was incorrectly reverted during 116057b26e71db4692280463669f3e80d813ddcc

closes odoo/odoo#43564

X-original-commit: 73e3afca18fae954552d8cbecb6afddf1b08539b
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-01-20 12:47:38 +00:00
Jason Van Malder 071e03f178 [FIX] mail: handle server error in the front-end part
Issue

    - Install Time Off
    - Marc Demo > Create leave request
    - Admin > Validate the leave request
    - Marc Demo > Add an attachment

    Nothing happens

Cause

    There is a access right issue that is not handled in the
    JS.

Solution

    Handle it by doing a do_warn.

OPW-2171791

closes odoo/odoo#43484

X-original-commit: 6a98c75ebfca694e1e68fa09eca95e47472bed92
Signed-off-by: Jason Van Malder <jvm-odoo@users.noreply.github.com>
2020-01-17 12:37:47 +00:00
Thanh Dodeur e2a8ee3aa1 [FIX] mail: restores the documentViewer modal
Revision on
https://github.com/odoo/odoo/commit/34bbdd88c0bc354b76b254bb78c4eb786f3d08c0#diff-9da02f8f30ea349fbc4b9884c2b77b78

The document viewer did not work properly because, by default, dialogs are non-active,
so most interactions were not possible (just pressing ESC to close the dialog worked).

The correct fix consists of using OwlDialog for DocumentViewer,
but that's basically close to a re-writing, so in the meantime marking it as always active is fine.

closes odoo/odoo#43446

Task: 2177011
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-01-17 10:11:27 +00:00
Debauche Stéphane 03e7a99e91 [FIX] mail: fix emojis button in multi-languages
When using emoji widget in a multi language environment, button for emoji
is displayed twice.

This is due to having in the widget both the input and a translation box
holding the translation button. Emoji button is incorrectly added to both
elements, which is fixed in this commit.

We also adjust vertical position so that button is aligned with the language
button.

Task #2168338

closes odoo/odoo#42827

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-01-15 09:40:32 +00:00
Ipsita Borisagar 8e37757230 [IMP] mail: attachment counter on chatter without message_ids
Before this commit, chatter without messages did not display
attachment counter, even though attachments could be uploaded from
attachment box.

This commit now displays the attachment counter in this case.

Task-Id 2149348

closes odoo/odoo#42672

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-01-14 08:37:24 +00:00
jerome hanke (jhk) fca4694d80 [FIX] mail: correct activity due date on activity view
Steps to reproduce:
- install crm
- set your computer timezone to GMT-6 (Mexico city)
- go to crm > change the view to activity view

Current behavior:
all activities are one day off from their actual deadline
(an activity set to be due on the 7th of January shows as
6 Jan on the view)

Current behavior:
activities are displayed properly according to their due date

opw-2162579

closes odoo/odoo#43223

X-original-commit: 0735547086aaab819369b1a08e6810baeac3783d
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-01-13 15:15:06 +00:00
Alexandre Kühn 2f3e6e9ea8 [FIX] mail:tests: no undeterministic failure of discuss history test
Before this commit, the test 'all messages in "Inbox" in "History"
after marked all as read' had non-deterministic failures.

More precisely, it crashed on either assertion "there should be 30
messages in History" or "there should be 40 messages in History",
both resulting to 0 messages in History instead.

Unfortunately, as of the date of this commit, we still do not
understand why it rarely fails. In the meantime, we have decided to
make these errors less likely to happen, by waiting much longer
before the assertions. We are aware that this is a poor solution,
but this is much better than skipping the test, until we find and fix
this issue at a later moment.

Closes #43072

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-01-13 10:13:41 +00:00
Alexandre Kühn 6a9b29ec9a [FIX] mail:tests: no crash on intercepted crosstab heartbeat
The test may fail non-deterministically from intercepting an
heartbeat in the local storage. Only a document thread window fold
state change from the local storage should be intercepted.

Closes #43072
2020-01-13 10:13:40 +00:00
Jason Van Malder 01137414a5 [FIX] mail, web: fix activities count when they are uniquified
Issue

    - Install CRM for example
    - Add 41 leads
    - Create an activity on each of them

    Everything ok, load more shows up

    - Add another activity on one of them

    Load more doesn't shows up

Cause

    The uniquify method:
    https://github.com/odoo/odoo/blob/saas-12.3/odoo/models.py#L4187:#L4191

    Consider the second activity as a duplicate and removes it.
    So, in `web_search_read`:
    `len(records) <= limit` is `True` and we ignore all
    the others records

Solution

    Add `force_search_count` in the context when using this action
    to avoid uniquify to falsify the records length.

    I added the tree view for this action too. It improves UX.

OPW-2165455

closes odoo/odoo#43149

X-original-commit: 13ec3503fbfb5d3d2b1e824059737bd866a3a9f4
Signed-off-by: Jason Van Malder <jvm-odoo@users.noreply.github.com>
2020-01-10 17:50:18 +00:00
Mathieu Duckerts-Antoine f2046910bd [REF] web,mail: remove dead code
Removal of dead code (announcement xml and scss files).
2020-01-06 14:37:16 +00:00
Alexandre Kühn e4850c1bb5 [FIX] mail: faster opening of messaging menu
Before this commit, opening the messaging menu might be slow.

This was caused by the parsing of bodies of messages with lots of
HTML nodes. Indeed, the body of a message is linkified and inlined,
and both processes were quite slow due to their implementation: each
node in the HTML were recursively parsed and re-assigning
`innerHTML`. As a result, each node was triggering an HTML parse,
which is very slow on complex nodes.

This commit fixes this performance issue by speeding up inlining and
linkifying of html strings. In the case of linkify, it now triggers
an HTML parse only when necessary, while inlining now relies on its
textContent value.

These changes should drastically improve the speed of opening and
rendering messaging menu, almost ten times faster.

Task-Id 2076299

closes odoo/odoo#42949

X-original-commit: 8db0afb50ce0853a6a8ab7ee11dd5ed876abab64
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-01-08 14:08:14 +00:00
Yuzifu 30e495a241 [FIX] mail: allow to translate the title
Of the rename conversation dialog

closes odoo/odoo#42630

X-original-commit: f9479456c0924c12c098edaebc2013418c09590c
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-01-02 16:53:02 +00:00
e1f4205ef3 [FIX] mail: reset suggested partner when record saved
Before this commit, when "Send message" composer was open with some
suggested recipients, and then editing and saving data related to
the suggested recipients, the suggested recipients were not updated
on composer until some user interactions like page reload.

Steps to reproduce:

- Open an opportunity in CRM;
- Open "Send message" composer;
- Change "Email" field;
- Save changes;
> Suggested recipient above composer textarea is not updated with
newly saved email adress.

It becomes updated only after some user interactions, such as toggle
"Log note" then "Send message" or with a page reload.

This commit fixes the issue by updating the suggested recipients on
the composer in real-time when clicking on "Save".

Task-Id 2089816

closes odoo/odoo#40033

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Co-authored-by: Alexandre Kühn <aku@odoo.com>
2020-01-02 13:38:47 +00:00
Debauche Stéphane 8bee94f260 [IMP] mail: clean the emoji widget (mixin, text_emojis, char_emojis)
PURPOSE

Allow to use the text field with integrated emojis support in other apps
notably mass mailing

SPECIFICATIONS

In this commit we somehow clean code related to emojis widgets

  * simplify some code bits;
  * update comments;
  * add an option on the emojis widget to trigger ``onchange`` on a ``keydown``
    event;

LINKS

Task #2117238
PR #40045
Enterprise PR odoo/enterprise#6630
2019-12-13 10:31:59 +00:00
Debauche Stéphane 2e2e945a0b [IMP] mail: allow emojis support in chat fields through new field widget
PURPOSE

Allow to use the text field with integrated emojis support in other apps
notably mass mailing

SPECIFICATIONS

Currently there is one emojis enabled widget which is based on text widget.
It is therefore limited to ``<textarea/>``.

In this commit we propose to support emojis in char fields, aka using an
``<input/>``.

We therefore move most of the code within a ``FieldEmojiCommon`` and then
creates two widgets based on it

  *  ``text_emojis`` inherits from ``FieldText``
  *  ``char_emojis`` inherits from ``FieldChar``

LINKS

Task #2117238
PR #40045
Enterprise PR odoo/enterprise#6630
2019-12-13 10:24:35 +00:00
Debauche Stéphane e870ccf9ab [MOV] mail, social: move emojis mixin and field from social to mail
PURPOSE

Allow to use the text field with integrated emojis support in other apps
notably mass mailing

SPECIFICATIONS

Move emojis mixin and FieldTextEmojis field definition from social to mail
application. Rename emojis namespace accordingly.

LINKS

Task #2117238
PR #40045
Enterprise PR odoo/enterprise#6630
2019-12-13 10:18:49 +00:00
Vincent Schippefilt 6cbfdbce2d [FIX] mail: Timer(s) tests nondeterministic behavior
Timer test relies on setTimeout(..., 0) for its execution and its
verification. However it seems that in the browser there is *not always*
a guarantee that 2 setTimeout(...,0) will execute in a specific order.

Delaying the verification by 1 ms : setTimeout(..., 1) should force the
order of execution.

closes odoo/odoo#41732

Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-12-12 13:22:20 +00:00
Alexandre Kühn 42de9e129f [REV] mail: prevent message loss during connection issue
This reverts commit e5479fcfdb.

This commit prevented an issue of losing messages on post in case
of connectivity loss. The implementation consists of keeping the
content in the composer until the server acknowledges handling the
message.

However, this solution introduces significant issues. For instance,
sending messages in quick succession will likely loose or duplicate
some content, based on how fast/slow the RPC `message_post` is
resolved. Plus, there was an issue on mobile because the input focus
was lost during the RPC. As a consequence, the virtual keyboard
flickered.

The intent was to fix a rare issue, and since the problems of this
solution clearly outweigh the gain, we decided to revert.

closes odoo/odoo#41544

X-original-commit: 36b2e99e08bfc6d92a821d0346e783695580abf9
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-12-09 09:26:25 +00:00
Kevin Baptiste 6cbe824871 [REV] web: reverts update to fontawesome 5.11.2
This reverts commit ff1c35513a.

closes odoo/odoo#41480

X-original-commit: 116057b26e71db4692280463669f3e80d813ddcc
Related: odoo/enterprise#7110
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-12-09 10:33:36 +00:00
Alexandre Kühn 6245ed2bce [FIX] bus, mail: navigate from tests with mocked bus services
Before this commit, when navigating from test environment (e.g.
page reload), it crashed with following error:

`TypeError: Cannot convert undefined or null to object`

This error comes from mocked bus services in tests: even when they
have been destroyed, they handle the window event 'unload'. They
no longer have a parented parent, so `this.call()` returns
`undefined`, hence the crash.

This commit prevents mocked bus services to listen on window 'unload'
event. Tests must always simulate this window event by explicitly
calling the handler.

closes odoo/odoo#41378

X-original-commit: fd08d04f0a24fea52e7b668b90aec48b33d349a3
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-12-04 14:46:28 +00:00
Thibault Delavallée e2b33f460d [REF] mail, various: rename subtype parameter of message_post to subtype_xmlid
PURPOSE

Clean posting process and improve mail.message definition and comprehension.

SPECIFICATIONS

In order to be more explicit subtype parameter is renamed to subtype_xmlid.
It therefore clearly indicates it should be a valid subtype Xml ID. Support
of ill formatted Xml IDs is removed because there is no reason to try to
add some random prefix. Give something that exists or go to hell, punk !

LINKS

Task ID 2071556
PR #38692
2019-12-02 15:18:44 +00:00
Adrien Dieudonne 2392454011 [IMP] mail: Unsychronize chat windows between mobile and desktop
Currently when you open, for example, 5 chat windows on the desktop,
each of those windows will be opened on mobile as well.
The big issue with that is that I have to shut down all windows before
starting to work on the application.

To make things simple, you have to explicitly open chat window to
make it appears on mobile. Synchronization is blocked in both direction.
We don't update the chat window state on the server and we no longer
consider notifications (bus) about it.

Tests were added in enterprise.

Task ID: 1891952

closes odoo/odoo#41052

Related: odoo/enterprise#6943
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2019-11-30 15:33:31 +00:00
mgh-odooandMohammed Shekha 5c004c2e83 [IMP] mail: show out of office ribbon on discuss
This commit adds the out-of-office ribbon at the top of the
conversation in the discuss app.

Task-2066672

closes odoo/odoo#39362

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2019-11-29 08:56:15 +00:00
Kevin Baptiste ff1c35513a [IMP] web: update to fontawesome 4.7.0 to 5.11.2
FontAwesome 5 introduced new names for some icons as described on
https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4#name-changes

This commit replaces the old names to the new ones.

closes odoo/odoo#35826

Taskid: 2050241
Related: odoo/enterprise#5180
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-28 10:05:12 +00:00
Nicolas Martinelli 7ae118a20b [FIX] mail: reply to note
- Handle the notifications in Odoo
- On any object, e.g. a SO, user A a note and ping user B
- As user B, go to Discuss and reply to the note

The reply is sent a regular message.

Actually, everything is available to reply with the right message type
in:

https://github.com/odoo/odoo/blob/bae8ab7d93143e082e1d1a9cbe20a350c2d34d07/addons/mail/static/src/js/discuss.js#L1327

It is simply unset.

opw-2088619

closes odoo/odoo#40946

X-original-commit: 84c8221c60e3483aa637abad057253424236af83
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-11-27 08:44:56 +00:00
jbm-odoo 77e4c64fd7 [FIX] mail: Limit emojis quantity
If the user put more than 200 emojis, we didn't replace emoji with
image. But due to a typo in the code, this mechanism broke the
discuss application.

closes odoo/odoo#40734

X-original-commit: 0877cb6c84c768bd9fad46fa6f959635bb2353a5
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2019-11-22 16:46:10 +00:00
Lucas Perais (lpe) 0562940f2c [FIX] mail: dicuss can save favorite filters
In discuss, make a search with some stuff, and try to save
that filter as favorite

Before this commit, there was a crash, because the Discuss action
did not implement what the controllers do to save favorites.

After this commit, it is possible to save a filter as favorite

OPW 2087258

closes odoo/odoo#39519

X-original-commit: 5514a414324675bf5c2cc0360e429a7d2548b16f
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-10-29 15:16:17 +00:00
Alexandre Kühn 1049fabfa6 [FIX] mail: messaging ready after 1st chatter rendering
Revision on https://github.com/odoo/odoo/commit/9a66619db33fca5f0cb81d9f6bfeb0fb0290cf68

Commit above improves the web client startup by not having to wait
for discuss widgets to fully load beforehand.

However, it introduced an issue with chatter when the 1st rendering
happens before messaging becomes ready: it displays
"Creating a record..." instead of the whole history of messages.
This happens because when messaging is ready, it updates data from
the chatter but it does not trigger a re-render.

This commit fixes the issue by triggering a re-render on messaging
ready. When messaging is not ready, thread field now displays
"Loading..." instead of the message "Creating a record...".

Task-Id 2078193

closes odoo/odoo#38751

X-original-commit: 93bdd7c91095025f4d6e7a058e0ab1c4e1a0ad60
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-10-14 19:35:20 +00:00
Alexandre Kühn 7ecb8d3f61 [FIX] mail: discuss unstar all
Before this commit, when clicking on "Unstar All" from Discuss
'Starred' mailbox, it crashes with following error:

```
TypeError: unstar_all() takes 1 positional argument but 2 were given
```

This commit fixes this issue

closes #37994

closes odoo/odoo#38738

X-original-commit: ec330d1668640d3ae75e23a70695006a63dbe217
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-10-14 16:30:57 +00:00
Alexandre Kühn 787316cfec [FIX] mail: deletable attachments in attachment box
Revision on https://github.com/odoo/odoo/commit/e7aff236b8073b952a0e554d9897a8f88d5c4c91

Commit above remove cross icon on attachments from messages that are
not in the chatter, since this only makes sense in the chatter.

However, it also removed by mistake the possibility to delete
attachments from the attachment box in the chatter.

This happens because the template of attachments uses a newly
introduced contextual boolean `isDeletable`, and this is false by
default due to undefined being falsy.

This commit fixes the issue by explicitly enabling deletion of
attachments from the attachment box.

Task-Id 2081987

closes #38003

X-original-commit: 1a175686d493d9f289cf391b65a56adc80da82c2
2019-10-14 16:30:56 +00:00
Lucas Lefèvre 8c15358e81 [FIX] web: Avoid blinking attachment box
Go to hr.applicant view form, Edit and change something.
Each time you change a field, the Attachment box in the chatter is toggled
(as if you were clicking on the small attachment button each time).
This a wrong behavior of the `open_attachments` option of the `mail_thread`
widget.
Opening the attachment box should be done at the widget initialisation,
not at every render.

closes odoo/odoo#38720

X-original-commit: 400a1f7bc3d00f5bc95bdbfe1dfadf9d251d808b
Signed-off-by: lul-odoo <LucasLefevre@users.noreply.github.com>
2019-10-14 13:05:08 +00:00
wan 2a868edfdd [FIX] mail: position of composer tools
After commit ef46378, the position of the composer tools of the chatter
was below the text area instead of at the right of it. This is because
one div inside the flexbox was no longer diplayed as a flex or absolute.
By setting that disabled textbox to position absolute, the flexbox can
be displayed normaly again.

closes odoo/odoo#38183

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-10-08 11:08:50 +00:00
fw-bot 0b973f7461 [REF] mail: separate button rendering
original PR: https://github.com/odoo/odoo/pull/25801

closes odoo/odoo#38141

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-10-07 20:00:58 +00:00
Romain Estievenart b5bc4dd46a [IMP] mail: wrong image size on mail preview on mobile
Before this commit, the displayed images with 'o_mail_preview_image'
class were not correctly displayed (some icon were distorted).

Note that this is a minor issue that was already present on older versions.

closes odoo/odoo#37161

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2019-10-07 12:38:55 +00:00
Thanh Dodeur 7e0ed840d6 [FIX] mail: fixes src for text files in the document viewer
Before this commit, the url for the src of the iFrame used
to display text files in the document viewer wasn't properly set,
resulting in the `model` argument to be invalid.

This commit fixes this issue.

Task-Id 2058588

closes odoo/odoo#36160

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-10-02 21:30:17 +00:00
Jorge Pinna Puissant 79afa204e0 [FIX] mail: missing attachment icon
Since 1d766c067d the attachment icon was
missing when it wasn't a pdf or image type file.

opw-2064128

closes odoo/odoo#37687

X-original-commit: c44cec7e5ed9de3be495eb44b351eda6b0f6aeee
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2019-10-01 11:34:05 +00:00
Samuel Degueldre 74e23b2e2b [IMP] Prevent reverse tabnabbing in plaintext2html, linkify, _makeLink
These functions convert plain text links into clickable hyperlinks.
These open in new tabs but did not have the "noreferrer noopener" rel
attributes, which made them susceptible to reverse tabnabbing.

A lot of attack vectors were available to unregistered, uninvited
anonymous users and presented a significant phishing threat (such as
posting links in the instant-chat, through a mail-alias, in a forum post
or in a twitter post) and leading the operator to believe he had been
disconnected from odoo in the original tab, prompting them to enter
their credentials.

while these three places will add the noreferrer and noopener attributes
on the anchor tags generated by them, there are still many places that
create hyperlinks without the use of these functions, although most of
them are static links, they still represent a transitive security
vulnerability to the linked sites.

There are also a few modules and widgets that roll out their own links
or open new tabs unsafely using window.open(), these will need to be
patched separately.

closes odoo/odoo#37591

Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2019-10-01 08:24:59 +00:00
Jairo Llopis e5f673087b [FIX] mail: Support nameless attachments
`ir.attachment` records do not require to have a filename set.

In `AttachmentBox`, a filename is always set, although in case it's missing it was untranslated. I fixed that.

In cases where `AttachmentBox` is not used but its underlying templates are rendered using other means, a user could get a client-side error like this one when browsing a record that had an attachment without filename:

<details><summary>Error</summary>

```
Error:
TypeError: dict.attachment.filename.split is not a function

https://www.tecnativa.com/web/static/lib/qweb/qweb2.js line 469 > Function:26
Rastreo de error:
anonymous@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js line 469 > Function:26:45
_render@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:458:58
call@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:154:35
anonymous/<@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js line 469 > Function:340:33
foreach@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:180:25
anonymous@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js line 469 > Function:338:25
_render@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:458:58
call@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:154:35
anonymous/<@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js line 469 > Function:27:31
foreach@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:180:25
anonymous@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js line 469 > Function:11:23
_render@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:458:58
render@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:450:26
_render@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:480:29
call@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:154:35
anonymous@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js line 469 > Function:20:30
_render@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:458:58
render@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:450:26
_render@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:480:29
call@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:154:35
anonymous@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js line 469 > Function:15:31
_render@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:458:58
render@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:450:26
_render@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:480:29
call@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:154:35
anonymous@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js line 469 > Function:11:31
_render@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:458:58
render@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:450:26
_render@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:480:29
render@https://www.tecnativa.com/web/static/lib/qweb/qweb2.js:450:26
render@https://www.tecnativa.com/mail/static/src/js/thread_widget.js:183:28
_fetchAndRenderThread/<@https://www.tecnativa.com/mail/static/src/js/thread_field.js:124:36
then/</</<@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3276:89
fire@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3119:58
fireWith@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3231:49
Deferred/</deferred[tuple[0]]@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3321:62
then/</</<@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3276:89
fire@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3119:58
fireWith@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3231:49
then/</</<@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3283:104
fire@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3119:58
fireWith@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3231:49
Deferred/</deferred[tuple[0]]@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3321:62
fire@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3119:58
fireWith@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3231:49
then/</</<@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3283:104
fire@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3119:58
fireWith@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3231:49
Deferred/</deferred[tuple[0]]@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3321:62
rpc/<@https://www.tecnativa.com/web/static/src/js/services/ajax_service.js:16:29
then/</</<@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3276:89
fire@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3119:58
fireWith@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3231:49
Deferred/</deferred[tuple[0]]@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3321:62
fire@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3119:58
fireWith@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3231:49
Deferred/</deferred[tuple[0]]@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3321:62
genericJsonRpc/<@https://www.tecnativa.com/web/static/src/js/core/ajax.js:65:18
then/</</<@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3276:89
fire@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3119:58
fireWith@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3231:49
then/</</<@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3283:104
fire@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3119:58
fireWith@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:3231:49
done@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:9275:42
callback@https://www.tecnativa.com/web/static/lib/jquery/jquery.js:9685:57
```

The error is produced when trying to render this line: https://github.com/odoo/odoo/blob/66c5053a3d1f8cb456929453a62869c95eccf86a/addons/mail/static/src/xml/thread.xml#L506

</details>

This patch ensures all attachment has a filename, and fixes that problem.

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
@Tecnativa TT19555

closes odoo/odoo#37546

Forward-port-of: odoo/odoo#37253
X-original-commit: ebba3c9fa709dccf4cab91e9f37aa3eaa24c7d21
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-09-27 17:14:07 +00:00
Priyanka KakadiyaandMohammed Shekha 9b57bfb6a2 [FIX] web, *: button special not working to close dialog
*: event_sale
   mail
   sale_product_connfigurator
   stock

Before this commit: if we open dialog from acitivity view and try to
discard it (i.e. close it), it throws traceback.

Issue arises from following commits:
https://github.com/odoo/odoo/commit/d3d576cf8ec9e5b5f6ae5f9d8845cf384435f12d
https://github.com/odoo/odoo/commit/3210f108272be89f1a7b01f4e1816b7f04ae0a3b

Previously, special attribute was passed directly, but now `on_close`
gets action info as an object.

After this commit, it passes special key as an object for `on_close`,
also changed special action based logic in other modules.

Task-Id 2072181

closes odoo/odoo#37078

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2019-09-27 14:45:51 +00:00
Christophe Simonis f1c0b08504 [MERGE] forward port branch saas-12.4 up to bef26222b8 2019-09-25 16:53:26 +02:00
Christophe Simonis 257a382b5c [MERGE] forward port branch saas-12.3 up to dd627b9698 2019-09-25 13:43:26 +02:00
Alexandre Kühn af26c70469 [FIX] mail: remove "Please wait..." in Discuss when ready
Revision on https://github.com/odoo/odoo/commit/9a66619db33fca5f0cb81d9f6bfeb0fb0290cf68

Commit above improved webclient loading by not having to wait for
the RPC `/mail/init_messaging`.

It introduced an issue in which Discuss app was indefinitely showing
"Please wait...". This commit fixes this issue.

closes odoo/odoo#37337

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-09-24 12:23:22 +00:00