Commit Graph

474 Commits

Author SHA1 Message Date
Jairo Llopis 9d535ee2c7
[FIX] mail: check all parameters are set
Since `model` is not a required field, the invalidation may crash when one is
missing.
It should never happen than a mail.message has a res_id but not a model as it
makes no business sence.
However it is possible than a message temporarly misses one of the two, e.g:

```
self.model = False
self.res_id = False
```
will trigger two writes and will crash at the first.

Above code should probably be refactored to have only one write but this commit
fixes a regression introduced at 8f1c2bfc (the above code did not crash).

Closes #15199
2017-01-24 16:56:33 +01:00
Christophe Simonis 8f1c2bfc91 [FIX] mail: force mail.message linked record invalidation 2017-01-17 14:14:16 +01:00
Goffin Simon 7c5275b6a1 [FIX] mail: to prevent infinite loop
Introduced by fac04424ca
2016-05-19 12:03:59 +02:00
Goffin Simon fac04424ca [FIX] mail: receiving a notification without notifying the parent message.
Used case:

If you add a user which has no acces on a model(ex:purchase.order)
as follower on a record of this model. When someone responded by email on
this record, and when a message is sent on this record, an exception is raised
at the connection of the user added as a follower.

Fix:

To have the rights to read the message, a read notification for this follower must
be added to all parents of this message.

Closes #11902

opw:676699
2016-05-18 14:07:54 +02:00
Nicolas Seinlet 6f29bfc181 [FIX] mail: remove unneeded call to `refresh()`
With new api, this call is not wanted anymore. The cache is cleared
automatically, no need to clear the whole cache; that's a little bit
overkill and reduce performances.
2016-05-12 11:35:46 +02: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
mariuszmizgier 859eb2511e [FIX] mail: Mail message performance improvement
As of version 8.0, search_count method has been implemented
Usage in this place is not needed though,
as we just need to know if there are messages in domain,
not the exact number of them.
Due to that we replace method search_count with search and add a limit of 1,
which provides better performances.

Fixes #6670
Closes #6679
2015-06-24 12:12:19 +02:00
Denis Ledoux ddb8d40e3b [MERGE] forward port of branch saas-3 up to ffc40b6 2015-05-12 18:03:04 +02:00
Denis Ledoux ffc40b611b [MERGE] forward port of branch saas-3 up to e2bfb96 2015-05-12 17:55:50 +02:00
Olivier LAURENT 242e61796b [FIX] mail: missing spaces in email subjects composed of several encoding
sometimes some blank spaces are lost in subject of some incoming messages

There is a bug in `decode_header` in Python < 3.3,
which leads to lost some spaces in the email subjects
when several encodings are used in this subject.

See
- Issue: http://bugs.python.org/issue1079
- Fix: https://hg.python.org/cpython/rev/8c03fe231877

Joining the strings returned in the result of `decode_header`
solves most cases. Only extreme cases, like having
a subject with several different encodings following
each other without white spaces between them could lead
to have extra spaces in the subject. It won't happen
most of the time.

Closes #6629
2015-05-12 17:53:16 +02:00
Christophe Simonis b5e1e14c5d [MERGE] forward port of branch saas-3 up to 59d82e6 2015-04-07 14:08:15 +02:00
Christophe Simonis 59d82e6fe7 [MERGE] forward port of branch 7.0 up to 5042d91 2015-04-07 13:36:01 +02:00
Goffin Simon 3bd29a3483 [FIX] mail: display messages in chatter of inactive records
The method search inside _find_allowed_model_wise must consider records with active field=True.

opw:630295
2015-04-02 16:39:11 +02:00
Denis Ledoux 0021fa977d Revert "[FIX] mail: read more show original message"
This reverts commit 0790682296.

This fix is not yet ready. See PR #3295
2014-10-28 13:43:25 +01:00
Denis Ledoux 0790682296 [FIX] mail: read more show original message
Instead of html cleaned html, to allow display blockquotes

opw-614729
2014-10-27 13:24:47 +01: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 1d9bdb43bf [FIX] mail: read ir.config_parameter with SUPERUSER_ID 2014-08-28 18:32:11 +02:00
Thibault Delavallée 863b361707 [FIX] [IMP] mail: mail_message: when checking that access rights are not
violated in _search, do it in SQL to speedup the query. Indeed doing it via search and
browsing the results to validate the various rules is quite costly.
2014-08-22 13:36:54 +02:00
Thibault Delavallée 3211ff7c78 [FIX] mail: when checking for possible messages to fetch, perform
a search_count on mail_message when the actual number of messages or their
ids is not necessary, to speedup the computation.
2014-08-22 13:36:54 +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 e0967ba2ce [CLEAN] mail_message: removed an unused import 2014-08-13 16:45:58 +02:00
Denis Ledoux fc74431c1a [MERGE] forward port of branch saas-4 up to 7ecaab9 2014-08-12 16:27:57 +02:00
Denis Ledoux 7b0eb9b1a8 [FIX] mail: forward-port of rev 245bb4ebdf 2014-08-12 15:16:49 +02:00
Denis Ledoux 2c9a116c74 [MERGE] forward port of branch 7.0 up to 245bb4e 2014-08-12 14:16:35 +02:00
Thibault Delavallée c64b077362 [FIX] mail: fixed bounce email recognition + invite email headers + mass mailing statistics not lost anymore
- [FIX] bounce regex: too many emails were considered as bounce and therefore
not displayed in the chatter and lost for the communication history. The regex
was not correctly looking for the bounce alias in the email_to.
- [FIX] invite email: replying to the invitation email (invitation as new
follower) now replies to the user sending the invitation.
- [FIX] mass_mailing: added a column to store the id of the original email
in addition to the many2one column. The many2one is set to null when deleting
the original email. As the information is necessary, it is saved on another
field. The many2one is necessary for indexes purpose as the inverse of
a one2many.
2014-08-11 15:39:26 +02:00
Thibault Delavallée 7f0353974d [REF] mail: same_thread field changed into no_auto_thread, its contrary, to avoid migration issues (adding a 'always False' column is easier than an 'always True'). 2014-08-04 14:46:47 +02:00
Christophe Simonis fd4fd35e32 [MERGE] forward port of branch saas-5 up to e4cb520 2014-07-30 20:52:14 +02:00
Christophe Simonis fa07bc8532 [MERGE] forward port of branch saas-3 up to 310d3fe 2014-07-30 19:09:33 +02:00
Christophe Simonis 310d3fe4c4 [MERGE] forward port of branch 7.0 up to 39f3e40 2014-07-30 18:55:31 +02:00
StefanRijnhart f9da53743f [FIX] mail: reset of default_type in context
When creating a new message, we need to reset the default_type key to avoid context propagation (e.g. invoice menu).
However we used to compare the key in context (char) with the list of selections (tuple) so it was never matching and always reset.
2014-07-29 14:13:01 +02:00
Raphael Collet cbe2dbb672 [MERGE] new v8 api by rco
A squashed merge is required as the conversion of the apiculture branch from
bzr to git was not correctly done. The git history contains irrelevant blobs
and commits. This branch brings a lot of changes and fixes, too many to list
exhaustively.

- New orm api, objects are now used instead of ids
- Environements to encapsulates cr uid context while maintaining backward compatibility
- Field compute attribute is a new object oriented way to define function fields
- Shared browse record cache
- New onchange protocol
- Optional copy flag on fields
- Documentation update
- Dead code cleanup
- Lots of fixes
2014-07-06 17:05:41 +02:00
Jaydeep Barot 026e38b48f [REM] Unnecessary `size` parameters on char fields 2014-06-25 17:13:43 +02:00
Thibault Delavallée 719a4f02c9 [REF] mail, crm, hr_recruitment, project, project_issue: simplified reply-to of notification emails (now displaying 'YourCompany -docname- <email>' instead of 'Followers of ...'; added same_thread directly on the mail.message model to ease the reply_to and message-id computation; factorized a bit the reply-to generation for a batch of records; udpated tests accordingly. 2014-06-23 10:47:47 +02:00
Denis Ledoux 98bf37f6e1 [FIX] mail: missing .id during forward port 3c0292645f 2014-06-16 18:07:10 +02:00
Denis Ledoux 3c0292645f [MERGE] Forward-port of 7.0 bugfixes up to 63ea0df73f 2014-06-16 17:37:10 +02:00
Ravi Gohil 8796e07afc [FIX] mail: Speep improvement when sending email using 'Send by Email' wizard. (Maintenance Case: 606994) 2014-06-09 18:20:02 +05:30
Thibault Delavallée 98472d8253 [CLEAN] Removed commented print
bzr revid: tde@openerp.com-20140415144943-ov6g4n9tzjxtwlk9
2014-04-15 16:49:43 +02:00
Thibault Delavallée d70538402b [REM] mail: removed dead code in mail_message
bzr revid: tde@openerp.com-20140325142507-9vgzcyfno750ungz
2014-03-25 15:25:07 +01:00
Thibault Delavallée 48deceb6c6 [IMP] [REF] mail_compose_message: slightly cleaned wizard code to lessen the number of corner cases and
to remove unnecessary code.
post and filter_id fields have been removed as they are not necessary.
Updated tests accordingly to new mass mailing tests: mass mailing create
emails, no message_post anymore using followers.

bzr revid: tde@openerp.com-20140317115315-ws8dvjbiv5rspk43
2014-03-17 12:53:15 +01:00
Thibault Delavallée ed116d6b6b [IMP] mail_message: avoid doing search criterions on subtype_ids, takes long time
bzr revid: tde@openerp.com-20140314171658-9zbji55or9dq761p
2014-03-14 18:16:58 +01:00
Thibault Delavallée 4b5b4e86d7 [REM] mail_message: removed dead code: quote context is not planned
to be used anymore.

bzr revid: tde@openerp.com-20140314171213-0v3t7c1akbviu99e
2014-03-14 18:12:13 +01:00
Thibault Delavallée 4ef08f78a0 [REM] mail_message: removed dead code
bzr revid: tde@openerp.com-20140314171054-859jix3el18i0g53
2014-03-14 18:10:54 +01:00
Thibault Delavallée e6f6960d17 [MERGE] Sync with trunk
bzr revid: tde@openerp.com-20140314162124-fn8f9ne80skha19h
2014-03-14 17:21:24 +01:00
Christophe Simonis 47c4728f43 [FIX] mail,website_sale: rename file_type to file_type_icon to avoid name conflict with file_type field added by document module
bzr revid: chs@openerp.com-20140228142233-i0mm9lav0czbydkk
2014-02-28 15:22:33 +01:00
Thibault Delavallée dd99c96ca2 [CLEAN] mail: some code cleaning in the modifications
bzr revid: tde@openerp.com-20140224142236-l61eqddc4vq9y861
2014-02-24 15:22:36 +01:00
Thibault Delavallée 4739eb138b [IMP] mail, email_template: still continuing work to improve performances of mass mailing.
main differences :
- record_name is not a function field anymore, but a char field + a method in create
if not given (default-like, but dependent of other values). This allows the composer
to give a value for record_name (False for email mass mailing) to avoid browsing
records and having their access rights issues in the way
- author_id, email_from coming from composer instead of called in every mail.message
creation
- moved code dealing with attachments from send_mail to get_mail-values, to that at
the end of this method we know all values of the email

Some tests have been updated / temporarily disabled.

bzr revid: tde@openerp.com-20140224132038-txdi0g30a7fzbnxp
2014-02-24 14:20:38 +01:00
Thibault Delavallée 0b2d085c1b [IMP] shop: added openchatter on product shop
- product.template now inherits from mail.thread
- added opencahtter on product.template form view
- added discussion thread + attachments in product website view
- added file_type field on ir_attachment, that replaces the javascript thing
from mail.js
- added a controller to comment a product.template

bzr revid: tde@openerp.com-20140106135727-uf0zaxav28pdx4sv
2014-01-06 14:57:27 +01:00
Thibault Delavallée 1aa92dbc46 [FORWARD] Forward port of saas-2 fixes until revision 9058 (revid tde@openerp.com-20131220162158-hbgktly09dv37958)
bzr revid: tde@openerp.com-20131220165519-2okhclp3qb3if1ey
2013-12-20 17:55:19 +01:00
Denis Ledoux abefabfa3e [FIX] mail: fix _get_default_from if no alias_name for user.
As alias_name is not anymore required, we should check that the alias_domain AND alias_name are set before choosing the alias as email_from of the mail.message

bzr revid: dle@openerp.com-20131220115213-ll8duh01csk0xy4t
2013-12-20 12:52:13 +01:00
Thibault Delavallée 896fab1b44 [IMP] [FIX] mail: mail_thread: routing: check for exact message_id.
When processing an incoming email, we try to find a parent for the email based on references. Before this merge, it was done using openerp-<model-<res_id> pattern. However it is buggy. Indeed having two OpenERP sending emails to each other leads to messages being inserted in a wrong thread (model and res_id of the first OpenERP for both instances).

Now we search for an exact match between the references and the stored message_ids. As each message_id can be considered as unique the number of collisions is lessened. This won't cause any issues with OpenERP >= 7.0.

A compatibility mode is implemented for <= 6.1: as in those versions the message_id is not stored, we fall back on the previous behavior for records having messages without message_id. This indicates that the record was created before 7.0.

Tests have been updated accordingly, and a test added for the compatibility mode.

bzr revid: tde@openerp.com-20131205100534-2rlyun8wqng3qa6f
2013-12-05 11:05:34 +01:00