summaryrefslogtreecommitdiff
path: root/addons/mail
diff options
context:
space:
mode:
authorForam Katharotiya (OpenERP) <fka@tinyerp.com>2012-08-13 15:55:19 +0530
committerForam Katharotiya (OpenERP) <fka@tinyerp.com>2012-08-13 15:55:19 +0530
commit1bf105837ed5cad0715b20ef501e7147af87c7ef (patch)
tree7a292e7311c91e6e0acafe7359dd1e7f1d7a4cb9 /addons/mail
parentdae19bc174b3962088bf4b9fd0701f80ab8f8e5e (diff)
parent03e6f93fcffa7775754bf5198478b5927d8ffe1c (diff)
[MERGE]merge with lp:~openerp-dev/openobject-addons/trunk-message-sub-type-apa
bzr revid: fka@tinyerp.com-20120813102519-9h3fpqj29dse2p3m
Diffstat (limited to 'addons/mail')
-rw-r--r--addons/mail/__init__.py2
-rw-r--r--addons/mail/__openerp__.py16
-rw-r--r--addons/mail/data/mail_demo.xml5
-rw-r--r--addons/mail/i18n/ar.po12
-rw-r--r--addons/mail/i18n/bg.po4
-rw-r--r--addons/mail/i18n/ca.po4
-rw-r--r--addons/mail/i18n/da.po4
-rw-r--r--addons/mail/i18n/de.po4
-rw-r--r--addons/mail/i18n/es.po4
-rw-r--r--addons/mail/i18n/es_CR.po4
-rw-r--r--addons/mail/i18n/es_PY.po4
-rw-r--r--addons/mail/i18n/fi.po4
-rw-r--r--addons/mail/i18n/fr.po4
-rw-r--r--addons/mail/i18n/gl.po4
-rw-r--r--addons/mail/i18n/hr.po4
-rw-r--r--addons/mail/i18n/hu.po4
-rw-r--r--addons/mail/i18n/it.po4
-rw-r--r--addons/mail/i18n/ja.po4
-rw-r--r--addons/mail/i18n/lt.po4
-rw-r--r--addons/mail/i18n/lv.po4
-rw-r--r--addons/mail/i18n/mn.po145
-rw-r--r--addons/mail/i18n/nl.po4
-rw-r--r--addons/mail/i18n/pl.po4
-rw-r--r--addons/mail/i18n/pt.po4
-rw-r--r--addons/mail/i18n/pt_BR.po4
-rw-r--r--addons/mail/i18n/ro.po4
-rw-r--r--addons/mail/i18n/ru.po4
-rw-r--r--addons/mail/i18n/sl.po4
-rw-r--r--addons/mail/i18n/sr@latin.po4
-rw-r--r--addons/mail/i18n/sv.po4
-rw-r--r--addons/mail/i18n/tr.po4
-rw-r--r--addons/mail/i18n/zh_CN.po4
-rw-r--r--addons/mail/mail_alias.py133
-rw-r--r--addons/mail/mail_alias_view.xml72
-rw-r--r--addons/mail/mail_group.py93
-rw-r--r--addons/mail/mail_group_view.xml14
-rw-r--r--addons/mail/mail_thread.py147
-rw-r--r--addons/mail/res_config.py39
-rw-r--r--addons/mail/res_config_view.xml18
-rw-r--r--addons/mail/res_partner_view.xml2
-rw-r--r--addons/mail/res_users.py60
-rw-r--r--addons/mail/res_users_view.xml6
-rw-r--r--addons/mail/security/ir.model.access.csv2
-rwxr-xr-xaddons/mail/static/scripts/openerp_mailgate.py44
-rw-r--r--addons/mail/static/src/css/mail_group.css14
-rw-r--r--addons/mail/static/src/js/mail.js10
46 files changed, 673 insertions, 269 deletions
diff --git a/addons/mail/__init__.py b/addons/mail/__init__.py
index bac92a833ff..7783faee5c3 100644
--- a/addons/mail/__init__.py
+++ b/addons/mail/__init__.py
@@ -20,6 +20,7 @@
##############################################################################
import mail_message_subtype
+import mail_alias
import mail_message
import mail_thread
import mail_group
@@ -29,6 +30,7 @@ import res_users
import res_partner
import report
import wizard
+import res_config
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/mail/__openerp__.py b/addons/mail/__openerp__.py
index 4f556070ade..76362bc594e 100644
--- a/addons/mail/__openerp__.py
+++ b/addons/mail/__openerp__.py
@@ -26,7 +26,7 @@
"sequence": 2,
"summary": "Discussions, Mailing Lists, News",
'description': """
-A bussiness oriented Social Networking with a fully-integrated email
+A business oriented Social Networking with a fully-integrated email
and message management.
=====================================================================
@@ -59,24 +59,29 @@ The main features of the module are:
""",
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
- 'depends': ['base', 'base_tools'],
+ 'depends': ['base', 'base_tools', 'base_setup'],
'data': [
'wizard/mail_compose_message_view.xml',
'mail_message_subtype.xml',
+ 'res_config_view.xml',
'mail_message_view.xml',
'mail_subscription_view.xml',
'mail_thread_view.xml',
'mail_group_view.xml',
'res_partner_view.xml',
- 'res_users_view.xml',
'data/mail_data.xml',
'data/mail_group_data.xml',
'security/mail_security.xml',
'security/ir.model.access.csv',
+ 'mail_alias_view.xml',
+ 'res_users_view.xml',
+ ],
+ 'demo': [
+ 'data/mail_demo.xml',
],
'installable': True,
'auto_install': False,
- 'application':True,
+ 'application': True,
'certificate': '001056784984222247309',
'images': [
'images/customer_history.jpeg',
@@ -102,8 +107,5 @@ The main features of the module are:
'qweb': [
'static/src/xml/mail.xml',
],
- 'demo': [
- 'data/mail_demo.xml',
- ],
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/mail/data/mail_demo.xml b/addons/mail/data/mail_demo.xml
index f9edb8b9e2f..8be63f22804 100644
--- a/addons/mail/data/mail_demo.xml
+++ b/addons/mail/data/mail_demo.xml
@@ -88,5 +88,10 @@ Check the file in attachment for more information ! (third comment)]]></field>
<field name="attachment_ids" eval="[(4,ref('message_blogpost0_comment2_attachment0'))]"/>
</record>
+ <record model="ir.config_parameter" id="user_mail_alias">
+ <field name="key">mail.catchall.domain</field>
+ <field name="value">demo.openerp.com</field>
+ </record>
+
</data>
</openerp>
diff --git a/addons/mail/i18n/ar.po b/addons/mail/i18n/ar.po
index e9b6087189f..4a264fe8e96 100644
--- a/addons/mail/i18n/ar.po
+++ b/addons/mail/i18n/ar.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
@@ -31,17 +31,17 @@ msgstr ""
#. module: mail
#: view:mail.message:0
msgid "Open Related Document"
-msgstr ""
+msgstr "افتح المستند المتعلق به"
#. module: mail
#: view:mail.message:0
msgid "Open Attachments"
-msgstr ""
+msgstr "افتح الملحقات"
#. module: mail
#: view:mail.message:0
msgid "Message Details"
-msgstr ""
+msgstr "تفاصيل الرسالة"
#. module: mail
#: view:mail.thread:0
@@ -95,7 +95,7 @@ msgstr ""
#. module: mail
#: field:mail.message,mail_server_id:0
msgid "Outgoing mail server"
-msgstr ""
+msgstr "oh]l الرسائل المرسلة"
#. module: mail
#: selection:mail.message,state:0
diff --git a/addons/mail/i18n/bg.po b/addons/mail/i18n/bg.po
index 85873d179b9..3c5156dcc9c 100644
--- a/addons/mail/i18n/bg.po
+++ b/addons/mail/i18n/bg.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/ca.po b/addons/mail/i18n/ca.po
index 7796f5994b8..2d56066837a 100644
--- a/addons/mail/i18n/ca.po
+++ b/addons/mail/i18n/ca.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/da.po b/addons/mail/i18n/da.po
index f57e05aaf80..8b77ec859e1 100644
--- a/addons/mail/i18n/da.po
+++ b/addons/mail/i18n/da.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/de.po b/addons/mail/i18n/de.po
index e9d92d1859a..47076a52a1b 100644
--- a/addons/mail/i18n/de.po
+++ b/addons/mail/i18n/de.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/es.po b/addons/mail/i18n/es.po
index d810d560a8b..35f6e936c51 100644
--- a/addons/mail/i18n/es.po
+++ b/addons/mail/i18n/es.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/es_CR.po b/addons/mail/i18n/es_CR.po
index 9ae00c60a1d..36c0a77dee5 100644
--- a/addons/mail/i18n/es_CR.po
+++ b/addons/mail/i18n/es_CR.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
"Language: es\n"
#. module: mail
diff --git a/addons/mail/i18n/es_PY.po b/addons/mail/i18n/es_PY.po
index 63cf4af0b79..e202cfb32f5 100644
--- a/addons/mail/i18n/es_PY.po
+++ b/addons/mail/i18n/es_PY.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/fi.po b/addons/mail/i18n/fi.po
index 115787ae774..d17d3e0d3d4 100644
--- a/addons/mail/i18n/fi.po
+++ b/addons/mail/i18n/fi.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/fr.po b/addons/mail/i18n/fr.po
index a3aaa0119e4..076b26689ef 100644
--- a/addons/mail/i18n/fr.po
+++ b/addons/mail/i18n/fr.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/gl.po b/addons/mail/i18n/gl.po
index f063c5e86aa..3e1de3af0ab 100644
--- a/addons/mail/i18n/gl.po
+++ b/addons/mail/i18n/gl.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/hr.po b/addons/mail/i18n/hr.po
index 48073a9b617..9fe02410386 100644
--- a/addons/mail/i18n/hr.po
+++ b/addons/mail/i18n/hr.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/hu.po b/addons/mail/i18n/hu.po
index 234049212b4..5207c68759d 100644
--- a/addons/mail/i18n/hu.po
+++ b/addons/mail/i18n/hu.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/it.po b/addons/mail/i18n/it.po
index 74a5cdb198b..a8c0253ce65 100644
--- a/addons/mail/i18n/it.po
+++ b/addons/mail/i18n/it.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/ja.po b/addons/mail/i18n/ja.po
index 108e557f566..61c3d491f87 100644
--- a/addons/mail/i18n/ja.po
+++ b/addons/mail/i18n/ja.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/lt.po b/addons/mail/i18n/lt.po
index c39dda7db70..2cfee22ddb0 100644
--- a/addons/mail/i18n/lt.po
+++ b/addons/mail/i18n/lt.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/lv.po b/addons/mail/i18n/lv.po
index 81564d55673..bfdcda883e3 100644
--- a/addons/mail/i18n/lv.po
+++ b/addons/mail/i18n/lv.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/mn.po b/addons/mail/i18n/mn.po
index 7fd18656c8e..ea49507e842 100644
--- a/addons/mail/i18n/mn.po
+++ b/addons/mail/i18n/mn.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
@@ -26,27 +26,27 @@ msgstr ""
#. module: mail
#: help:mail.compose.message,auto_delete:0
msgid "Permanently delete emails after sending"
-msgstr ""
+msgstr "Имэйлийг илгээсэн дараагаараа бүр мөсөн устгах"
#. module: mail
#: view:mail.message:0
msgid "Open Related Document"
-msgstr ""
+msgstr "Холбогдох баримтыг нээх"
#. module: mail
#: view:mail.message:0
msgid "Open Attachments"
-msgstr ""
+msgstr "Хавсралтуудыг нээх"
#. module: mail
#: view:mail.message:0
msgid "Message Details"
-msgstr ""
+msgstr "Зурвасын дэлгэрэнгүй"
#. module: mail
#: view:mail.thread:0
msgid "Communication History"
-msgstr ""
+msgstr "Харилцааны түүх"
#. module: mail
#: view:mail.message:0
@@ -63,7 +63,7 @@ msgstr "Имэйл Зохиох"
#: help:mail.compose.message,body_text:0 help:mail.message,body_text:0
#: help:mail.message.common,body_text:0
msgid "Plain-text version of the message"
-msgstr ""
+msgstr "Зурвасын цэвэр-текст хувилбар"
#. module: mail
#: view:mail.compose.message:0
@@ -90,12 +90,12 @@ msgstr "Хүлээн авсан"
#. module: mail
#: view:mail.message:0
msgid "Thread"
-msgstr ""
+msgstr "Салбар"
#. module: mail
#: field:mail.message,mail_server_id:0
msgid "Outgoing mail server"
-msgstr ""
+msgstr "Мэйл серверийн гаралт"
#. module: mail
#: selection:mail.message,state:0
@@ -112,7 +112,7 @@ msgstr "Хэн рүү Хариулах"
#: help:mail.compose.message,body_html:0 help:mail.message,body_html:0
#: help:mail.message.common,body_html:0
msgid "Rich-text/HTML version of the message"
-msgstr ""
+msgstr "Зурвасын Rich-text/HTML буюу форматтай хувилбар"
#. module: mail
#: field:mail.compose.message,auto_delete:0 field:mail.message,auto_delete:0
@@ -123,7 +123,7 @@ msgstr "Автоматаар устгах"
#: help:mail.compose.message,email_bcc:0 help:mail.message,email_bcc:0
#: help:mail.message.common,email_bcc:0
msgid "Blind carbon copy message recipients"
-msgstr ""
+msgstr "Зурвасын нууц хуулбар хүлээн авагчид"
#. module: mail
#: model:ir.model,name:mail.model_res_partner view:mail.message:0
@@ -185,11 +185,13 @@ msgid ""
"Type of message, usually 'html' or 'plain', used to select plaintext or rich "
"text contents accordingly"
msgstr ""
+"Зурвасын төрөл, ихэнхдээ 'html' эсвэл 'хавтгай', хэрэглэгддэг бөгөөд "
+"форматтай текст эсвэл цэвэр хавтгай текстийг илэрхийлнэ"
#. module: mail
#: view:mail.message:0
msgid "Recipients"
-msgstr ""
+msgstr "Хүлээн авагчид"
#. module: mail
#: model:ir.model,name:mail.model_mail_compose_message
@@ -200,18 +202,18 @@ msgstr ""
#: field:mail.compose.message,res_id:0 field:mail.message,res_id:0
#: field:mail.message.common,res_id:0
msgid "Related Document ID"
-msgstr ""
+msgstr "Холбогдох Баримтын ID"
#. module: mail
#: view:mail.message:0
msgid "Advanced"
-msgstr ""
+msgstr "Дэвшилтэт"
#. module: mail
#: code:addons/mail/wizard/mail_compose_message.py:157
#, python-format
msgid "Re:"
-msgstr ""
+msgstr "Хариу:"
#. module: mail
#: field:mail.compose.message,model:0 field:mail.message,model:0
@@ -227,59 +229,59 @@ msgstr "Сар"
#. module: mail
#: view:mail.message:0
msgid "Email Search"
-msgstr ""
+msgstr "Имэйл хайх"
#. module: mail
#: help:mail.message,original:0
msgid "Original version of the message, as it was sent on the network"
-msgstr ""
+msgstr "Сүлжээгээр илгээгдсэн зурвасын оригиналь хувилбар"
#. module: mail
#: view:mail.message:0
msgid "Partner Name"
-msgstr ""
+msgstr "Харицагчийн нэр"
#. module: mail
#: view:mail.message:0
msgid "Retry"
-msgstr ""
+msgstr "Дахин оролдох"
#. module: mail
#: view:mail.message:0 selection:mail.message,state:0
msgid "Outgoing"
-msgstr ""
+msgstr "Гарах"
#. module: mail
#: view:mail.message:0
msgid "Send Now"
-msgstr ""
+msgstr "Одоо илгээх"
#. module: mail
#: field:mail.message,partner_id:0
msgid "Related partner"
-msgstr ""
+msgstr "Холбогдох харилцагч"
#. module: mail
#: view:mail.message:0
msgid "User"
-msgstr ""
+msgstr "Хэрэглэгч"
#. module: mail
#: field:mail.compose.message,date:0 field:mail.message,date:0
#: field:mail.message.common,date:0
msgid "Date"
-msgstr ""
+msgstr "Огноо"
#. module: mail
#: view:mail.message:0
msgid "Extended Filters..."
-msgstr ""
+msgstr "Өргөтгөсөн хайлт..."
#. module: mail
#: code:addons/mail/wizard/mail_compose_message.py:153
#, python-format
msgid "%(sender_name)s wrote:"
-msgstr ""
+msgstr "%(sender_name)s бичсэн:"
#. module: mail
#: field:mail.compose.message,body_html:0 field:mail.message,body_html:0
@@ -290,69 +292,70 @@ msgstr ""
#. module: mail
#: field:mail.message,original:0
msgid "Original"
-msgstr ""
+msgstr "Оригиналь"
#. module: mail
#: code:addons/mail/mail_thread.py:247 view:res.partner:0
#, python-format
msgid "History"
-msgstr ""
+msgstr "Түүх"
#. module: mail
#: field:mail.compose.message,message_id:0 field:mail.message,message_id:0
#: field:mail.message.common,message_id:0
msgid "Message-Id"
-msgstr ""
+msgstr "Зурвас-Id"
#. module: mail
#: view:mail.compose.message:0 field:mail.compose.message,attachment_ids:0
#: view:mail.message:0 field:mail.message,attachment_ids:0
msgid "Attachments"
-msgstr ""
+msgstr "Хавсралтууд"
#. module: mail
#: field:mail.compose.message,email_cc:0 field:mail.message,email_cc:0
#: field:mail.message.common,email_cc:0
msgid "Cc"
-msgstr ""
+msgstr "Cc"
#. module: mail
#: code:addons/mail/mail_message.py:159
#, python-format
msgid " on "
-msgstr ""
+msgstr " дээр нь "
#. module: mail
#: help:mail.message,auto_delete:0
msgid "Permanently delete this email after sending it, to save space"
msgstr ""
+"Зай хэмнэхийн тулд энэ имэйлийг илгээсэн дараагаараа бүр мөсөн устгах"
#. module: mail
#: field:mail.compose.message,references:0 field:mail.message,references:0
#: field:mail.message.common,references:0
msgid "References"
-msgstr ""
+msgstr "Сурвалж"
#. module: mail
#: field:mail.message,display_text:0
msgid "Display Text"
-msgstr ""
+msgstr "Текст Харуулах"
#. module: mail
#: view:mail.compose.message:0 view:mail.message:0
msgid "Cancel"
-msgstr ""
+msgstr "Цуцлах"
#. module: mail
#: view:mail.message:0
msgid "Open"
-msgstr ""
+msgstr "Нээх"
#. module: mail
#: code:addons/mail/mail_thread.py:434
#, python-format
msgid "[OpenERP-Forward-Failed] %s"
-msgstr ""
+msgstr "[OpenERP-дамжуулалт-бүтэлгүйтлээ] %s"
#. module: mail
#: field:mail.message,user_id:0
@@ -366,28 +369,30 @@ msgid ""
"Full message headers, e.g. SMTP session headers (usually available on "
"inbound messages only)"
msgstr ""
+"Зурвасын бүрэн толгой, ө.х. SMTP толгойнууд (ихэнхдээ ирж байгаа зурвасуудад "
+"байдаг)"
#. module: mail
#: view:mail.message:0
msgid "Creation Month"
-msgstr ""
+msgstr "Үүсгэсэн сар"
#. module: mail
#: field:mail.compose.message,email_to:0 field:mail.message,email_to:0
#: field:mail.message.common,email_to:0
msgid "To"
-msgstr ""
+msgstr "Хэнд"
#. module: mail
#: view:mail.message:0
msgid "Details"
-msgstr ""
+msgstr "Дэлгэрэнгүй"
#. module: mail
#: model:ir.actions.act_window,name:mail.action_view_mailgate_thread
#: view:mail.thread:0
msgid "Email Threads"
-msgstr ""
+msgstr "Имэйл Салбар"
#. module: mail
#: help:mail.compose.message,email_from:0 help:mail.message,email_from:0
@@ -396,28 +401,30 @@ msgid ""
"Message sender, taken from user preferences. If empty, this is not a mail "
"but a message."
msgstr ""
+"Зурвас илгээгч, хэрэглэгчийн тохиргооноос авагдана. Хэрэв хоосон бол мэйл "
+"биш боловч зурвас байна."
#. module: mail
#: view:mail.message:0
msgid "Body (Plain)"
-msgstr ""
+msgstr "Бие (Хавтгай)"
#. module: mail
#: code:addons/mail/wizard/mail_compose_message.py:153
#, python-format
msgid "You"
-msgstr ""
+msgstr "Та"
#. module: mail
#: help:mail.compose.message,message_id:0 help:mail.message,message_id:0
#: help:mail.message.common,message_id:0
msgid "Message unique identifier"
-msgstr ""
+msgstr "Мессежийн цор ганц хувийн дугаар"
#. module: mail
#: view:mail.message:0
msgid "Body (Rich)"
-msgstr ""
+msgstr "Бие (Форматтай)"
#. module: mail
#: code:addons/mail/mail_message.py:155
@@ -427,19 +434,22 @@ msgid ""
" Subject: %s \n"
"\t"
msgstr ""
+"%s-н бичсэн огноо %s: \n"
+" Гарчиг: %s \n"
+"\t"
#. module: mail
#: model:ir.actions.act_window,name:mail.act_res_partner_emails
#: view:mail.message:0 field:res.partner,emails:0
msgid "Emails"
-msgstr ""
+msgstr "Э-мэйлүүд"
#. module: mail
#: model:ir.actions.act_window,name:mail.action_view_mail_message
#: model:ir.ui.menu,name:mail.menu_email_message
#: field:mail.thread,message_ids:0
msgid "Messages"
-msgstr ""
+msgstr "Зурвас"
#. module: mail
#: field:mail.compose.message,headers:0 field:mail.message,headers:0
@@ -451,64 +461,79 @@ msgstr ""
#: field:mail.compose.message,email_bcc:0 field:mail.message,email_bcc:0
#: field:mail.message.common,email_bcc:0
msgid "Bcc"
-msgstr ""
+msgstr "Bcc"
#. module: mail
#: model:ir.model,name:mail.model_mail_message_common
msgid "mail.message.common"
-msgstr ""
+msgstr "mail.message.common"
#. module: mail
#: help:mail.compose.message,references:0 help:mail.message,references:0
#: help:mail.message.common,references:0
msgid "Message references, such as identifiers of previous messages"
-msgstr ""
+msgstr "Зурвасын сурвалжууд, тухайлбал өмнөх зурвасуудыг хувийн дугаарууд"
#. module: mail
#: constraint:res.partner:0
msgid "Error ! You cannot create recursive associated members."
-msgstr ""
+msgstr "Алдаа ! Тойрч холбогдсон гишүүдийг үүсгэх боломжгүй."
#. module: mail
#: help:mail.compose.message,email_cc:0 help:mail.message,email_cc:0
#: help:mail.message.common,email_cc:0
msgid "Carbon copy message recipients"
-msgstr ""
+msgstr "Зурвасын хуулбар хүлээн авагчид"
#. module: mail
#: selection:mail.message,state:0
msgid "Delivery Failed"
-msgstr ""
+msgstr "Хүргэлт Бүтсэнгүй"
#. module: mail
#: model:ir.model,name:mail.model_mail_message
msgid "Email Message"
-msgstr ""
+msgstr "Имэйл зурвас"
#. module: mail
#: model:ir.model,name:mail.model_mail_thread view:mail.thread:0
msgid "Email Thread"
-msgstr ""
+msgstr "Имэйл Салбар"
#. module: mail
#: field:mail.compose.message,filter_id:0
msgid "Filters"
-msgstr ""
+msgstr "Шүүлтүүр"
#. module: mail
#: code:addons/mail/mail_thread.py:220
#, python-format
msgid "Mail attachment"
-msgstr ""
+msgstr "Мэйлийн хавсралт"
#. module: mail
#: help:mail.compose.message,reply_to:0 help:mail.message,reply_to:0
#: help:mail.message.common,reply_to:0
msgid "Preferred response address for the message"
-msgstr ""
+msgstr "Зурвасын зөвлөмжит хариулах хаяг"
#~ msgid "Message type"
#~ msgstr "Зурвасын төрөл"
+#~ msgid "Related user"
+#~ msgstr "Хамааралтай хэрэглэгч"
+
#~ msgid "Text contents"
-#~ msgstr "Текстийн агуулга"
+#~ msgstr "Текст агуулга"
+
+#~ msgid "Related Document model"
+#~ msgstr "Холбогдох Баримтын Модель"
+
+#~ msgid "E-mail composition wizard"
+#~ msgstr "И-мэйл үүсгэх харилцах цонх"
+
+#~ msgid "Rich-text contents"
+#~ msgstr "Rich-text агуулгууд"
+
+#~ msgid "Message headers"
+#~ msgstr "Зурвасын толгойнууд"
diff --git a/addons/mail/i18n/nl.po b/addons/mail/i18n/nl.po
index 9ff1eb064ab..1a5600c5d0b 100644
--- a/addons/mail/i18n/nl.po
+++ b/addons/mail/i18n/nl.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/pl.po b/addons/mail/i18n/pl.po
index 9822087aca2..c939ba58a87 100644
--- a/addons/mail/i18n/pl.po
+++ b/addons/mail/i18n/pl.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/pt.po b/addons/mail/i18n/pt.po
index 32e5ae378af..9b4283eec84 100644
--- a/addons/mail/i18n/pt.po
+++ b/addons/mail/i18n/pt.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/pt_BR.po b/addons/mail/i18n/pt_BR.po
index 56ae6418604..d9786945a70 100644
--- a/addons/mail/i18n/pt_BR.po
+++ b/addons/mail/i18n/pt_BR.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/ro.po b/addons/mail/i18n/ro.po
index 4f3d47b8326..c2bb6d4aafe 100644
--- a/addons/mail/i18n/ro.po
+++ b/addons/mail/i18n/ro.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/ru.po b/addons/mail/i18n/ru.po
index 4d3da068ee7..49b9490d039 100644
--- a/addons/mail/i18n/ru.po
+++ b/addons/mail/i18n/ru.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/sl.po b/addons/mail/i18n/sl.po
index 220cac471d0..b88fc2c7062 100644
--- a/addons/mail/i18n/sl.po
+++ b/addons/mail/i18n/sl.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/sr@latin.po b/addons/mail/i18n/sr@latin.po
index 3ef4a91f8ea..b2612459f9d 100644
--- a/addons/mail/i18n/sr@latin.po
+++ b/addons/mail/i18n/sr@latin.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/sv.po b/addons/mail/i18n/sv.po
index b715df70e6a..6b612090875 100644
--- a/addons/mail/i18n/sv.po
+++ b/addons/mail/i18n/sv.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/tr.po b/addons/mail/i18n/tr.po
index 6c7916ae176..8b03d2543a3 100644
--- a/addons/mail/i18n/tr.po
+++ b/addons/mail/i18n/tr.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/i18n/zh_CN.po b/addons/mail/i18n/zh_CN.po
index a0ccb8925d1..1122c6c6b45 100644
--- a/addons/mail/i18n/zh_CN.po
+++ b/addons/mail/i18n/zh_CN.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-07-14 06:24+0000\n"
-"X-Generator: Launchpad (build 15614)\n"
+"X-Launchpad-Export-Date: 2012-08-07 05:36+0000\n"
+"X-Generator: Launchpad (build 15745)\n"
#. module: mail
#: field:mail.compose.message,subtype:0 field:mail.message,subtype:0
diff --git a/addons/mail/mail_alias.py b/addons/mail/mail_alias.py
new file mode 100644
index 00000000000..807ed5dbe61
--- /dev/null
+++ b/addons/mail/mail_alias.py
@@ -0,0 +1,133 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Business Applications
+# Copyright (C) 2012 OpenERP S.A. (<http://openerp.com>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import re
+
+from openerp.osv import fields, osv
+
+
+class mail_alias(osv.Model):
+ """A Mail Alias is a mapping of an email address with a given OpenERP Document
+ model. It is used by OpenERP's mail gateway when processing incoming emails
+ sent to the system. If the recipient address (To) of the message matches
+ a Mail Alias, the message will be either processed following the rules
+ of that alias. If the message is a reply it will be attached to the
+ existing discussion on the corresponding record, otherwise a new
+ record of the corresponding model will be created.
+
+ This is meant to be used in combination with a catch-all email configuration
+ on the company's mail server, so that as soon as a new mail.alias is
+ created, it becomes immediately usable and OpenERP will accept email for it.
+ """
+ _name = 'mail.alias'
+ _description = "Email Aliases"
+ _rec_name = 'alias_name'
+
+ def _get_alias_domain(self, cr, uid, ids, name, args, context=None):
+ ir_config_parameter = self.pool.get("ir.config_parameter")
+ domain = ir_config_parameter.get_param(cr, uid, "mail.catchall.domain", context=context)
+ return dict.fromkeys(ids, domain or "")
+
+ _columns = {
+ 'alias_name': fields.char('Alias', required=True,
+ help="The name of the email alias, e.g. 'jobs' "
+ "if you want to catch emails for <jobs@example.my.openerp.com>",),
+ 'alias_model_id': fields.many2one('ir.model', 'Aliased Model', required=True,
+ help="The model (OpenERP Document Kind) to which this alias "
+ "corresponds. Any incoming email that does not reply to an "
+ "existing record will cause the creation of a new record "
+ "of this model (e.g. a Project Task)",
+ # only allow selecting mail_thread models!
+ #TODO kept doamin temporarily in comment, need to redefine domain
+ #domain="[('field_id', 'in', 'message_ids')]"
+ ),
+ 'alias_user_id': fields.many2one('res.users', 'Owner',
+ help="The owner of records created upon receiving emails on this alias. "
+ "If this field is not set the system will attempt to find the right owner "
+ "based on the sender (From) address, or will use the Administrator account "
+ "if no system user is found for that address."),
+ 'alias_defaults': fields.text('Default Values', required=True,
+ help="A Python dictionary that will be evaluated to provide "
+ "default values when creating new records for this alias."),
+ 'alias_force_thread_id': fields.integer('Record Thread ID',
+ help="Optional ID of a thread (record) to which all incoming "
+ "messages will be attached, even if they did not reply to it. "
+ "If set, this will disable the creation of new records completely."),
+ 'alias_domain': fields.function(_get_alias_domain, string="Alias Domain", type='char', size=None),
+ }
+
+ _defaults = {
+ 'alias_defaults': '{}',
+ 'alias_user_id': lambda self,cr,uid, context: uid
+ }
+
+ _sql_constraints = [
+ ('alias_unique', 'UNIQUE(alias_name)', 'Unfortunately this email alias is already used, please choose a unique one')
+ ]
+
+ def _check_alias_defaults(self, cr, uid, ids, context=None):
+ try:
+ for record in self.browse(cr, uid, ids, context=context):
+ dict(eval(record.alias_defaults))
+ except Exception:
+ return False
+ return True
+
+ _constraints = [
+ (_check_alias_defaults, '''Invalid expression, it must be a literal python dictionary definition e.g. "{'field': 'value'}"''', ['alias_defaults']),
+ ]
+
+ def name_get(self, cr, uid, ids, context=None):
+ """Return the mail alias display alias_name, inclusing the implicit
+ mail catchall domain from config.
+ e.g. `jobs@openerp.my.openerp.com` or `sales@openerp.my.openerp.com`
+ """
+ return [(record['id'], "%s@%s" % (record['alias_name'], record['alias_domain']))
+ for record in self.read(cr, uid, ids, ['alias_name', 'alias_domain'], context=context)]
+
+ def _find_unique(self, cr, uid, name, context=None):
+ """Find a unique alias name similar to ``name``. If ``name`` is
+ already taken, make a variant by adding an integer suffix until
+ an unused alias is found.
+ """
+ sequence = None
+ while True:
+ new_name = "%s%s" % (name, sequence) if sequence is not None else name
+ if not self.search(cr, uid, [('alias_name', '=', new_name)]):
+ break
+ sequence = (sequence + 1) if sequence else 2
+ return new_name
+
+ def create_unique_alias(self, cr, uid, vals, model_name=None, context=None):
+ """Creates an email.alias record according to the values provided in ``vals``,
+ with 2 alterations: the ``alias_name`` value may be suffixed in order to
+ make it unique, and the ``alias_model_id`` value will set to the
+ model ID of the ``model_name`` value, if provided,
+ """
+ alias_name = re.sub(r'\W+', '_', vals['alias_name']).lower()
+ alias_name = self._find_unique(cr, uid, alias_name, context=context)
+ vals['alias_name'] = alias_name
+ if model_name:
+ model_id = self.pool.get('ir.model').search(cr, uid, [('model', '=', model_name)], context=context)[0]
+ vals['alias_model_id'] = model_id
+ return self.create(cr, uid, vals, context=context)
+
+
diff --git a/addons/mail/mail_alias_view.xml b/addons/mail/mail_alias_view.xml
new file mode 100644
index 00000000000..61a89b774ca
--- /dev/null
+++ b/addons/mail/mail_alias_view.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+<openerp>
+ <data>
+
+ <!-- Alias Form View -->
+ <record model="ir.ui.view" id="view_mail_alias_form">
+ <field name="name">mail.alias.form</field>
+ <field name="model">mail.alias</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Alias" version="7.0">
+ <sheet>
+ <label for="alias_name" class="oe_edit_only"/>
+ <h2><field name="alias_name" class="oe_inline"/>@<field name="alias_domain" class="oe_inline"/></h2>
+ <group colspan="4" col="4">
+ <field name="alias_model_id" readonly="1"/>
+ <field name="alias_user_id" readonly="1"/>
+ <field name="alias_force_thread_id" readonly="1"/>
+ <newline/>
+ <separator string="Default Values" colspan="4"/>
+ <field name="alias_defaults" colspan="4" nolabel="1" readonly="1"/>
+ </group>
+ </sheet>
+ </form>
+ </field>
+ </record>
+
+ <!-- Alias List View -->
+ <record model="ir.ui.view" id="view_mail_alias_tree">
+ <field name="name">mail.alias.tree</field>
+ <field name="model">mail.alias</field>
+ <field name="type">tree</field>
+ <field name="arch" type="xml">
+ <tree string="Alias">
+ <field name="alias_name"/>
+ <field name="alias_model_id"/>
+ <field name="alias_user_id"/>
+ <field name="alias_defaults"/>
+ </tree>
+ </field>
+ </record>
+
+ <!-- Alias Search View -->
+ <record model="ir.ui.view" id="view_mail_alias_search">
+ <field name="name">mail.alias.search</field>
+ <field name="model">mail.alias</field>
+ <field name="type">search</field>
+ <field name="arch" type="xml">
+ <search string="Search Alias">
+ <field name="alias_name"/>
+ <field name="alias_model_id"/>
+ <group expand="0" string="Group By...">
+ <filter string="User" name="User" icon="terp-personal" context="{'group_by':'alias_user_id'}"/>
+ <filter string="Model" name="Model" context="{'group_by':'alias_model_id'}"/>
+ </group>
+ </search>
+ </field>
+ </record>
+
+ <record id="action_view_mail_alias" model="ir.actions.act_window">
+ <field name="name">Aliases</field>
+ <field name="res_model">mail.alias</field>
+ </record>
+
+ <menuitem id="mail_alias_menu"
+ parent="base.menu_email"
+ action="action_view_mail_alias"
+ sequence="50"
+ groups="base.group_no_one"/>
+
+ </data>
+</openerp>
diff --git a/addons/mail/mail_group.py b/addons/mail/mail_group.py
index 36001ee6074..b850f1c29f7 100644
--- a/addons/mail/mail_group.py
+++ b/addons/mail/mail_group.py
@@ -20,16 +20,14 @@
##############################################################################
import datetime as DT
-import io
import openerp
import openerp.tools as tools
from operator import itemgetter
from osv import osv
from osv import fields
-from PIL import Image
-import StringIO
import tools
from tools.translate import _
+from lxml import etree
class mail_group(osv.osv):
"""
@@ -48,33 +46,17 @@ class mail_group(osv.osv):
_description = 'Discussion group'
_name = 'mail.group'
_inherit = ['mail.thread']
+ _inherits = {'mail.alias': 'alias_id'}
- def onchange_photo(self, cr, uid, ids, value, context=None):
- if not value:
- return {'value': {'avatar_big': value, 'avatar': value} }
- return {'value': {'photo_big': value, 'photo': self._photo_resize(cr, uid, value) } }
-
- def _set_photo(self, cr, uid, id, name, value, args, context=None):
- if value:
- return self.write(cr, uid, [id], {'photo_big': value}, context=context)
- else:
- return self.write(cr, uid, [id], {'photo_big': value}, context=context)
-
- def _photo_resize(self, cr, uid, photo, width=128, height=128, context=None):
- image_stream = io.BytesIO(photo.decode('base64'))
- img = Image.open(image_stream)
- img.thumbnail((width, height), Image.ANTIALIAS)
- img_stream = StringIO.StringIO()
- img.save(img_stream, "JPEG")
- return img_stream.getvalue().encode('base64')
-
- def _get_photo(self, cr, uid, ids, name, args, context=None):
+ def _get_image(self, cr, uid, ids, name, args, context=None):
result = dict.fromkeys(ids, False)
- for group in self.browse(cr, uid, ids, context=context):
- if group.photo_big:
- result[group.id] = self._photo_resize(cr, uid, group.photo_big, context=context)
+ for obj in self.browse(cr, uid, ids, context=context):
+ result[obj.id] = tools.image_get_resized_images(obj.image)
return result
+ def _set_image(self, cr, uid, id, name, value, args, context=None):
+ return self.write(cr, uid, [id], {'image': tools.image_resize_image_big(value)}, context=context)
+
def get_member_ids(self, cr, uid, ids, field_names, args, context=None):
if context is None:
context = {}
@@ -102,9 +84,9 @@ class mail_group(osv.osv):
result[id] = self.message_search(cr, uid, [id], limit=None, domain=[('date', '>=', lower_date)], count=True, context=context)
return result
- def _get_default_photo(self, cr, uid, context=None):
- avatar_path = openerp.modules.get_module_resource('mail', 'static/src/img', 'groupdefault.png')
- return self._photo_resize(cr, uid, open(avatar_path, 'rb').read().encode('base64'), context=context)
+ def _get_default_image(self, cr, uid, context=None):
+ image_path = openerp.modules.get_module_resource('mail', 'static/src/img', 'groupdefault.png')
+ return tools.image_resize_image_big(open(image_path, 'rb').read().encode('base64'))
_columns = {
'name': fields.char('Name', size=64, required=True),
@@ -119,16 +101,26 @@ class mail_group(osv.osv):
help="Members of those groups will automatically added as followers. "\
"Note that they will be able to manage their subscription manually "\
"if necessary."),
- 'photo_big': fields.binary('Full-size photo',
- help='Field holding the full-sized PIL-supported and base64 encoded "\
- version of the group image. The photo field is used as an "\
- interface for this field.'),
- 'photo': fields.function(_get_photo, fnct_inv=_set_photo,
- string='Photo', type="binary",
+ 'image': fields.binary("Photo",
+ help="This field holds the image used as photo for the "\
+ "user. The image is base64 encoded, and PIL-supported. "\
+ "It is limited to a 12024x1024 px image."),
+ 'image_medium': fields.function(_get_image, fnct_inv=_set_image,
+ string="Medium-sized photo", type="binary", multi="_get_image",
+ store = {
+ 'mail.group': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
+ },
+ help="Medium-sized photo of the group. It is automatically "\
+ "resized as a 180x180px image, with aspect ratio preserved. "\
+ "Use this field in form views or some kanban views."),
+ 'image_small': fields.function(_get_image, fnct_inv=_set_image,
+ string="Small-sized photo", type="binary", multi="_get_image",
store = {
- 'mail.group': (lambda self, cr, uid, ids, c={}: ids, ['photo_big'], 10),
+ 'mail.group': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
},
- help='Field holding the automatically resized (128x128) PIL-supported and base64 encoded version of the group image.'),
+ help="Small-sized photo of the group. It is automatically "\
+ "resized as a 50x50px image, with aspect ratio preserved. "\
+ "Use this field anywhere a small image is required."),
'member_ids': fields.function(get_member_ids, fnct_search=search_member_ids,
type='many2many', relation='res.users', string='Group members', multi='get_member_ids'),
'member_count': fields.function(get_member_ids, type='integer',
@@ -137,12 +129,15 @@ class mail_group(osv.osv):
string='Joined', multi='get_member_ids'),
'last_month_msg_nbr': fields.function(get_last_month_msg_nbr, type='integer',
string='Messages count for last month'),
+ 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="cascade", required=True,
+ help="The email address associated with this group. New emails received will automatically "
+ "create new topics."),
}
_defaults = {
'public': True,
'responsible_id': (lambda s, cr, uid, ctx: uid),
- 'photo': _get_default_photo,
+ 'image': _get_default_image,
}
def _subscribe_user_with_group_m2m_command(self, cr, uid, ids, group_ids_command, context=None):
@@ -158,11 +153,29 @@ class mail_group(osv.osv):
return self.message_subscribe(cr, uid, ids, user_ids, context=context)
def create(self, cr, uid, vals, context=None):
- mail_group_id = super(mail_group, self).create(cr, uid, vals, context=context)
+ alias_pool = self.pool.get('mail.alias')
+ if not vals.get('alias_id'):
+ name = vals.get('alias_name') or vals['name']
+ alias_id = alias_pool.create_unique_alias(cr, uid,
+ {'alias_name': "group_"+name},
+ model_name=self._name, context=context)
+ vals['alias_id'] = alias_id
+ mail_group_id = super(mail_group, self).create(cr, uid, vals, context)
+ alias_pool.write(cr, uid, [vals['alias_id']], {"alias_force_thread_id": mail_group_id}, context)
+
if vals.get('group_ids'):
self._subscribe_user_with_group_m2m_command(cr, uid, [mail_group_id], vals.get('group_ids'), context=context)
+
return mail_group_id
+ def unlink(self, cr, uid, ids, context=None):
+ # Cascade-delete mail aliases as well, as they should not exist without the mail group.
+ mail_alias = self.pool.get('mail.alias')
+ alias_ids = [group.alias_id.id for group in self.browse(cr, uid, ids, context=context) if group.alias_id]
+ res = super(mail_group, self).unlink(cr, uid, ids, context=context)
+ mail_alias.unlink(cr, uid, alias_ids, context=context)
+ return res
+
def write(self, cr, uid, ids, vals, context=None):
if vals.get('group_ids'):
self._subscribe_user_with_group_m2m_command(cr, uid, ids, vals.get('group_ids'), context=context)
@@ -170,6 +183,6 @@ class mail_group(osv.osv):
def action_group_join(self, cr, uid, ids, context=None):
return self.message_subscribe(cr, uid, ids, context=context)
-
+
def action_group_leave(self, cr, uid, ids, context=None):
return self.message_unsubscribe(cr, uid, ids, context=context)
diff --git a/addons/mail/mail_group_view.xml b/addons/mail/mail_group_view.xml
index bd01e50baa5..5c81d426d6a 100644
--- a/addons/mail/mail_group_view.xml
+++ b/addons/mail/mail_group_view.xml
@@ -19,7 +19,7 @@
<t t-name="kanban-box">
<div t-attf-class="{record.is_subscriber.raw_value} oe_group_vignette">
<div class="oe_group_image">
- <a type="edit"><img t-att-src="kanban_image('mail.group', 'photo', record.id.value)" class="oe_group_photo" tooltip="kanban-description"/></a>
+ <a type="edit"><img t-att-src="kanban_image('mail.group', 'image_medium', record.id.value)" class="oe_group_photo" tooltip="kanban-description"/></a>
</div>
<div class="oe_group_details">
<h4><a type="edit"><field name="name"/></a></h4>
@@ -33,7 +33,6 @@
</div>
</div>
<script>
- $('.oe_group_photo').load(function() { if($(this).width() > $(this).height()) { $(this).addClass('oe_group_photo_wide') } });
$('.oe_group_join').mouseover(function () { $(this).html('Follow'); }).mouseleave(function () { $(this).html('Not following'); });
$('.oe_group_leave').mouseover(function () { $(this).html('Unfollow'); }).mouseleave(function () { $(this).html('Following'); });
</script>
@@ -54,13 +53,20 @@
<sheet class="openerp_mail_group_sheet">
<group colspan="4" col="8">
<group colspan="1" col="2">
- <field name="photo" widget='image' nolabel="1" on_change="onchange_photo(photo)"/>
+ <field name="image_small" widget='image' class="oe_image_small" nolabel="1"/>
</group>
<group colspan="7" col="6">
<div class="oe_edit_only">
<label for="name"/>
</div>
- <h2><field name="name" colspan="4"/></h2>
+ <div>
+ <h2><field name="name" colspan="4"/></h2>
+ <div name="alias_box" colspan="4" attrs="{'invisible': [('alias_domain', '=', False)]}" class="oe_edit_only">
+ <field name="alias_id" invisible="1"/>
+ <label for="alias_name" class="oe_edit_only"/>
+ <field name="alias_name" nolabel="1" class="oe_inline" attrs="{'required': [('alias_id', '!=', False)]}"/>@<field name="alias_domain" nolabel="1" class="oe_inline"/>
+ </div>
+ </div>
<newline/>
<group colspan="4" col="4">
<field name="description" colspan="4" nolabel="1"/>
diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py
index 21d123ec024..7afe8abdc92 100644
--- a/addons/mail/mail_thread.py
+++ b/addons/mail/mail_thread.py
@@ -79,11 +79,11 @@ class mail_thread(osv.Model):
return [('id', 'in', msg_ids)]
_columns = {
- 'message_ids': fields.function(_get_message_ids, method = True,
- fnct_search = _search_message_ids,
- type = 'one2many', obj = 'mail.message', _fields_id = 'res_id',
- string = 'Temp messages', multi = "_get_message_ids",
- help = "Functional field holding messages related to the current document."),
+ 'message_ids': fields.function(_get_message_ids,
+ fnct_search=_search_message_ids,
+ type='one2many', obj='mail.message', _fields_id = 'res_id',
+ string='Temp messages', multi="_get_message_ids",
+ help="Functional field holding messages related to the current document."),
'message_state': fields.boolean('Read',
help = "When checked, new messages require your attention."),
'message_summary': fields.function(_get_message_ids, method = True,
@@ -562,14 +562,64 @@ class mail_thread(osv.Model):
msgs = msg_obj.read(cr, uid, msg_ids, context = context)
return msgs
+
+ def _get_user(self, cr, uid, alias, context):
+ """
+ param alias: browse record of alias.
+ return: int user_id.
+ """
+
+ user_obj = self.pool.get('res.user')
+ user_id = 1
+ if alias.alias_user_id:
+ user_id = alias.alias_user_id.id
+ #if user_id not defined in the alias then search related user using name of Email sender
+ else:
+ from_email = msg.get('from')
+ user_ids = user_obj.search(cr, uid, [('name','=',from_email)], context)
+ if user_ids:
+ user_id = user_obj.browse(cr, uid, user_ids[0], context).id
+ return user_id
+
+ def message_catchall(self, cr, uid, message, context=None):
+ """
+ Process incoming mail and call messsage_process using details of the mail.alias model
+ else raise Exception so that mailgate script will reject the mail and
+ send notification mail sender that this mailbox does not exist so your mail have been rejected.
+ """
+ mail_alias = self.pool.get('mail.alias')
+ mail_message = self.pool.get('mail.message')
+ if isinstance(message, xmlrpclib.Binary):
+ message = str(message.data)
+ if isinstance(message, unicode):
+ message = message.encode('utf-8')
+ msg_txt = email.message_from_string(message)
+ msg = mail_message.parse_message(msg_txt)
+ alias_name = msg.get('to').split("@")[0] # @@@@
+ alias_ids = mail_alias.search(cr, uid, [('alias_name','=',alias_name)])
+ #if alias found then call message_process method. # @@@@
+ if alias_ids:
+ alias_id = mail_alias.browse(cr, uid, alias_ids[0], context)
+ user_id = self._get_user( cr, uid, alias_id, context)
+ alias_defaults = dict(eval(alias_id.alias_defaults or {}))
+ self.message_process(cr, user_id, alias_id.alias_model_id.model, message,
+ custom_values=alias_defaults,
+ thread_id=alias_id.alias_force_thread_id or False,
+ context=context)
+ else:
+ #if Mail box for the intended Mail Alias then give logger warning
+ _logger.warning("No Mail Alias Found for the name '%s'."%(alias_name))
+ raise # @@@@
+ return True
+
#------------------------------------------------------
# Mail gateway
#------------------------------------------------------
# message_process will call either message_new or message_update.
- def message_process(self, cr, uid, model, message, custom_values = None,
- save_original = False, strip_attachments = False,
- context = None):
+ def message_process(self, cr, uid, model, message, custom_values=None,
+ save_original=False, strip_attachments=False,
+ thread_id=None, context=None):
"""Process an incoming RFC2822 email message related to the
given thread model, relying on ``mail.message.parse()``
for the parsing operation, and then calling ``message_new``
@@ -589,6 +639,10 @@ class mail_thread(osv.Model):
email source attached to the message after it is imported.
:param bool strip_attachments: whether to strip all attachments
before processing the message, in order to save some space.
+ :param int thread_id: optional ID of the record/thread from ``model``
+ to which this mail should be attached. When provided, this
+ overrides the automatic detection based on the message
+ headers.
"""
# extract message bytes - we are forced to pass the message as binary because
# we don't know its encoding until we parse its headers and hence can't
@@ -596,13 +650,13 @@ class mail_thread(osv.Model):
if isinstance(message, xmlrpclib.Binary):
message = str(message.data)
+ if context is None: context = {}
+
+ mail_message = self.pool.get('mail.message')
model_pool = self.pool.get(model)
if self._name != model:
- if context is None: context = {}
context.update({'thread_model': model})
- mail_message = self.pool.get('mail.message')
-
# Parse Message
# Warning: message_from_string doesn't always work correctly on unicode,
# we must use utf-8 strings here :-(
@@ -622,9 +676,8 @@ class mail_thread(osv.Model):
if hasattr(model_pool, 'message_new'):
return model_pool.message_new(cr, uid, msg,
custom_values,
- context = context)
- res_id = False
- if msg.get('references') or msg.get('in-reply-to'):
+ context=context)
+ if not thread_id and (msg.get('references') or msg.get('in-reply-to')):
references = msg.get('references') or msg.get('in-reply-to')
if '\r\n' in references:
references = references.split('\r\n')
@@ -632,28 +685,25 @@ class mail_thread(osv.Model):
references = references.split(' ')
for ref in references:
ref = ref.strip()
- res_id = tools.reference_re.search(ref)
- if res_id:
- res_id = res_id.group(1)
- else:
- res_id = tools.res_re.search(msg['subject'])
- if res_id:
- res_id = res_id.group(1)
- if res_id:
- res_id = res_id
- if model_pool.exists(cr, uid, res_id):
- if hasattr(model_pool, 'message_update'):
- model_pool.message_update(cr, uid, [res_id], msg, {}, context = context)
- else:
- # referenced thread was not found, we'll have to create a new one
- res_id = False
- if not res_id:
- res_id = create_record(msg)
+ thread_id = tools.reference_re.search(ref)
+ if not thread_id:
+ thread_id = tools.res_re.search(msg['subject'])
+ if thread_id:
+ thread_id = int(thread_id.group(1))
+ if not model_pool.exists(cr, uid, thread_id) or \
+ not hasattr(model_pool, 'message_update'):
+ # referenced thread not found or not updatable,
+ # -> create a new one
+ thread_id = False
+ if not thread_id:
+ thread_id = create_record(msg)
+ else:
+ model_pool.message_update(cr, uid, [thread_id], msg, {}, context=context)
# To forward the email to other followers
- self.message_forward(cr, uid, model, [res_id], msg_txt, context = context)
+ self.message_forward(cr, uid, model, [thread_id], msg_txt, context=context)
# Set as Unread
- model_pool.message_mark_as_unread(cr, uid, [res_id], context = context)
- return res_id
+ model_pool.message_mark_as_unread(cr, uid, [thread_id], context=context)
+ return thread_id
def message_new(self, cr, uid, msg_dict, custom_values = None, context = None):
"""Called by ``message_process`` when a new message is received
@@ -694,24 +744,19 @@ class mail_thread(osv.Model):
self.message_append_dict(cr, uid, [res_id], msg_dict, context = context)
return res_id
- def message_update(self, cr, uid, ids, msg_dict, update_vals = None, context = None):
- """ Called by ``message_process`` when a new message is received
- for an existing thread. The default behavior is to create a
- new mail.message in the given thread (by calling
- ``message_append_dict``)
- Additional behavior may be implemented by overriding this
- method.
-
- :param dict msg_dict: a map containing the email details and
- attachments. See ``message_process`` and
- ``mail.message.parse()`` for details.
- :param dict vals: a dict containing values to update records
+ def message_update(self, cr, uid, ids, msg_dict, update_vals=None, context=None):
+ """Called by ``message_process`` when a new message is received
+ for an existing thread. The default behavior is to create a
+ new mail.message in the given thread (by calling
+ ``message_append_dict``)
+ Additional behavior may be implemented by overriding this
+ method.
+ :param dict msg_dict: a map containing the email details and
+ attachments. See ``message_process`` and
+ ``mail.message.parse()`` for details.
+ :param dict update_vals: a dict containing values to update records
given their ids; if the dict is None or is
void, no write operation is performed.
- :param dict context: if a ``thread_model`` value is present
- in the context, its value will be used
- to determine the model of the thread to
- update (instead of the current model).
"""
if update_vals:
self.write(cr, uid, ids, update_vals, context = context)
@@ -850,7 +895,7 @@ class mail_thread(osv.Model):
subscr_ids = subscr_obj.search(cr, uid, ['&', ('res_model', '=', self._name), ('res_id', 'in', ids)], context = context)
return [sub['user_id'][0] for sub in subscr_obj.read(cr, uid, subscr_ids, ['user_id'], context = context)]
- def message_read_subscribers(self, cr, uid, ids, fields = ['id', 'name', 'avatar'], context = None):
+ def message_read_subscribers(self, cr, uid, ids, fields=['id', 'name', 'image_small'], context=None):
""" Returns the current document followers as a read result. Used
mainly for Chatter having only one method to call to have
details about users.
diff --git a/addons/mail/res_config.py b/addons/mail/res_config.py
new file mode 100644
index 00000000000..ce2f75687ba
--- /dev/null
+++ b/addons/mail/res_config.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2012-Today OpenERP SA (<http://www.openerp.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>
+#
+##############################################################################
+
+from openerp.osv import osv, fields
+
+class project_configuration(osv.TransientModel):
+ _inherit = 'base.config.settings'
+
+ _columns = {
+ 'alias_domain' : fields.char('Alias Domain',
+ help="If you have setup a catch-all email domain redirected to "
+ "the OpenERP server, enter the domain name here."),
+ }
+
+ def get_default_alias_domain(self, cr, uid, ids, context=None):
+ return {'alias_domain': self.pool.get("ir.config_parameter").get_param(cr, uid, "mail.catchall.domain", context=context)}
+
+ def set_alias_domain(self, cr, uid, ids, context=None):
+ config_parameters = self.pool.get("ir.config_parameter")
+ for record in self.browse(cr, uid, ids, context=context):
+ config_parameters.set_param(cr, uid, "mail.catchall.domain", record.alias_domain or '', context=context) \ No newline at end of file
diff --git a/addons/mail/res_config_view.xml b/addons/mail/res_config_view.xml
new file mode 100644
index 00000000000..a17a1f22a80
--- /dev/null
+++ b/addons/mail/res_config_view.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="view_general_configuration_mail_alias_domain" model="ir.ui.view">
+ <field name="name">base.config.settings.mail.alias</field>
+ <field name="model">base.config.settings</field>
+ <field name="inherit_id" ref="base_setup.view_general_configuration"/>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <xpath expr="/form/group[last()]/div[last()]/div[last()]" position='after' version="7.0">
+ <div>
+ <label for="alias_domain" class="oe_inline"/><field name="alias_domain" placeholder="mycompany.my.openerp.com" class="oe_inline"/>
+ </div>
+ </xpath>
+ </field>
+ </record>
+ </data>
+</openerp>
diff --git a/addons/mail/res_partner_view.xml b/addons/mail/res_partner_view.xml
index d1e2d881739..8b4d89f89f4 100644
--- a/addons/mail/res_partner_view.xml
+++ b/addons/mail/res_partner_view.xml
@@ -9,7 +9,7 @@
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//sheet" position="after">
- <div class="oe_chatter oe_mail_group_footer">
+ <div class="oe_chatter">
<field name="message_ids" widget="mail_thread"
options='{"thread_level": 1}'/>
</div>
diff --git a/addons/mail/res_users.py b/addons/mail/res_users.py
index 89767473754..8a590fc318f 100644
--- a/addons/mail/res_users.py
+++ b/addons/mail/res_users.py
@@ -19,9 +19,15 @@
#
##############################################################################
+import logging
+
from osv import osv, fields
+from openerp.modules.registry import RegistryManager
+from openerp import SUPERUSER_ID
from tools.translate import _
+_logger = logging.getLogger(__name__)
+
class res_users(osv.osv):
""" Update of res.users class
- add a preference about sending emails about notifications
@@ -30,6 +36,7 @@ class res_users(osv.osv):
"""
_name = 'res.users'
_inherit = ['res.users', 'mail.thread']
+ _inherits = {'mail.alias': 'alias_id'}
_columns = {
'notification_email_pref': fields.selection([
@@ -40,12 +47,15 @@ class res_users(osv.osv):
], 'Receive Feeds by Email', required=True,
help="Choose in which case you want to receive an email when you "\
"receive new feeds."),
+ 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="cascade", required=True,
+ help="Email address internally associated with this user. Incoming emails will appear "
+ "in the user's notifications."),
}
_defaults = {
'notification_email_pref': 'to_me',
}
-
+
def __init__(self, pool, cr):
""" Override of __init__ to add access rights on notification_email_pref
field. Access rights are disabled by default, but allowed on
@@ -56,18 +66,58 @@ class res_users(osv.osv):
self.SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
self.SELF_WRITEABLE_FIELDS.append('notification_email_pref')
return init_res
+
+ def init(self, cr):
+ # Installation hook to create aliases for all users, right after _auto_init
+ registry = RegistryManager.get(cr.dbname)
+ mail_alias = registry.get('mail.alias')
+ res_users = registry.get('res.users')
+ users_no_alias = res_users.search(cr, SUPERUSER_ID, [('alias_id', '=', False)])
+ # Use read() not browse(), to avoid prefetching uninitialized inherited fields
+ for user_data in res_users.read(cr, SUPERUSER_ID, users_no_alias, ['login']):
+ alias_id = mail_alias.create_unique_alias(cr, SUPERUSER_ID, {'alias_name': user_data['login'],
+ 'alias_force_id': user_data['id']},
+ model_name=self._name)
+ res_users.write(cr, SUPERUSER_ID, user_data['id'], {'alias_id': alias_id})
+ _logger.info('Mail alias created for user %s (uid %s)', user_data['login'], user_data['id'])
+
+ # Finally attempt to reinstate the missing constraint
+ try:
+ cr.execute('ALTER TABLE res_users ALTER COLUMN alias_id SET NOT NULL')
+ except Exception:
+ pass
+
def create(self, cr, uid, data, context=None):
+ # create default alias same as the login
+ mail_alias = self.pool.get('mail.alias')
+ alias_id = mail_alias.create_unique_alias(cr, uid, {'alias_name': data['login']}, model_name=self._name, context=context)
+ data['alias_id'] = alias_id
user_id = super(res_users, self).create(cr, uid, data, context=context)
- user = self.browse(cr, uid, [user_id], context=context)[0]
+ mail_alias.write(cr, SUPERUSER_ID, [alias_id], {"alias_force_thread_id": user_id}, context)
+
+ user = self.browse(cr, uid, user_id, context=context)
# make user follow itself
self.message_subscribe(cr, uid, [user_id], [user_id], context=context)
# create a welcome message
- company_name = user.company_id.name if user.company_id else 'the company'
- message = _('%s has joined %s! Welcome in OpenERP !') % (user.name, company_name)
- self.message_append_note(cr, uid, [user_id], subject='Welcom to OpenERP', body=message, type='comment', context=context)
+ company_name = user.company_id.name if user.company_id else _('the company')
+ message = _('%s joined the %s network! Take a moment to welcome %s.') % (user.name, company_name, user.name)
+ self.message_append_note(cr, uid, [user_id], body=message, type='comment', context=context)
return user_id
+
+ def write(self, cr, uid, ids, vals, context=None):
+ # User alias is sync'ed with login
+ if vals.get('login'): vals['alias_name'] = vals['login']
+ return super(res_users, self).write(cr, uid, ids, vals, context=context)
+ def unlink(self, cr, uid, ids, context=None):
+ # Cascade-delete mail aliases as well, as they should not exist without the user.
+ alias_pool = self.pool.get('mail.alias')
+ alias_ids = [user.alias_id.id for user in self.browse(cr, uid, ids, context=context) if user.alias_id]
+ res = super(res_users, self).unlink(cr, uid, ids, context=context)
+ alias_pool.unlink(cr, uid, alias_ids, context=context)
+ return res
+
def message_search_get_domain(self, cr, uid, ids, context=None):
""" Override of message_search_get_domain for partner discussion page.
The purpose is to add messages directly sent to user using
diff --git a/addons/mail/res_users_view.xml b/addons/mail/res_users_view.xml
index e268997ac2c..d1429f0afbc 100644
--- a/addons/mail/res_users_view.xml
+++ b/addons/mail/res_users_view.xml
@@ -27,10 +27,14 @@
<field name="notification_email_pref"/>
</field>
<xpath expr="/form/sheet" position="after">
- <div class="oe_chatter oe_mail_group_footer">
+ <div class="oe_chatter">
<field name="message_ids" colspan="4" widget="mail_thread" nolabel="1"/>
</div>
</xpath>
+ <field name="user_email" position="after">
+ <field name="alias_domain" invisible="1"/>
+ <field name="alias_id" readonly="1" attrs="{'invisible': [('alias_domain', '=', False)]}"/>
+ </field>
</data>
</field>
</record>
diff --git a/addons/mail/security/ir.model.access.csv b/addons/mail/security/ir.model.access.csv
index 1fb909f4435..3677d424c14 100644
--- a/addons/mail/security/ir.model.access.csv
+++ b/addons/mail/security/ir.model.access.csv
@@ -5,3 +5,5 @@ access_mail_thread,mail.thread,model_mail_thread,base.group_user,1,1,1,0
access_mail_subscription_all,mail.subscription.all,model_mail_subscription,,1,1,1,1
access_mail_notification_all,mail.notification.all,model_mail_notification,,1,1,1,1
access_mail_group,mail.group,model_mail_group,base.group_user,1,1,1,1
+access_mail_alias_user,mail.alias,model_mail_alias,base.group_user,1,1,1,0
+access_mail_alias_system,mail.alias,model_mail_alias,base.group_system,1,1,1,1
diff --git a/addons/mail/static/scripts/openerp_mailgate.py b/addons/mail/static/scripts/openerp_mailgate.py
index 68ae20d35e3..64dafc56785 100755
--- a/addons/mail/static/scripts/openerp_mailgate.py
+++ b/addons/mail/static/scripts/openerp_mailgate.py
@@ -94,22 +94,23 @@ class RPCProxy(object):
return self.rpc.execute(self.dbname, self.user_id, self.passwd, *request, **kwargs)
class EmailParser(object):
- def __init__(self, uid, password, model, email_default, dbname, host, port):
+ def __init__(self, uid, password, dbname, host, port, model=False, email_default=False):
self.rpc = RPCProxy(uid, password, host=host, port=port, dbname=dbname)
- try:
- self.model_id = int(model)
- self.model = str(model)
- except:
- self.model_id = self.rpc('ir.model', 'search', [('model', '=', model)])[0]
- self.model = str(model)
- self.email_default = email_default
+ if model:
+ try:
+ self.model_id = int(model)
+ self.model = str(model)
+ except:
+ self.model_id = self.rpc('ir.model', 'search', [('model', '=', model)])[0]
+ self.model = str(model)
+ self.email_default = email_default
- def parse(self, message, custom_values=None, save_original=None):
+ def parse(self, method, message, custom_values=None, save_original=None):
# pass message as bytes because we don't know its encoding until we parse its headers
# and hence can't convert it to utf-8 for transport
res_id = self.rpc('mail.thread',
- 'message_process',
+ method,
self.model,
xmlrpclib.Binary(message),
custom_values or {},
@@ -156,30 +157,29 @@ def main():
"""
Receive the email via the stdin and send it to the OpenERP Server
"""
+
parser = configure_parser()
(options, args) = parser.parse_args()
-
-
+ method = "message_process"
email_parser = EmailParser(options.userid,
options.password,
- options.model,
- options.default,
- dbname=options.dbname,
- host=options.host,
- port=options.port)
-
-
+ options.dbname,
+ options.host,
+ options.port,
+ model=options.model,
+ email_default= options.default)
msg_txt = sys.stdin.read()
-
custom_values = {}
+ if not options.model:
+ method = "message_catchall"
try:
- custom_values = dict(eval(options.custom_values or {} ))
+ custom_values = dict(eval(options.custom_values or "{}" ))
except:
import traceback
traceback.print_exc()
try:
- email_parser.parse(msg_txt, custom_values, options.save_original or False)
+ email_parser.parse(method, msg_txt, custom_values, options.save_original or False)
except Exception:
msg = '\n'.join([
'parameters',
diff --git a/addons/mail/static/src/css/mail_group.css b/addons/mail/static/src/css/mail_group.css
index b03be086fc6..8f4ca61d531 100644
--- a/addons/mail/static/src/css/mail_group.css
+++ b/addons/mail/static/src/css/mail_group.css
@@ -20,12 +20,6 @@
max-width: 80%;
}
-/* Resize group logo */
-.openerp .oe_form_sheetbg.openerp_mail_group_sheet .oe_form_field_image > img {
- max-width: 100px;
- max-height: 100px;
-}
-
/* Resize group description */
.openerp .oe_form_sheetbg.openerp_mail_group_sheet .oe_form_field_text > textarea {
height: 40px;
@@ -63,14 +57,8 @@
.oe_group_photo {
width: 100px;
- height: auto;
- clip: rect(0px, 100px, 100px, 0px);
-}
-
-.oe_group_photo_wide {
height: 100px;
- width: auto;
- clip: rect(0px, 115px, 100px, 15px);
+ clip: rect(0px, 100px, 100px, 0px);
}
.oe_group_details {
diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js
index 2173b4845e1..da6816d3441 100644
--- a/addons/mail/static/src/js/mail.js
+++ b/addons/mail/static/src/js/mail.js
@@ -16,7 +16,7 @@ openerp.mail = function(session) {
session.web.FormView = session.web.FormView.extend({
do_action: function(action, on_close) {
- if (action.res_model == 'mail.compose.message' && this.fields && this.fields.message_ids) {
+ if (action.res_model == 'mail.compose.message' && this.fields && this.fields.message_ids && this.fields.message_ids.view.get("actual_mode") != 'create') {
var record_thread = this.fields.message_ids;
var thread = record_thread.thread;
thread.instantiate_composition_form('comment', true, false, 0, action.context);
@@ -341,7 +341,7 @@ openerp.mail = function(session) {
this._super.apply(this, arguments);
// customize display: add avatar, clean previous content
var user_avatar = mail.ChatterUtils.get_image(this.session.prefix,
- this.session.session_id, 'res.users', 'avatar', this.session.uid);
+ this.session.session_id, 'res.users', 'image_small', this.session.uid);
this.$element.find('img.oe_mail_icon').attr('src', user_avatar);
this.$element.find('div.oe_mail_msg_content').empty();
// create a context for the default_get of the compose form
@@ -742,7 +742,7 @@ openerp.mail = function(session) {
if (record.type == 'email') {
record.mini_url = ('/mail/static/src/img/email_icon.png');
} else {
- record.mini_url = mail.ChatterUtils.get_image(this.session.prefix, this.session.session_id, 'res.users', 'avatar', record.user_id[0]);
+ record.mini_url = mail.ChatterUtils.get_image(this.session.prefix, this.session.session_id, 'res.users', 'image_small', record.user_id[0]);
}
// body text manipulation
if (record.subtype == 'plain') {
@@ -768,7 +768,7 @@ openerp.mail = function(session) {
},
display_current_user: function () {
- var avatar = mail.ChatterUtils.get_image(this.session.prefix, this.session.session_id, 'res.users', 'avatar', this.params.uid);
+ var avatar = mail.ChatterUtils.get_image(this.session.prefix, this.session.session_id, 'res.users', 'image_small', this.params.uid);
return this.$element.find('img.oe_mail_icon').attr('src', avatar);
},
@@ -913,7 +913,7 @@ openerp.mail = function(session) {
this.$element.find('div.oe_mail_recthread_followers h4').html('Followers (' + records.length + ')');
_(records).each(function (record) {
if (record.id == self.session.uid) { self.is_subscriber = true; }
- record.avatar_url = mail.ChatterUtils.get_image(self.session.prefix, self.session.session_id, 'res.users', 'avatar', record.id);
+ record.avatar_url = mail.ChatterUtils.get_image(self.session.prefix, self.session.session_id, 'res.users', 'image_small', record.id);
$(session.web.qweb.render('mail.record_thread.subscriber', {'record': record})).appendTo(user_list);
});
if (self.is_subscriber) {