diff options
| author | Thibault Delavallée <tde@openerp.com> | 2012-12-12 17:07:36 +0100 |
|---|---|---|
| committer | Thibault Delavallée <tde@openerp.com> | 2012-12-12 17:07:36 +0100 |
| commit | cd0aab0789fe3c0f0acdf3df08f4b84d4f7f7012 (patch) | |
| tree | 6699eb8e4057e848d854b168dbdfc7e449aa137d /addons/mail/wizard/mail_compose_message.py | |
| parent | f1ee7f1ad9fe4a9a92e2058862f2c149347df3cd (diff) | |
[FIX] mail.compose.message: fixed creation of message on its own profile (res_users -> res_partner).
bzr revid: tde@openerp.com-20121212160736-wcas9ucgzkcm1o7f
Diffstat (limited to 'addons/mail/wizard/mail_compose_message.py')
| -rw-r--r-- | addons/mail/wizard/mail_compose_message.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py index 58066c6f2c2..8d3e9c6879a 100644 --- a/addons/mail/wizard/mail_compose_message.py +++ b/addons/mail/wizard/mail_compose_message.py @@ -90,6 +90,17 @@ class mail_compose_message(osv.TransientModel): for field in vals: if field in fields: result[field] = vals[field] + + # TDE HACK: as mailboxes used default_model='res.users' and default_res_id=uid + # (because of lack of an accessible pid), creating a message on its own + # profile may crash (res_users does not allow writing on it) + # Posting on its own profile works (res_users redirect to res_partner) + # but when creating the mail.message to create the mail.compose.message + # access rights issues may rise + # We therefore directly change the model and res_id + if result.get('model') == 'res.users' and result.get('res_id') == uid: + result['model'] = 'res.partner' + result['res_id'] = self.pool.get('res.users').browse(cr, uid, uid).partner_id.id return result def _get_composition_mode_selection(self, cr, uid, context=None): |
