diff options
| author | Keyur Gajjar <kga@odoo.com> | 2015-08-13 12:26:04 +0530 |
|---|---|---|
| committer | Jérome Maes <jem@openerp.com> | 2016-04-14 13:23:16 +0200 |
| commit | 17b7a2045f401d7ee8fb99361864dc992fff6bcc (patch) | |
| tree | 914dc0b6627959d111ba7fc872a613e47014a7ef /addons/fetchmail/models | |
| parent | 8abe6cac4c0b9799223239f9d6a8cee953ca3d8a (diff) | |
[MOV] fetchmail: splitted models and views through spearated files
- splitted the models/mail_mail.py from models/fetchmail.py.
- splitted the views/mail_mail_views.xml from views/fetchmail_views.xml
Diffstat (limited to 'addons/fetchmail/models')
| -rw-r--r-- | addons/fetchmail/models/__init__.py | 1 | ||||
| -rw-r--r-- | addons/fetchmail/models/fetchmail.py | 27 | ||||
| -rw-r--r-- | addons/fetchmail/models/mail_mail.py | 29 |
3 files changed, 30 insertions, 27 deletions
diff --git a/addons/fetchmail/models/__init__.py b/addons/fetchmail/models/__init__.py index d25bd214b77..b09bd3023dd 100644 --- a/addons/fetchmail/models/__init__.py +++ b/addons/fetchmail/models/__init__.py @@ -1,3 +1,4 @@ # -*- coding: utf-8 -*- import fetchmail import res_config +import mail_mail diff --git a/addons/fetchmail/models/fetchmail.py b/addons/fetchmail/models/fetchmail.py index 203c3ee1fbc..b21ee4a9a7e 100644 --- a/addons/fetchmail/models/fetchmail.py +++ b/addons/fetchmail/models/fetchmail.py @@ -270,30 +270,3 @@ openerp_mailgate: "|/path/to/openerp-mailgate.py --host=localhost -u %(uid)d -p res = super(fetchmail_server, self).unlink(cr, uid, ids, context=context) self._update_cron(cr, uid, context=context) return res - -class mail_mail(osv.osv): - _inherit = "mail.mail" - _columns = { - 'fetchmail_server_id': fields.many2one('fetchmail.server', "Inbound Mail Server", - readonly=True, - select=True, - oldname='server_id'), - } - - def create(self, cr, uid, values, context=None): - if context is None: - context = {} - fetchmail_server_id = context.get('fetchmail_server_id') - if fetchmail_server_id: - values['fetchmail_server_id'] = fetchmail_server_id - res = super(mail_mail, self).create(cr, uid, values, context=context) - return res - - def write(self, cr, uid, ids, values, context=None): - if context is None: - context = {} - fetchmail_server_id = context.get('fetchmail_server_id') - if fetchmail_server_id: - values['fetchmail_server_id'] = fetchmail_server_id - res = super(mail_mail, self).write(cr, uid, ids, values, context=context) - return res diff --git a/addons/fetchmail/models/mail_mail.py b/addons/fetchmail/models/mail_mail.py new file mode 100644 index 00000000000..57c5fca4561 --- /dev/null +++ b/addons/fetchmail/models/mail_mail.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +from openerp.osv import fields, osv + +class mail_mail(osv.osv): + _inherit = "mail.mail" + _columns = { + 'fetchmail_server_id': fields.many2one('fetchmail.server', "Inbound Mail Server", + readonly=True, + select=True, + oldname='server_id'), + } + + def create(self, cr, uid, values, context=None): + if context is None: + context = {} + fetchmail_server_id = context.get('fetchmail_server_id') + if fetchmail_server_id: + values['fetchmail_server_id'] = fetchmail_server_id + res = super(mail_mail, self).create(cr, uid, values, context=context) + return res + + def write(self, cr, uid, ids, values, context=None): + if context is None: + context = {} + fetchmail_server_id = context.get('fetchmail_server_id') + if fetchmail_server_id: + values['fetchmail_server_id'] = fetchmail_server_id + res = super(mail_mail, self).write(cr, uid, ids, values, context=context) + return res |
