Commit Graph

627 Commits

Author SHA1 Message Date
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
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
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
Sandy Carter 67cca3f1e5 [FIX] mail: display translated model name at record creation
When a record is created, if it inherits from mail.thread, a message 'OBJECT created' is posted. 'created' is translated but the name of the model wasn't.
This fix uses the name of the linked ir.model which is already a translatable field.
lp:1262000, opw 611043
2014-07-23 15:35:41 +02:00
Anand-Dharampuriya 5cbc611361 [FIX] Solve some mail issues which are currently present in 7.0 2014-07-10 16:29:54 +02:00
Jean-Baptiste Quenot 310ecb0d60 Fix detection of MIME type in message_parse()
Be careful, content-type may contain tricky content like in the
following example so test the MIME type with startswith()

Content-Type: multipart/related;
  boundary="_004_3f1e4da175f349248b8d43cdeb9866f1AMSPR06MB343eurprd06pro_";
  type="text/html"
2014-06-02 11:48:30 +02:00
Jacques-Etienne Baudoux a918e89995 [FIX] mail: change copy call to copy_data to avoid resending email during duplication (opw 607295)
bzr revid: mat@openerp.com-20140505094329-vr7h4c92i43ezob4
2014-05-05 11:43:29 +02:00
Olivier Dony 9861b5cada [FIX] mail.thread: avoid overwriting thread_id/model with foreign values when reply-to hostname does not match + fix tests
This improve previous commit by making sure we
never consider the thread_id/model values in the
In-Reply-To/References header if the host name
did not match.
Also fixes the tests that were using the
6.1 compatibility mode to post in a mail group
thread instead of specifying the right
message-id.

bzr revid: odo@openerp.com-20140411142429-y0rpkzqbrsabxqsg
2014-04-11 16:24:29 +02:00
Olivier Dony 4ed8413dc7 [FIX] mail.thread: avoid wrongly matching model,id from a foreign OpenERP system
When emails transit from an OpenERP system to another
there is a chance of wrongly considering the foreign
model,id pair as local, possibly attaching a reply
to a wrong parent message.
This naive heuristic ignore the foreign identifiers
unless the hostname of the message-id mentioned in
the In-Reply-To header matches the local one.
This may fail after a change of local hostname but
is still better than the alternative.
In OpenERP v8 we should stop including the model,res_id
in outgoing Message-Id headers and only rely on the
stored, opaque, unique Message-Ids, preventing
any future mismatch.

bzr revid: odo@openerp.com-20140411101349-h3jmkdzvbr7lut26
2014-04-11 12:13:49 +02:00
Olivier Dony 9e002d9233 [FIX] mail.thread: avoid error if `message_unread_count` has been popped 1 line earlier
bzr revid: odo@openerp.com-20140314104605-qi7eqj2g37dvxvc3
2014-03-14 11:46:05 +01:00
Christophe Simonis 44a99c0976 [FIX] calendar: correct recurrency end date computation
bzr revid: chs@openerp.com-20140314094809-0wuus62tob8vtyi0
2014-03-14 10:48:09 +01:00
Thibault Delavallée ec5291c130 [IMP] fetchmail: try / except the processinf of each email and log any exception
found during processing. This way, all emails in the queue are managed and
all failed emails have their own exception in the logs, allowing easier
debugging.
Note that a failed email is set as seen to avoid processing it every time
the scheduler runs.

bzr revid: tde@openerp.com-20140213095717-tcwgkl143i3ujw8h
2014-02-13 10:57:17 +01:00
Thibault Delavallée dca7f71d71 [DOC] mail_thread: docstrings to add raised exceptions in message_process and message_route
bzr revid: tde@openerp.com-20140213090122-0gwin1pjigwu42sz
2014-02-13 10:01:22 +01:00
Thibault Delavallée 150d5a9e18 [IMP] mail: mail_thread: message routing: raise exceptions instead of using asserts.
Indeed assert are statements meant to be used when developping, for
debug purpose. In a production environment it is safer to use real
exceptions that can be managed accordingly.

bzr revid: tde@openerp.com-20140212152737-c7q339psd9hi4iwd
2014-02-12 16:27:37 +01:00
Thibault Delavallée 759ed5bbb6 [IMP] mail: subscription: if no-one to (un)subscribe, already return. This is not
necessary for computation, but saves some browse / access right checking.

bzr revid: tde@openerp.com-20140210115827-2y451i0edgve59mi
2014-02-10 12:58:27 +01:00
Martin Trigaux 54a1ffc480 [FIX] mail: priority -10 on message_follower_ids to make sure executed before other function field that may use the followers (eg: note.note for access rights)
bzr revid: mat@openerp.com-20140210083130-ag95lqwlpkv7ceqc
2014-02-10 09:31:30 +01:00
Olivier Dony f7c1afffcb [FIX] mail.thread: avoid tracking multiple temporary changes during copy
bzr revid: odo@openerp.com-20140206173251-1njroiu08fzgdbyp
2014-02-06 18:32:51 +01:00
Martin Trigaux 5ebcb64c34 [IMP] mail: in case of creation, still check creation access rights for subscription
bzr revid: mat@openerp.com-20140206120109-6h2vz1ulu33t1509
2014-02-06 13:01:09 +01:00
Martin Trigaux 922836d8cd [IMP] mail: check at least access_rights in case of creation
bzr revid: mat@openerp.com-20140206110327-zar4yl03r1lympx6
2014-02-06 12:03:27 +01:00
Martin Trigaux 7407f3c888 [FIX] mail: backport of saas-2 revision 9065 and 9081.
Make sure the user is subscribed before the super() call in mail_thread. This allows to have follower based record rules working (eg: note.note)

bzr revid: mat@openerp.com-20140206104714-anpehaik4wajnfrw
2014-02-06 11:47:14 +01:00
Thibault Delavallée 4d73f955a9 [FIX] mail: mail_thread: fixed a bug in subscription, new followers
could overwrite the subscription of previous followers.

This has already been fixed in saas-2 branch at revision 9079 (revid
tde@openerp.com-20140109131748-hgtflp40pmjhlhu2). But the fix is also
valid for the 7.0 stable branch.

bzr revid: tde@openerp.com-20140115115825-fniobvz33sssvrwd
2014-01-15 12:58:25 +01:00
Martin Trigaux d106d54ade [FIX] mail: check access rules of related documents when subscribing to it
Fix tests to execute actions with user that are allowed to

bzr revid: mat@openerp.com-20140106141157-0tp2bgw2d40ynrag
2014-01-06 15:11:57 +01:00
Denis Ledoux bc50cd3558 [FIX] mail: mails with attachments containing special chars (such as é) were not delivered properly
get_filename method from email lib returns sometimes decoded value, sometimes still encoded.
for instance, get_filename cannot decode iso encoded filename

Recently, decode method has been applied on filename string, to handle iso encoded file. 
Sadly, one cannot decode already decoded values.
Therefore, decoding already decoded windows or utf-8 encoded filename with special chars failed.

bzr revid: dle@openerp.com-20140102161149-x268xj7bzvvsit2h
2014-01-02 17:11:49 +01:00
Thibault Delavallée fcd5f7d960 [MERGE] Sync with 7.0
bzr revid: tde@openerp.com-20131209090903-al4o6uhrhhw4cqcl
2013-12-09 10:09:03 +01:00
Thibault Delavallée 2382710f6f [REV] mail: removed some changes to be done in trunk, not in 7.0
bzr revid: tde@openerp.com-20131209090802-q8fzn88ia9w6o5pq
2013-12-09 10:08:02 +01:00
Martin Trigaux 7c1bf0dd29 [FIX] mail: decode filename at email reception (if non-ascii characters) (opw 591729)
bzr revid: mat@openerp.com-20131127124021-bliapaggdjd1xnuz
2013-11-27 13:40:21 +01:00
Thibault Delavallée ae7fcfb564 [IMP] [FIX] mail: mail_thread :
- avoid having to browse the record in message_subscribe: refactored message_subscribe
to work on ids without browsing, try to lessen the number of queries to do
- update _set_followers, method of the function field message_follower_ids, to use
message_subscribe and message_unsibscribe
- in create: add author as follower in creation values, not after create, allowing
create access rules based on followers
- updated message_unsubscribe to be the lower method, not calling _set_followers anymore

bzr revid: tde@openerp.com-20131126171752-1irizm7mhv2y1wrn
2013-11-26 18:17:52 +01:00
Thibault Delavallée 4be6ac800b [FIX] mail: in some cases tracking is called
without the context (some workflows for example). In that case use the
current user lang when generating the automatic message. This is done
by adding it in the context if not present.

lp bug: https://launchpad.net/bugs/1219163 fixed

bzr revid: tde@openerp.com-20131125163808-bbbqwvx22my38zdj
2013-11-25 17:38:08 +01:00
Thibault Delavallée 1761086ad7 [FIX] mail: auto_subscribe: fix subscription, could have subtypes linked to another model than the current model
bzr revid: tde@openerp.com-20131120154320-gf67wbv3en2f7ral
2013-11-20 16:43:20 +01:00
Thibault Delavallée 20f10d574a [FIX] mail: auto_subscribe: domain for fetching followers was wrong, forgot an AND
bzr revid: tde@openerp.com-20131114121746-lqqr4nzpduk4lfdq
2013-11-14 13:17:46 +01:00
Thibault Delavallée cf40f4e9b0 [FIX] [IMP] mail: refactored code of message_auto_subscribe.
This new code allows faster computation, because it avoids
- searching in a many2many relationship that is very costly in production
databases, because it is replaced by an 'id in [ids]' equivalent leaf
that can be huge.
- browsing in a create/write (should also lessen the number of issues
about read access rights in create)

A new optionnal parameter is given to the method, that are the
modified values. If this is not given (compatibility-mode) the
records are browsed to fetch the value.

bzr revid: tde@openerp.com-20131114113231-oyk16t9i3m3wul6k
2013-11-14 12:32:31 +01:00
Denis Ledoux d32c663fbe [FIX]mail: mail_thread, trying to send a message in the chatter while the emails where all mal-formed raised an error.
bzr revid: dle@openerp.com-20131008111845-tx3bpp8snfl03cnk
2013-10-08 13:18:45 +02:00
Thibault Delavallée d874d9980d [FIX] mail: fixed wrong parsing of multipart/mixed emails.
alternative mode is computed when browsing the parts, not from
the message content type.

Added tests.

Also added some notification_email_send to none to avoid sending
emails in demo/data/update.

bzr revid: tde@openerp.com-20130823120611-0n4ull3c8gvwug2u
2013-08-23 14:06:11 +02:00
RGA(OpenERP) 07282840ac [FIX] fetch mail should uncode attached filename too
bzr revid: rgaopenerp-20130703092937-jqrj76i3gzro9isx
2013-07-03 14:59:37 +05:30
Thibault Delavallée b7f4ddb880 [MERGE] Sync with trunk
bzr revid: tde@openerp.com-20130621092424-supbxu8mwm2qtu6b
2013-06-21 11:24:24 +02:00
Thibault Delavallée ff00a84d33 [FIX] mail: fixed a glitch in message_subscribe sometimes overriding specified subtypes
bzr revid: tde@openerp.com-20130620135718-qi0d8fpqvombq3v1
2013-06-20 15:57:18 +02:00
Thibault Delavallée cd9efe1f99 [FIX] mail: take into account default_ context values for auto subscribe
bzr revid: tde@openerp.com-20130619123829-gr1rkgp490bdci9u
2013-06-19 14:38:29 +02:00
Thibault Delavallée 41311b9f33 [FIX] mail: fixed id of record in a loop (record.id, not all ids).
bzr revid: tde@openerp.com-20130613095228-b4r8kca7hkjd6ppa
2013-06-13 11:52:28 +02:00
Thibault Delavallée 2652bd586d [FIX] mail: message_subscribe_users: refactoring of the algorithm to achieve better computation time.
Previous implementation did a search on mail.followers with subtype_ids=False, leading
to a very bad computation time. This search is now avoided.

bzr revid: tde@openerp.com-20130613082029-lmd63s3mqwxasy4j
2013-06-13 10:20:29 +02:00
Denis Ledoux 75ed151ad9 [FIX]mail: mail_thread, method message_capable_models was not returning all message capable models
bzr revid: dle@openerp.com-20130611133314-pq9bmj7af61k7swe
2013-06-11 15:33:14 +02:00
Martin Trigaux d626d3cb61 [MERGE] backport saas-1 rev 8728
[FIX] mail, project, project_issue, crm_lead: fixed 'XX Created' subtype not triggered because of condition
based on state=new and not state=draft.
For tasks, issues and leads, no generic 'Document created' message is posted anymore
because of the 'XX Created' message with subtype automatically logged.
Generic creation message is logged before automatic subscription to enable
message pushing to responsibles.

bzr revid: mat@openerp.com-20130529143022-wy76srwb2nwkspe3
2013-05-29 16:30:22 +02:00
Thibault Delavallée ea0316e3f1 [FIX] [FIX] mail: fixed subscription of an already subscribed follower erasing already existing subtypes + added tests
bzr revid: tde@openerp.com-20130508102304-p52bq0qux9s7rses
2013-05-08 12:23:04 +02:00
Thibault Delavallée c2f02f6798 [FIX] mail, crm: fixed some access rights issues when using chatter on a document without access rights with portal users.
bzr revid: tde@openerp.com-20130417085927-wg07siehk2uhrkpu
2013-04-17 10:59:27 +02:00
Thibault Delavallée f8a2299525 [MERGE] [FIX] mail, email_template: fix attachment duplication and clean attachment management
The way attachments are linked to the document has been cleaned. Posting method message_post may receives 2 arguments:
- attachment_ids: those linked to the wizard model (mail.compose.message) are linked to the document (res_model, res_id)
- attachments: the tuples are used to create new attachments linked to the document
The wizard does not set the res_model and res_id of attachments anymore, delegating this job to message_post.

The mail.message and mail.compose.message now use their respective attachment_ids field when possible. This is done instead of reading/creating new attachments based on the attachments tuple each time a mail.compose.message is processed. Email templates now also use attachment_ids, in particular when generating emails, instead of using the attachments tuple. Only reports are still generated on the fly and put into attachments instead of attachment_ids.

A cron job has been added to unlink 'lost' attachments. Those are attachments:
- linked to 'mail.compose.message'
- with res_id=0 (due Chatter used in minimal mode or reports generated by templates before the wizard has an ID)
- with no activity for more than one day (create_date and write_date)

bzr revid: tde@openerp.com-20130411112033-mqph9vjlcjkoolfs
2013-04-11 13:20:33 +02:00
Thibault Delavallée 8c7cf300eb [MERGE] [FIX] mail: bettersuggested recipients based on email address. It tries to find a partner that is in the related document followers, or a user, or the first partner with matching email.
bzr revid: tde@openerp.com-20130411104151-wi5ru54b362pv957
2013-04-11 12:41:51 +02:00
Thibault Delavallée fe2ea997a2 [MERGE] Sync with trunk.
bzr revid: tde@openerp.com-20130411103645-rmr3sa8p9ropx2gc
2013-04-11 12:36:45 +02:00
Thibault Delavallée f994529725 [IMP] mail: finding partner based on email: improved code for suggested partners, added somme comments and tests.
bzr revid: tde@openerp.com-20130411101720-mumz152dsxvv1xbj
2013-04-11 12:17:20 +02:00
Thibault Delavallée 8b97805621 [FIX] mail: fixed some translation issues.
Document created text was not translatable
Subtype was fetched without context, therefore not translated
Removed odd override of _t introduced in mail_followers at revision 7885

bzr revid: tde@openerp.com-20130408092447-3ri41v6xluuj0wha
2013-04-08 11:24:47 +02:00