diff options
| author | Olivier Dony <odo@openerp.com> | 2011-10-13 19:03:27 +0200 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2011-10-13 19:03:27 +0200 |
| commit | 3bffe65b2ca8bc50ece644e7947ad2bbd5c9341a (patch) | |
| tree | b307874680dbdce7b2f5109b7b696ea38e679e20 /addons/fetchmail | |
| parent | a93ca01b5b1365f92e191e3c429ef655e751b455 (diff) | |
| parent | 8a7c61cb96a541a9aaca51ffe3ee903407b26360 (diff) | |
[MERGE] sync with latest trunk
bzr revid: odo@openerp.com-20111013170327-9rvfdkbgj01hdgxb
Diffstat (limited to 'addons/fetchmail')
| -rw-r--r-- | addons/fetchmail/__openerp__.py | 4 | ||||
| -rw-r--r-- | addons/fetchmail/fetchmail.py | 62 | ||||
| -rw-r--r-- | addons/fetchmail/fetchmail_installer_view.xml | 25 | ||||
| -rw-r--r-- | addons/fetchmail/fetchmail_view.xml | 46 | ||||
| -rw-r--r-- | addons/fetchmail/i18n/et.po | 305 |
5 files changed, 380 insertions, 62 deletions
diff --git a/addons/fetchmail/__openerp__.py b/addons/fetchmail/__openerp__.py index 986c3bc12a1..ae082aacacd 100644 --- a/addons/fetchmail/__openerp__.py +++ b/addons/fetchmail/__openerp__.py @@ -21,11 +21,11 @@ ############################################################################## { - "name" : "Automated Email Retriever", + "name" : "Fetch Emails", "version" : "1.0", "depends" : ["base", 'mail'], "author" : "OpenERP SA", - "category": 'Tools', + "category": 'Customer Relationship Management', "description": """ Retrieve incoming email on POP / IMAP servers ============================================= diff --git a/addons/fetchmail/fetchmail.py b/addons/fetchmail/fetchmail.py index f45b5e955a0..d1e23f49166 100644 --- a/addons/fetchmail/fetchmail.py +++ b/addons/fetchmail/fetchmail.py @@ -25,6 +25,14 @@ from imaplib import IMAP4 from imaplib import IMAP4_SSL from poplib import POP3 from poplib import POP3_SSL +try: + import cStringIO as StringIO +except ImportError: + import StringIO + +import zipfile +import base64 +import addons import netsvc from osv import osv, fields @@ -46,11 +54,12 @@ class fetchmail_server(osv.osv): ('draft', 'Not Confirmed'), ('done', 'Confirmed'), ], 'State', select=True, readonly=True), - 'server' : fields.char('Server Name', size=256, required=True, readonly=True, help="Hostname or IP of the mail server", states={'draft':[('readonly', False)]}), - 'port' : fields.integer('Port', required=True, readonly=True, states={'draft':[('readonly', False)]}), + 'server' : fields.char('Server Name', size=256, readonly=True, help="Hostname or IP of the mail server", states={'draft':[('readonly', False)]}), + 'port' : fields.integer('Port', readonly=True, states={'draft':[('readonly', False)]}), 'type':fields.selection([ ('pop', 'POP Server'), ('imap', 'IMAP Server'), + ('local', 'Local Server'), ], 'Server Type', select=True, required=True, readonly=False), 'is_ssl':fields.boolean('SSL/TLS', help="Connections are encrypted with SSL/TLS through a dedicated port (default: IMAPS=993, POP3S=995)"), 'attach':fields.boolean('Keep Attachments', help="Whether attachments should be downloaded. " @@ -58,49 +67,56 @@ class fetchmail_server(osv.osv): 'original':fields.boolean('Keep Original', help="Whether a full original copy of each email should be kept for reference" "and attached to each processed message. This will usually double the size of your message database."), 'date': fields.datetime('Last Fetch Date', readonly=True), - 'user' : fields.char('Username', size=256, required=True, readonly=True, states={'draft':[('readonly', False)]}), - 'password' : fields.char('Password', size=1024, required=True, readonly=True, states={'draft':[('readonly', False)]}), - 'note': fields.text('Description'), + 'user' : fields.char('Username', size=256, readonly=True, states={'draft':[('readonly', False)]}), + 'password' : fields.char('Password', size=1024, readonly=True, states={'draft':[('readonly', False)]}), 'action_id':fields.many2one('ir.actions.server', 'Server Action', help="Optional custom server action to trigger for each incoming mail, " "on the record that was created or updated by this mail"), - 'object_id': fields.many2one('ir.model', "Target document type", required=True, help="Process each incoming mail as part of a conversation " + 'object_id': fields.many2one('ir.model', "Create a New Record", required=True, help="Process each incoming mail as part of a conversation " "corresponding to this document type. This will create " "new documents for new conversations, or attach follow-up " "emails to the existing conversations (documents)."), 'priority': fields.integer('Server Priority', readonly=True, states={'draft':[('readonly', False)]}, help="Defines the order of processing, " "lower values mean higher priority"), 'message_ids': fields.one2many('mail.message', 'fetchmail_server_id', 'Messages', readonly=True), + 'configuration' : fields.text('Configuration'), + 'script' : fields.char('Script', readonly=True, size=64), } _defaults = { 'state': "draft", + 'type': "pop", 'active': True, 'priority': 5, 'attach': True, + 'script': '/mail/static/scripts/openerp_mailgate.py', } - def default_get(self, cr, uid, fields, context=None): - if context is None: - context = {} - - result = super(fetchmail_server, self).default_get(cr, uid, fields, context=context) - - model = context.pop('fetchmail_model', False) or False - if isinstance(model, basestring): - model_id = self.pool.get('ir.model').search(cr, uid, [('model', '=', model)], context=context) - result.update( - object_id = model_id[0], - ) - - return result - - def onchange_server_type(self, cr, uid, ids, server_type=False, ssl=False): + def onchange_server_type(self, cr, uid, ids, server_type=False, ssl=False, object_id=False): port = 0 + values = {} if server_type == 'pop': port = ssl and 995 or 110 elif server_type == 'imap': port = ssl and 993 or 143 - return {'value':{'port':port}} + else: + values['server'] = '' + values['port'] = port + + conf = { + 'dbname' : cr.dbname, + 'uid' : uid, + 'model' : 'MODELNAME', + } + if object_id: + m = self.pool.get('ir.model') + r = m.read(cr,uid,[object_id],['model']) + conf['model']=r[0]['model'] + values['configuration'] = """Use the below script with the following command line options with your Mail Transport Agent (MTA) + +openerp_mailgate.py -u %(uid)d -p PASSWORD -o %(model)s -d %(dbname)s --host=HOSTNAME --port=PORT +""" % conf + + return {'value':values} def set_draft(self, cr, uid, ids, context=None): self.write(cr, uid, ids , {'state':'draft'}) diff --git a/addons/fetchmail/fetchmail_installer_view.xml b/addons/fetchmail/fetchmail_installer_view.xml index 911ad8101da..b5bd7df80ca 100644 --- a/addons/fetchmail/fetchmail_installer_view.xml +++ b/addons/fetchmail/fetchmail_installer_view.xml @@ -1,18 +1,19 @@ <openerp> <data> - <record model="ir.actions.act_window" id="view_email_server_form_installer"> - <field name="name">Setup Incoming Mail Server (fetchmail)</field> - <field name="type">ir.actions.act_window</field> - <field name="res_model">fetchmail.server</field> - <field name="view_type">form</field> - <field name="view_mode">tree,form</field> - <field name="view_id" ref="fetchmail.view_email_server_form"/> - </record> + <record model="ir.actions.act_window" id="view_email_server_form_installer"> + <field name="name">Setup Incoming Mail Servers</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">fetchmail.server</field> + <field name="view_type">form</field> + <field name="view_mode">tree,form</field> + <field name="view_id" eval="False"/> + <field name="help">You can connect OpenERP to your incoming mail server so that documents (leads, tasks, issues, etc) are synchronized automatically with your incoming emails.</field> + </record> - <record id="view_email_server_form_installer_todo" model="ir.actions.todo"> - <field name="action_id" ref="view_email_server_form_installer"/> - <field name="category_id" ref="base.category_sales_management_config"/> - <field name="sequence">4</field> + <record id="view_email_server_form_installer_todo" model="ir.actions.todo"> + <field name="action_id" ref="view_email_server_form_installer"/> + <field name="category_id" ref="base.category_sales_management_config"/> + <field name="sequence">4</field> </record> </data> </openerp> diff --git a/addons/fetchmail/fetchmail_view.xml b/addons/fetchmail/fetchmail_view.xml index 05f62f4b9fb..4cd182c0818 100644 --- a/addons/fetchmail/fetchmail_view.xml +++ b/addons/fetchmail/fetchmail_view.xml @@ -25,44 +25,47 @@ <field name="type">form</field> <field name="arch" type="xml"> <form string="Incoming Mail Server"> - <group col="6" colspan="4"> - <field name="name" select="1" colspan="4"/> - <field name="type" select="1" on_change="onchange_server_type(type, is_ssl)"/> + <group colspan="4" col="6"> + <field name="name" select="1"/> + <field name="type" select="1" on_change="onchange_server_type(type, is_ssl, object_id)"/> <field name="date" select="1"/> </group> <notebook colspan="4"> <page string="Server & Login"> - <group col="4" colspan="2"> + <group col="4" colspan="2" attrs="{'invisible' : [('type', '=', 'local')]}"> <separator string="Server Information" colspan="2"/> - <field name="server" colspan="4"/> - <field name="port" /> + <field name="server" colspan="4" attrs="{'required' : [('type', '!=', 'local')]}" /> + <field name="port" required="1" attrs="{'required' : [('type', '!=', 'local')]}" /> <field name="is_ssl" select="1" on_change="onchange_server_type(type, is_ssl)"/> </group> - <group col="2" colspan="2"> + <group col="2" colspan="2" attrs="{'invisible' : [('type', '=', 'local')]}"> <separator string="Login Information" colspan="2"/> - <field name="user" /> - <field name="password" password="True" /> + <field name="user" attrs="{'required' : [('type', '!=', 'local')]}"/> + <field name="password" password="True" attrs="{'required' : [('type', '!=', 'local')]}"/> </group> <group col="2" colspan="2"> - <separator string="Automated Processing" colspan="2"/> - <field name="object_id"/> - <field name="action_id"/> + <separator string="Actions to Perform on Incoming Mails" colspan="2"/> + <field name="object_id" on_change="onchange_server_type(type, is_ssl, object_id)"/> + <field name="action_id" groups="base.group_extended"/> + </group> + <group attrs="{'invisible' : [('type', '!=', 'local')]}" colspan="4" col="4"> + <separator string="Configuration" colspan="4"/> + <field name="configuration" colspan="4"/> + <field name="script" colspan="4" widget="url"/> </group> - <separator string="Description" colspan="4"/> - <field name="note" colspan="4" nolabel="1"/> </page> - <page string="Advanced"> + <page string="Advanced" groups="base.group_extended"> <group colspan="2" col="2"> <separator string="Advanced options" colspan="2"/> - <field name="priority"/> + <field name="priority" groups="base.group_extended"/> <field name="attach"/> <field name="original"/> <field name="active" select="1"/> </group> </page> </notebook> - <group col="6" colspan="4"> - <field name="state" select="1"/> + <group colspan="4" col="6" attrs="{'invisible' : [('type', '=', 'local')]}"> + <field name="state"/> <button string="Reset Confirmation" type="object" name="set_draft" icon="gtk-convert" states="done"/> <button string="Test & Confirm" type="object" name="button_confirm_login" states="draft" icon="gtk-apply"/> <button string="Fetch Now" type="object" name="fetch_mail" states="done" icon="gtk-network"/> @@ -83,13 +86,6 @@ <filter string="SSL" icon="terp-camera_test" domain="[('is_ssl','=',True)]" help="If SSL required."/> <separator orientation="vertical"/> <field name="name"/> - <field name="object_id"/> - <newline/> - <group expand="0" string="Group By..." groups="base.group_extended"> - <filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type'}"/> - <separator orientation="vertical"/> - <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/> - </group> </search> </field> </record> diff --git a/addons/fetchmail/i18n/et.po b/addons/fetchmail/i18n/et.po new file mode 100644 index 00000000000..24cc08e4b50 --- /dev/null +++ b/addons/fetchmail/i18n/et.po @@ -0,0 +1,305 @@ +# Estonian translation for openobject-addons +# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 +# This file is distributed under the same license as the openobject-addons package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: openobject-addons\n" +"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" +"POT-Creation-Date: 2011-01-11 11:15+0000\n" +"PO-Revision-Date: 2011-10-11 18:02+0000\n" +"Last-Translator: Aare Vesi <Unknown>\n" +"Language-Team: Estonian <et@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2011-10-12 04:40+0000\n" +"X-Generator: Launchpad (build 14124)\n" + +#. module: fetchmail +#: constraint:email.server:0 +msgid "" +"Warning! Record for selected Model can not be created\n" +"Please choose valid Model" +msgstr "" + +#. module: fetchmail +#: selection:email.server,state:0 +msgid "Confirmed" +msgstr "Kinnitatud" + +#. module: fetchmail +#: view:email.server:0 +msgid "Confirm" +msgstr "Kinnita" + +#. module: fetchmail +#: view:email.server:0 +msgid "Group By..." +msgstr "Grupeeri..." + +#. module: fetchmail +#: view:email.server:0 +#: field:email.server,state:0 +msgid "State" +msgstr "Olek" + +#. module: fetchmail +#: view:email.server:0 +msgid "POP" +msgstr "POP" + +#. module: fetchmail +#: selection:email.server,state:0 +msgid "Not Confirmed" +msgstr "Kinnitamata" + +#. module: fetchmail +#: field:email.server,user:0 +msgid "User Name" +msgstr "Kasutajanimi" + +#. module: fetchmail +#: view:email.server:0 +msgid "Type" +msgstr "Tüüp" + +#. module: fetchmail +#: view:email.server:0 +msgid "POP/IMAP Servers" +msgstr "POP/IMAP serverid" + +#. module: fetchmail +#: model:ir.module.module,shortdesc:fetchmail.module_meta_information +msgid "Fetchmail Server" +msgstr "Fetchmail server" + +#. module: fetchmail +#: view:email.server:0 +#: field:email.server,note:0 +msgid "Description" +msgstr "Kirjeldus" + +#. module: fetchmail +#: help:email.server,object_id:0 +msgid "" +"OpenObject Model. Generates a record of this model.\n" +"Select Object with message_new attrbutes." +msgstr "" + +#. module: fetchmail +#: field:email.server,attach:0 +msgid "Add Attachments ?" +msgstr "" + +#. module: fetchmail +#: view:email.server:0 +msgid "# of emails" +msgstr "" + +#. module: fetchmail +#: model:ir.actions.act_window,name:fetchmail.act_server_history +msgid "Email History" +msgstr "" + +#. module: fetchmail +#: field:email.server,user_id:0 +msgid "User" +msgstr "Kasutaja" + +#. module: fetchmail +#: field:email.server,date:0 +msgid "Date" +msgstr "Kuupäev" + +#. module: fetchmail +#: selection:email.server,state:0 +msgid "Waiting for Verification" +msgstr "" + +#. module: fetchmail +#: field:email.server,password:0 +msgid "Password" +msgstr "Salasõna" + +#. module: fetchmail +#: model:ir.actions.act_window,name:fetchmail.act_server_history +#: view:mailgate.message:0 +msgid "Emails" +msgstr "E-kirjad" + +#. module: fetchmail +#: view:email.server:0 +msgid "Search Email Servers" +msgstr "" + +#. module: fetchmail +#: view:email.server:0 +msgid "Server & Login" +msgstr "" + +#. module: fetchmail +#: view:email.server:0 +msgid "Auto Reply?" +msgstr "Automaatvastus" + +#. module: fetchmail +#: field:email.server,name:0 +msgid "Name" +msgstr "Nimi" + +#. module: fetchmail +#: model:ir.model,name:fetchmail.model_mailgate_message +msgid "Mailgateway Message" +msgstr "" + +#. module: fetchmail +#: model:ir.actions.act_window,name:fetchmail.action_email_server_tree +msgid "POP Servers" +msgstr "POP serverid" + +#. module: fetchmail +#: view:email.server:0 +msgid "Set to Draft" +msgstr "Määra mustandiks" + +#. module: fetchmail +#: field:email.server,message_ids:0 +#: model:ir.actions.act_window,name:fetchmail.action_view_mail_message_emails +msgid "Messages" +msgstr "Sõnumid" + +#. module: fetchmail +#: model:ir.ui.menu,name:fetchmail.menu_action_fetchmail_server_tree +msgid "Fetchmail Services" +msgstr "Fetchmail teenused" + +#. module: fetchmail +#: field:email.server,server:0 +msgid "Server" +msgstr "Server" + +#. module: fetchmail +#: field:email.server,active:0 +msgid "Active" +msgstr "Aktiivne" + +#. module: fetchmail +#: view:email.server:0 +msgid "Process Parameter" +msgstr "" + +#. module: fetchmail +#: field:email.server,is_ssl:0 +msgid "SSL ?" +msgstr "SSL ?" + +#. module: fetchmail +#: selection:email.server,type:0 +#: selection:mailgate.message,server_type:0 +msgid "IMAP Server" +msgstr "IMAP server" + +#. module: fetchmail +#: field:email.server,object_id:0 +msgid "Model" +msgstr "Mudel" + +#. module: fetchmail +#: view:email.server:0 +msgid "IMAP" +msgstr "IMAP" + +#. module: fetchmail +#: view:email.server:0 +#: model:ir.model,name:fetchmail.model_email_server +msgid "POP/IMAP Server" +msgstr "POP/IMAP server" + +#. module: fetchmail +#: constraint:email.server:0 +msgid "Warning! Can't have duplicate server configuration!" +msgstr "" + +#. module: fetchmail +#: field:email.server,type:0 +#: field:mailgate.message,server_type:0 +msgid "Server Type" +msgstr "Serveri tüüp" + +#. module: fetchmail +#: view:email.server:0 +msgid "Login Information" +msgstr "Sisselogimise info" + +#. module: fetchmail +#: view:email.server:0 +msgid "Server Information" +msgstr "Serveri info" + +#. module: fetchmail +#: help:email.server,attach:0 +msgid "Fetches mail with attachments if true." +msgstr "" + +#. module: fetchmail +#: selection:email.server,type:0 +#: selection:mailgate.message,server_type:0 +msgid "POP Server" +msgstr "POP server" + +#. module: fetchmail +#: field:email.server,port:0 +msgid "Port" +msgstr "Port" + +#. module: fetchmail +#: model:ir.module.module,description:fetchmail.module_meta_information +msgid "" +"Fetchmail: \n" +" * Fetch email from Pop / IMAP server\n" +" * Support SSL\n" +" * Integrated with all Modules\n" +" * Automatic Email Receive\n" +" * Email based Records (Add, Update)\n" +" " +msgstr "" + +#. module: fetchmail +#: view:email.server:0 +msgid "SSL" +msgstr "SSL" + +#. module: fetchmail +#: help:email.server,action_id:0 +msgid "" +"An Email Server Action. It will be run whenever an e-mail is fetched from " +"server." +msgstr "" + +#. module: fetchmail +#: help:email.server,priority:0 +msgid "Priority between 0 to 10, select define the order of Processing" +msgstr "" + +#. module: fetchmail +#: field:email.server,action_id:0 +msgid "Email Server Action" +msgstr "" + +#. module: fetchmail +#: field:email.server,priority:0 +msgid "Server Priority" +msgstr "" + +#. module: fetchmail +#: view:mailgate.message:0 +#: field:mailgate.message,server_id:0 +msgid "Mail Server" +msgstr "" + +#. module: fetchmail +#: view:email.server:0 +msgid "Fetch Emails" +msgstr "" |
