[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
This commit is contained in:
committed by
Jérome Maes
parent
8abe6cac4c
commit
17b7a2045f
@@ -39,6 +39,7 @@ For more specific needs, you may also assign custom-defined actions
|
||||
'data/fetchmail_data.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'views/fetchmail_views.xml',
|
||||
'views/mail_mail_views.xml',
|
||||
],
|
||||
'demo': [],
|
||||
'installable': True,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import fetchmail
|
||||
import res_config
|
||||
import mail_mail
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -119,21 +119,5 @@
|
||||
groups="base.group_no_one"
|
||||
/>
|
||||
|
||||
<record model="ir.ui.view" id="email_message_tree_view">
|
||||
<field name="name">mail.mail.form.fetchmail</field>
|
||||
<field name="model">mail.mail</field>
|
||||
<field name="inherit_id" ref="mail.view_mail_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="references" position="after">
|
||||
<field name="fetchmail_server_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window
|
||||
context="{'search_default_server_id': active_id, 'default_fetchmail_server_id': active_id}"
|
||||
id="act_server_history" name="Messages" domain="[('email_from', '!=', False), ('fetchmail_server_id', '=', active_id)]"
|
||||
res_model="mail.mail" src_model="fetchmail.server"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="email_message_tree_view" model="ir.ui.view">
|
||||
<field name="name">mail.mail.form.fetchmail</field>
|
||||
<field name="model">mail.mail</field>
|
||||
<field name="inherit_id" ref="mail.view_mail_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="references" position="after">
|
||||
<field name="fetchmail_server_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window
|
||||
id="act_server_history"
|
||||
name="Messages"
|
||||
res_model="mail.mail"
|
||||
src_model="fetchmail.server"
|
||||
domain="[('email_from', '!=', False), ('fetchmail_server_id', '=', active_id)]"
|
||||
context="{'search_default_server_id': active_id, 'default_fetchmail_server_id': active_id}"/>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user