Commit Graph
679 Commits
Author SHA1 Message Date
XavierDo bb8df1b79a [FIX] mail: verify attachment access early to avoid errors later 2018-11-02 11:25:42 +01:00
len-odoo c0f66d6c2d [FIX] mail: create attachments with the correct filename when using the popup editor
Send a message using the popup editor.
Drag and drop an image into the message content.
It will create an attachment for the inlined image.
To generate the values for the attachment, a regex is used to parse the content.
Besides summoning Eldritch abominations, it didnt't take into account the
original filename, whereas the default one (image) would have no extension.
We extend the regex to capture the filename and use it.

opw 1903194

closes odoo/odoo#28527
2018-11-09 12:09:51 +00:00
len-odoo 5c2f96d0dd [FIX] mail: create attachments on the correct record when using the popup editor
Send a message using the popup editor.
Drag and drop an image into the message content.
It will create an attachment for the inlined image.
However it did give a res_model value of mail.message but no res_id;
add_missing_default_value would fill in the res_id from the _context, which is
not the mail_message but the current object on which it applies
(e.g. helpdesk.ticket).
We put the correct res_model along with the res_id.

opw 1903194

closes odoo/odoo#28526
2018-11-09 13:28:07 +00:00
Julien (juc) Castiaux 5c38c87ddd [FIX] mail: access error for the id of another company
When creating a mail for a user in an other company then the
record, the "send" button fails with a traceback because on
specific template try to access the company.id of the user
which is not accessible due to the access controle.

This PR fixes the problem by sudoing the access to company id.
The mail now sends without problem.

Step to reproduce:

1. Use two companies (comp1 and comp2)
2. Use 3 users (user1, user2, user3)
3. Be sure every user has a confirmed account
4. Change the users to set both company as allowed.
5. Set the current company of the users as follow:
   user1: comp1
   user2: comp2
   user3: comp2
6. Install the project module
7. In `settings > security > record rules`, archive the rules named:
   - `Project: multiple-company`
   - `Project/Task: multiple-company`
   - `user rule`
8. Using user1, create a new project and a new task.
9. Using user2, go to `Project module > Search`, remove `My tasks` filter,
   select the task created by user1, in the chatter add user3 as follower.
10. Send the mail => access error.

The `AccessError` is due to user2 trying to access comp1, in particular
`company.name`.

By adding a `sudo`, we also make sure that the template rendering won't
fail bacause of a similar `AccessError`.

opw-1907844

closes odoo/odoo#28710
2018-11-26 09:49:50 +00:00
Christophe Simonis 45d33f5357 [FIX] mail: correctly handle unset mimetype on safari
See 5e3b471f4a for more info
2018-11-16 17:25:55 +01:00
Yenthe V.G 992c4dbe38 [FIX] mail: set default _rec_name to avoid showing model with id
closes odoo/odoo#27186
2018-10-24 14:21:04 +00:00
Julien (juc) Castiaux 4c65499cca [FIX] mail: Emails are sent in reverse order
The CRON job that sends email sends them in a LIFO order instead
of a FIFO order which can lead to confusion when the order is
important.

Exemple, when updating multiple time an appointement, the last
update should be the newest mail clients receive in their mail box
which was not the case before this PR.

opw-1888601

closes odoo/odoo#27888
2018-10-18 09:24:00 +00:00
Christophe Simonis 1b5f14713b [MERGE] forward port branch saas-15 up to 0ef5cedebb 2018-10-08 18:59:03 +02:00
Christophe Simonis 0ef5cedebb [MERGE] forward port branch saas-14 up to 637e4c68fc 2018-10-08 17:29:03 +02:00
Christophe Simonis 637e4c68fc [MERGE] forward port branch 10.0 up to e88c5c1ece 2018-10-08 17:28:08 +02:00
len-odoo e88c5c1ece [FIX] mail: sudo on user name
Suppose user A creates a sale order S in company X. He then changes to company Y
Sales manager B, in company X, creates the invoice for sale order S.
Bug: the compilation of the report fails because of the user.name in the
template. Then the tracking update fails, making it impossible to validate the
invoice.

opw 1884915
2018-10-08 15:59:30 +02:00
Christophe Simonis a651e8eed8 [MERGE] forward port branch saas-14 up to 72b2bab8c8 2018-09-13 10:58:54 +02:00
Christophe Simonis 72b2bab8c8 [MERGE] forward port branch 10.0 up to e6ca846c65 2018-09-13 10:54:06 +02:00
Nicolas Lempereur 72d7dd8994 [FIX] *mail_thread: don't modify modified help
The 'help' of window action is often fiddled with, adding thing before,
after or arround it.

For example in CRM leads, we add at the beginning "Click to add a new
opportunity" with an arrow towards the button, and after if there is a
mail alias: "All email incoming to * will automatically create new...".

But for crm.lead, hr.expense, sale.order this would not take into
account that the fiddled "help" can be edited, so if we edit 2 times
help in studio or backend action editing, we would get:

  Click to add a new opportunity
  Click to add a new opportunity
  Click to add a new opportunity
  [Original help content]
  All email incoming to * will automatically create new...
  All email incoming to * will automatically create new...
  All email incoming to * will automatically create new...

And see several "arrows" towards the button (in enterprise the
additional ones are on same color background).

With this commit we do what is done in "mail.thread" by default which is
not fiddling with the `help` if has been fiddled before (if it contains
"oe_view_nocontent_create" class).

note: for 10.0 up to not including 11.0 which is fixed by #26911

opw-1877663
closes #26912
2018-09-12 13:11:21 +02:00
len-odoo 09340bb7f0 [FIX] mail: set the thread_id when creating a new thread
After a refactoring for v11, the id of a newly created thread is not returned
anymore.
Therefore server actions weren't being executed on newly created records.

opw 1886383

closes odoo/odoo#27238
2018-09-26 08:36:14 +00:00
Christophe Simonis 4703d649dc [MERGE] forward port branch saas-14 up to aeb3391a2d 2018-08-24 14:07:40 +02:00
Christophe Simonis aeb3391a2d [MERGE] forward port branch 10.0 up to b50958c40f 2018-08-24 11:42:33 +02:00
Christophe Simonis b844e9af8b [MERGE] forward port branch 9.0 up to 81f975d3f4 2018-08-23 10:54:52 +02:00
Toufik Benjaa 81f975d3f4 [FIX] mail: channel_get return wrong channel when duplicate partners
- In some cases (merge of partners, etc ...) there might be mail.channel
  that have two mail.channel.partner with the same res.partner.
  When you try to open a discuss window with a partner for which you
  have no existing mail.channel.
  The channel opened is the one where your partner is duplicated.
  This is due to the fact that the SQL request to find the mail.channel
  doesn't take in account that a mail.channel may have twice the same
  partner.

  To fix this issue, we try to exactly match the partners we search.
2018-08-22 17:59:22 +02:00
Christophe Simonis 65a80cf3fd [MERGE] forward port branch saas-14 up to 0c5cbbe0bb 2018-08-07 17:01:16 +02:00
Christophe Simonis 0c5cbbe0bb [MERGE] forward port branch 10.0 up to 692a32e780 2018-08-07 16:54:18 +02:00
Christophe Simonis 535d50afbd [MERGE] forward port branch saas-14 up to 5a57892b05 2018-07-30 12:48:15 +02:00
Christophe Simonis 5a57892b05 [MERGE] forward port branch 10.0 up to 7a519520f2 2018-07-30 12:46:20 +02:00
Christophe Simonis 7a519520f2 [FIX] mail: use -U+FEFF instead of U+2011 for negative numbers
Just like cb2a3afa7e, U+2011 may not be
rendered correctly with all fonts.
2018-07-30 12:22:16 +02:00
Nicolas Lempereur 8e77632e58 [FIX] *mail_thread: don't modify modified help
The 'help' of window action is often fiddled with, adding thing before,
after or arround it.

For example in CRM leads, we add at the beginning "Click to add a new
opportunity" with an arrow towards the button, and after if there is a
mail alias: "All email incoming to * will automatically create new...".

But for crm.lead, hr.expense, sale.order this would not take into
account that the fiddled "help" can be edited, so if we edit 2 times
help in studio or backend action editing, we would get:

  Click to add a new opportunity
  Click to add a new opportunity
  Click to add a new opportunity
  [Original help content]
  All email incoming to * will automatically create new...
  All email incoming to * will automatically create new...
  All email incoming to * will automatically create new...

And see several "arrows" towards the button (in enterprise the
additional ones are on same color background).

With this commit we do what is done in "mail.thread" by default which is
not fiddling with the `help` if has been fiddled before (if it contains
"oe_view_nocontent_create" class).

note: this is the 11.0 version of #26912

opw-1877663
closes #26911
2018-09-12 13:18:35 +02:00
Lucas Perais (lpe) 816f386161 [FIX] mail: action send mail no default_type
Have a send email automated action on invoices upon validation (write)

Go onto the credit notes, create one, and validate

Before this commit, at the creation of the attachment (the invoice pdf), there was a traceback
because default_type was in the context containing 'out_refund'
And that attachments also have a field 'type'
So the default_get of the latter got a value that wasn't correct for its field

After this commit, we clean the context of the default_type context key since it
is irrelevant beyond that point

OPW 1868638

closes #26621
2018-09-11 09:35:44 +02:00
Goffin Simon 15c81d74a3 [FIX] mail: Timezone issue when creating a call
Steps to reproduce the bug:
- Let's consider the today date = D
- Set on your preference a timezone which has another today date = D+1
- Go to CRM > Configuration > Activiy types > Call
- Set 0 as # Days
- Go to CRM > Pipeline > Click on a lead
- Schedule an activity of type = Call

Bug:

The Due Date = D instead of D+1

opw:1877217
2018-09-04 09:20:24 +02:00
Christophe Simonis 33981790de [MERGE] forward port branch saas-15 up to 4703d649dc 2018-08-24 18:03:00 +02:00
Nicolas Lempereur 01b1830219 [FIX] mail: access token in received cid images
Following 50ab18176 an access token is added in the URL, but there may
not be an existing access token. If so this commit generate one.

opw-1877347
closes #26526
2018-08-23 15:38:34 +02:00
len-odoo f4ec8b95b7 [FIX] mail: only get one mail channel partner per user
When more than one mail.channel.partner have been linked to a given user, he may
be unable to open some discussion channel because of a traceback.
The issue is that we access a channel_partner field while the recordset is not a
singleton.
We limit the search to 1 to ensure that this recordset is a singleton.
2018-08-09 11:24:27 +02:00
Thibault Delavallée 91486656ab [FIX] mail: log correct user deleting the record
When using sudo, the administrator is logged as deleting the action.
For audit reason, log the correct user.
To avoid access rights errors, only group system can delete the action.
2018-07-07 17:35:42 +02:00
Martin Trigaux 13f02f2c0a Revert "[FIX] mail: Render mail in the template language"
This reverts commit 5a0dcd3c20.

Same as 6ad6df59b5
Was mistakly merged, should not be integrated into stable
2018-06-29 13:02:16 +02:00
Nicolas Martinelli 5a0dcd3c20 [FIX] mail: Render mail in the template language
On an optimization done for not rendering each time the template, the possibility
of sending the template in the proper language when multiple recipients was lost.

This is being refactoring in master, but for this version, Odoo won't merge a
change in the behavior, although it's the correct one as in previous versions.

Extracted by pedrobaeza from https://gist.github.com/nim-odoo/8a9749037370343f05c7e6681324f576

(cherry picked from commit 386a936)
2018-06-28 21:06:32 +02:00
Thibault Delavallée 2d32609440 [FIX] mail: log correct user deleting the record
When using sudo, the administrator is logged as deleting the action.
For audit reason, log the correct user.
To avoid access rights errors, only group system can delete the action.
2018-07-07 17:35:42 +02:00
Thibault Delavallée 1e42cbc1f4 [FIX] mail: log correct user deleting the record
When using sudo, the administrator is logged as deleting the action.
For audit reason, log the correct user.
To avoid access rights errors, only group system can delete the action.
2018-07-07 17:35:42 +02:00
Christophe Simonis 248a59553d [MERGE] forward port branch saas-15 up to 535d50afbd 2018-07-30 12:53:34 +02:00
Xavier Morel 9f8eae34d1 [FIX] undefined variables (potential nameerror)
Backport 9ec0455abc and
6a601fe6dc as they fixed various
possible NameError but did so in later sub-releases.
2018-07-19 13:37:10 +02:00
Christophe Matthieu 50ab181762 [FIX] mail: add access_token for image from base64 and cid 2018-07-11 15:38:59 +02:00
len-odoo a58ffb9e78 [FIX] mail: use ids parameter in the process_mail_queue method
If the parameter ids is given to the process_mail_queue method, it is supposed
to only process the ids it was given, not all mails.
Commit https://github.com/odoo/odoo/commit/4b122ad41d873febe288ab1f8c6cdc078ca2a479
replaced ids by self.ids, and thus default filter was always applied.

fix suggested by @suganthikarunanithi, Sodexis team

opw 1860484
2018-07-06 09:47:44 +02:00
Martin Trigaux a978a3647a [FIX] mail: multi-company access to TZ
- Create 2 Companies A & B
- Set User B in Company B
- Record some `mail.activity` for User B on a lead belonging to Company
  B.
- With a manager user in Company A, go to Kanban view of leads and
  remove filters => all leads, including leads in Company B, are
  displayed

An access error occurs.

`read_progress_bar` method, tries to access the field `activity_state`
which is: `states = record.activity_ids.mapped('state')`. The state of
a `mail.activity` is using the tz of the partner. To read the
`activity_state` of a lead, one needs to access
`record.activity_ids.user_id.partner_id.tz`
=> multi-company security rules raised

opw: 1850984, 1859470
2018-07-05 15:29:34 +02:00
Goffin Simon 5e3b471f4a [FIX] mail: Playing video not working on iOS
Steps to reproduce the bug:

- Go to Odoo on Safari browser
- Go to CRM > Operations > Manufacturing orders
- Select a MO and log a note on it with a video attachment
- Try to watch the video

Bug: it's not possible to watch the video

HTTP servers hosting media files for iOS must support byte-range requests, which iOS
uses to perform random access in media playback. (Byte-range support is also
known as content-range or partial-range support.)

Odoo server doesn't support partial requests with accept-ranges

opw:1857873
2018-06-27 09:42:42 +02:00
Tomas Alvarez 1db6c8d0ad [FIX] mail, web_editor: allow tel links in email templates (#24926)
Before this commit: links like `tel:+1-555-555-5555` were being replaced
both in javascript (prefixing `http`, when using the summernote editor)
and python (prefixing the base url, when they were added directly to the template).

After this commit: the replacement is avoided on links with `tel` scheme.

This is related to commit: 8b97a39
2018-06-06 09:57:53 +02:00
SEINLET Nicolas 0b6182de38 [FIX] mail: speed up search on followers (#24737)
Odoo puts in cache all stored fields of a recordset when you access the
first stored field not already in cache.  In this particular case, Odoo
will put in cache all stored fields of 'mail.followers', which is
unnecessary and time consuming, especially on models where user follows
plenty of records.

With thousands of followed records, using a read() when searching on
followers is around 2.5 times faster than using mapped().

Record rules based on followers are speed up the same way.
2018-05-18 15:05:22 +02:00
Thibault Delavallée 7313ce7d3c [FIX] mail: correctly fetch needaction partner ids in chatter
Why y push too fast.
2018-05-17 12:34:46 +02:00
Thibault Delavallée 0897195f91 [FIX] mail: improve implementation of message format fix
This is a better implementation of 19fb650863. It seems we did not
see the fix was inside a loop meaning not really optimized when thinking about
Inbox fetching a lot of messages.
2018-05-17 12:27:38 +02:00
Nicolas Martinelli 77aa313b14 [FIX] mail: XHTML
In case an email received contains XHTML, `fromstring` fails because of
the following error:
> Unicode strings with encoding declaration are not supported. Please
> use bytes input or XML fragments without declaration.

opw-1832683
2018-05-17 09:27:38 +02:00
Xavier Dollé 19fb650863 [FIX] mail: correctly filter needaction on unread notifications in message_format
Previously to this commit needaction used by JS was not taking into account
read notifications. It means notably Inbox counter could be higher than
expected as taking into account read messages while Inbox displays only
unread messages. This commit fixes that by checking notification state when
giving needaction_partner_ids to message_format result.

This fix has a small impact on performances as message_format is used in
notification process for chat or push. A better implementation of message
format and its postprocess could probably lessen this fix impact. As we
target stable version we avoid rewriting other part of the code. Optimization
will be done in development version.

Related to task ID 1841243. This is a manual backport of commit 69714fbeee
done in saas-11.2.
2018-05-16 16:00:43 +02:00
len-odoo 6c6c4b89a0 [FIX] mail: parse eml/msg attachments
When parsing an email with some eml or dmg attachment, the parsing would
generate an attachment with empty content.
Since this content is later encoded in base64, it would crash trying to encode
None.
We simply do not process attachments without content.

We add a test to check that parsing mail with some empty attachment doesn't
crash, since the crash implies that the mail gets stuck on server
and is never fully processed by Odoo.

opw 1814014
2018-05-09 16:49:34 +02:00
Nicolas Lempereur 2b0d68bc41 [FIX] mail: activity in date tz but counts are not
When creating an activity, the date saved will be the choosen one in the
tought in the client timezone.

But when displaying the counts of activities Late/Today/Future, the date
is tought out as the one in the server timezone.

Thus we would have activity today/future/late not corresponding with the
date in the current timezone.

This is solved in this change and follow what was done in 72254129.

A second change is made so the default "Due date" is today in the
timezone and not today in UTC date.

opw-1837894
closes #24554
2018-05-05 00:38:35 +13:00
Thibault Delavallée 901658df26 [REM] mail: remove duplicated method
This commit remove duplicated code probably due to a forward-port of a backport
or something like that. Or maybe due to a cosmic beam.

See commits https://github.com/odoo/odoo/commit/14f80bfae66f2c81abb0b8acc0ac558c60ef1d44 and https://github.com/odoo/odoo/commit/36141931bf9a57d01747cb219fdcfdfd7978ab42.

Cheers.
2018-05-04 10:27:58 +02:00