Commit Graph

934 Commits

Author SHA1 Message Date
Thibault Delavallée d4a1eb4435 [FIX] mail, mail_group: recipients of mail groups
Mailing lists (mail.group) should not send specific notification emails.
Indeed there can be a lot of recipients and customizing each email can
take time to compute. This leads to posting a message on a mail.group
being very slow.

It is now possible for a model to customize the notification email
recipients computation. The first use is to ensure that mail.group
encodes recipients using email_to instead of recipients_ids. This way
less processing is performed on notification emails.
2015-12-11 11:22:40 +01:00
Denis Ledoux 12f77fa22f [FIX] mail: notify all partners of the thread
As stated in the comment:
```
all notified_partner_ids of the mail.message
have to be notified for the parented messages
```

Record rules are applied when browsing one2many fields.
Therefore, when browsing `message.notified_partner_ids`
with a user other than the SUPERUSER, the multi-company
rules are applied, and a regular user could therefore not see
all partners of the thread, according to which
company the partners are associated with.
Nevertheless, all partners of the thread have to be notified,
including the ones the regular user cannot see.

To reproduce the issue:
 - Create a second company 'Second company'
 - Create a third user, associated to the first company 'YourCompany'
 - Set the demo user as in the 'Second company'
 - Create a project 'test' in the first company, 'YourCompany'
 - In the followers of the project, add the Demo user,
   with as subtypes "Stages changes" only
 - As the third user, create a new task in this project
 - Change the stage of this task, as the third user [this is important]
 - Sign in as the demo user, and see that you cannot access
   your messages inbox, due to an access rights error.

opw-650563
2015-11-26 18:08:07 +01:00
Jairo Llopis ffa28488be [FIX] mail: subscribe to threads before sending first message
Users subscribed to creation of records (new leads in a sales team, new
tasks in a project, etc.) are never notified. The reason is that users
were subscribed after the record creation notification.

Introduced in 43915a8721
Closes #8723
2015-09-29 15:27:46 +02:00
Christophe Simonis 799fff6897 FIX] mail: ignore parent message for forwarded private messages. 2015-07-24 17:56:30 +02:00
Christophe Simonis 066e41b63d [MERGE] forward port of branch saas-3 up to 31f2a1b 2015-06-30 13:33:35 +02:00
Christophe Simonis 31f2a1bc38 [MERGE] forward port of branch 7.0 up to 1c0bc7c 2015-06-30 12:47:27 +02:00
Nicolas Martinelli f498583a98 [FIX] mail: make sure to send bouncing email even if the mail is a direct reply
This could happen if a partner is removed from the list of followers.

opw-633988
2015-06-30 12:39:03 +02:00
André Paramés 7e0ed740f3 [FIX] mail_thread: correctly handle single id argument in `unlink`
fixes #1721
closes #1723
2015-06-26 15:25:02 +02:00
Bartłomiej Wójcicki 43915a8721 [FIX] mail: notify auto subscribers after message creation. 2015-06-18 16:56:16 +02:00
Christophe Simonis 5e7f143c21 [MERGE] forward port of branch saas-3 up to ed76b2a 2015-06-11 13:00:49 +02:00
Christophe Simonis ed76b2a782 [MERGE] forward port of branch 7.0 up to e470385 2015-06-11 12:46:06 +02:00
Jean-Baptiste Quenot 3d35a5d42b [FIX] mail: Strip In-Reply-To header
For emails sent via Office 365, reply-to header could contains additional spaces
or get multiline header.
e.g.:
In-Reply-To:
	<4ba8f246904b4fedb49fbab7945a7f82@AM3PR06MB433.eurprd06.prod.outl$$k.com>

The message lookup fails if header is not stripped
2015-06-03 19:12:12 +02:00
Denis Ledoux 417f012ce9 [IMP] mail: use `has_group` to check a user is part of a group
`has_groups` is more efficient, and won't lead to useless
prefetches.

opw-634402
2015-05-12 12:21:56 +02:00
Denis Ledoux 953a5509d2 [IMP] mail: use `has_group` to check a user is part of a group
`has_groups` is more efficient, and won't lead to useless
prefetches.

opw-634402
2015-05-12 11:33:43 +02:00
Christophe Simonis 32cede1563 [FIX] mail: ignore bounce mails.
Note: bounces from marketing campaigns are already processed
2015-04-14 11:37:43 +02:00
Olivier Dony 6377699c44 [FIX] website_forum: check karma access on direct message edit/unlink too
Access rights on messages are derived from the
access rights on the documents they are attached
to. Due to the karma-based nature of the forum
access rights, these do not automatically reflect
on messages, because they are not implemented as
access rules.
The check_mail_message_access() needs to be
overriden to achieve the same effect.

+ allow calling super().check_mail_message_access()
from new API (useful in forward-port)
2015-04-07 10:10:20 +02:00
Christophe Simonis 8ad11055bb [MERGE] forward port of branch saas-3 up to 12f600c 2015-04-01 19:13:25 +02:00
Christophe Simonis 12f600cec9 [MERGE] forward port of branch 7.0 up to 35077af 2015-04-01 19:07:59 +02:00
Nicolas Lempereur 35077af57d [FIX] opportunity: salesperson not in followers
Previously, when updating subscribers of a mail.thread, the default_{key}
arguments could override a {key} in the values.

e.g: for an new opportunity, the salesperson was overrided by the default user_id

This fix gives the priority to the values over the default_ in context.

opw-631741
2015-04-01 16:37:01 +02:00
Nicolas Lempereur bff042d652 [FIX] mail: two arrows in empty list help
When an mail alias for catchall domain was assigned, some checks were not done
and a empty list help was wrongly displayed. Thus two arrays and some inconsistent
messages were displayed.

This commit correct this behavior so only one arrow is displayed.

Another part of the issue, was an erroneous propagation of context which should
be solved by a futur commit.

opw-630673
2015-04-01 09:11:21 +02:00
Christophe Simonis c54d83ebd5 [FIX] mail: column `read` -> `is_read`
This is the reverse patch of 132afa981b
2015-03-25 18:36:52 +01:00
Christophe Simonis 3540ec53e4 [MERGE] forward port of branch saas-3 up to 6b70b80 2015-03-25 18:00:08 +01:00
Christophe Simonis 6b70b80a0e [MERGE] forward port of branch 7.0 up to 881c10b 2015-03-25 17:41:53 +01:00
Denis Ledoux 132afa981b [FIX] mail: is_read is the column name in 8.0.
The column 'read' has been renamed 'is_read' in Odoo 8.0.
2015-03-23 15:46:32 +01:00
Denis Ledoux 3235eda781 [FIX] mail: notify parent message on message auto subscribe.
When auto subscribing to a message
(For instance, change the ```user_id``` field on a record,
like an invoice)
The new user is notified of the last message of the thread.
He must be notified of the parent message as well,
to have access to the first message of the thread,
to prevent access rights issues to the thread.

This mechanism is applied in the _notify method
of model ```mail.message``` as well, for the same reasons.

opw-630286
2015-03-23 15:26:41 +01:00
Denis Ledoux 87dd06c941 [MERGE] forward port of branch saas-3 up to 8c150c6 2015-01-15 14:43:32 +01:00
Denis Ledoux a692c6e934 [MERGE] forward port of branch 7.0 up to f406847 2015-01-15 11:49:28 +01:00
Olivier Dony 005e24fada [FIX] mail.thread: correct matching when finding author + test
The previous matching rules were too fuzzy and allowed random
prefix-match or tail-match of other user's emails.
For example when looking up a partner matching 'foo@bar.com'
the system would sometimes find 'dom.foo@bar.com' instead,
or 'foo@bar.com.tw'.

Fixed by only allowing direct case-insensitive email match
of an addr-spec, or substring match of the addr-spec enclosed
in angle brackets, within a name-addr pair.
See also RFC5322, section 3.4

Also adapted related message_find_partner_from_emails() method
to factor out the partner email resolution mechanism to avoid
the same problem.

Adds corresponding regression test.
2015-01-07 17:50:42 +01:00
Denis Ledoux 72874e1a21 [REF] mail: extract auto subscribe notifications sending into a sub-method
To allow customization, such as do not send the notification to the partner that subscribed himself to the thread (he probably already read the thread, no need to send him an email)
2014-11-24 12:15:44 +01:00
Raphael Collet f2e4a10e1a [IMP] use model._fields instead of model._all_columns to cover all fields
The old-api model._all_columns contains information about model._columns and
inherited columns.  This dictionary is missing new-api computed non-stored
fields, and the new field objects provide a more readable api...

This commit contains the following changes:

 - adapt several methods of BaseModel to use fields instead of columns and
   _all_columns

 - copy all semantic-free attributes of related fields from their source

 - add attribute 'group_operator' on integer and float fields

 - base, base_action_rule, crm, edi, hr, mail, mass_mailing, pad,
   payment_acquirer, share, website, website_crm, website_mail: simply use
   _fields instead of _all_columns

 - base, decimal_precision, website: adapt qweb rendering methods to use fields
   instead of columns
2014-11-04 13:47:57 +01:00
Christophe Simonis 262eb662de [MERGE] forward port of branch 8.0 up to d80376a 2014-10-21 14:33:36 +02:00
Christophe Simonis 22c390285f [MERGE] forward port of branch 7.0 up to 78a29b3 2014-10-21 13:06:27 +02:00
Denis Ledoux 1d57a09112 [FIX] mail: set the parent_id to the first message of type email
And fallback of any type if there is none of type email

This fix allow the communication between two mail thread from two different Odoo servers having message creation subtypes, like project issue or crm lead
2014-10-16 14:07:38 +02:00
Jeremy Kersten f1c637b1dc [FIX] mail_thread: allow to pass mail_track_log_only in the context to remove the subtype of the notification. By this way, no mails will be sent because partners_to_notify will be empty. 2014-10-14 16:32:40 +02:00
Christophe Simonis 2e3f59181d [MERGE] forward port of branch saas-3 up to db75994 2014-10-14 15:13:14 +02:00
Olivier Dony edd94b623e [MERGE] Forward-port 7.0 up to 1b49a87 2014-10-10 19:21:18 +02:00
Martin Trigaux bd52298073 [IMP] mail: parsing emails with several html parts
If an email contains several text/html parts inside a multipart email, the previous code was only keeping the last content part.
The Content-Type: multipart/mixed allows several independent part (RFC1341 7.2.2), so two html is technically valid.
With this patch, the two parts are concatenated. (opw 614755)

Modify append_content_to_html regex to make sure the regex keeps the content of the html instead of removing it.
e.g.: "123 <html> 456 </html> 789" used to be stripped to "123  789" while we expect "123 456 789"
2014-10-09 13:53:23 +02:00
Thibault Delavallée 7cad4baa84 [FIX] [CLEAN] Various: fixed / cleaned use of dict.fromkeys.
Indeed using fromkeys with a list / dict as argument leads to the creation
of shared list / dict. This could create some ugly side effects when
used in loops. This commit fixes or cleans this kind of statement to avoid
unwanted side effects.
2014-09-18 11:18:30 +02:00
Christophe Simonis 780dd9891f [MERGE] forward port of branch saas-5 up to 7eab880 2014-09-15 14:00:02 +02:00
Christophe Simonis 56f2b7ae0f [MERGE] forward port of branch saas-3 up to fdc6271 2014-09-12 18:53:48 +02:00
Denis Ledoux 2684b7de4c [FIX] mail: alias domain should be fetch as superuser
as ir.config.parameter has limited access
2014-09-10 17:26:39 +02:00
Denis Ledoux e447a46ec8 [MERGE] forward port of branch 7.0 up to 33e0910 2014-09-09 18:02:30 +02:00
Rifakathusen Haradwala f51dac038e [FIX] mail: translate tracked fields name in chatter
Status tracking messages are not translated into user's language while updating any document with tracked fields (opw 612847)
2014-09-05 13:53:25 +02:00
Denis Ledoux d824769b3c [FIX] tools,mail: improve parsing of references from rev. 0bee015dd6
Backport of 8.0 fix was not enough for 7.0, because it still fails for the legacy reference match (model+res_id), which is not used in 8.0
2014-09-05 11:44:20 +02:00
Anael Closson 0bee015dd6 [FIX] mail: more robust parsing of In-Reply-To/References (OPW 608919)
When parsing incoming messages, ignore white-space around
In-Reply-To headers, and extract message-id items inside
the References header using a regex.
This actually serves as a workaround for broken MTAs
mangling References (such as outlook.com nesting past ones
with commas, violating RFC2822).

Closes #516 as a manual rebase.
2014-09-01 13:51:08 +02:00
Thibault Delavallée 6954fe972f [CLEAN] mail: remove unused import 2014-08-29 13:08:10 +02:00
Thibault Delavallée 9094d768d0 [FIX] [IMP] mail: fixed mail sent to users being redirected to their partner profile
leading to potential issues.

Now the behavior is back to its previous version, posting on the user creates a private
discussion. Fixed management of model variable in message_post to avoid posting messages
on the mail.thread model.

Classic inbox writes on partner, with hr it writes on the employee profile, like previously.
2014-08-28 12:53:34 +02:00
Olivier Dony e11eddf753 [MERGE] Forward-port of saas-5 up to 20cc18d 2014-08-13 20:46:47 +02:00
Thibault Delavallée 2e5412fc1d [FIX] mail, BaseModel, portal_sale: fixes and improvements in the URL
management to access documents in notification emails, as well as for the
'view quotation' link in portal_sale module.

models: added a get_access_action method: basically, returns the action to
access a document. It uses the get_formview_action by default (form view
of the document). However for some documents we want to directly go to the
website, leading to an act_url action for some documents. This method allows
this behavior.

portal_sale: get_signup_url now uses the mail.action_mail_redirect method
instead of directly redirecting towards a portal menu. This allows to fall
back on a standard behavior.

portal_sale: get_formview_action updated, to match actions tailored for
portal users.

website_quote: get_access_action of sale order updated. If the sale order
has a template defined, the returned action is an act_url (website view
of the quotation), not the form action anymore.

mail: fixed signature + company signature in notification emails. Even without
user signature, the company signature + access link should be correct.

portal: signup url in notification emali was not using the mail redirection
as action. It is now the case.
2014-08-07 16:47:59 +02:00
Olivier Dony 494ecc620f [MERGE] Foward-port saas-5 up to ee4df1e 2014-08-01 14:24:07 +02:00