[BUG-FIX] lp:680704
bzr revid: jam@tinyerp.com-20101207061150-swi023vg3fvb63y2
This commit is contained in:
parent
241da980f9
commit
42d6b54c2d
|
@ -57,9 +57,8 @@ class email_server(osv.osv):
|
|||
'user' : fields.char('User Name', size=256, required=True, readonly=True, states={'draft':[('readonly', False)]}),
|
||||
'password' : fields.char('Password', size=1024, invisible=True, required=True, readonly=True, states={'draft':[('readonly', False)]}),
|
||||
'note': fields.text('Description'),
|
||||
'action_id':fields.many2one('ir.actions.server', 'Reply Email', required=False, domain="[('state','=','email')]",
|
||||
help="An Email Server Action. It will be run whenever an e-mail is fetched from server."),
|
||||
'object_id': fields.many2one('ir.model', "Model", required=True, help="OpenObject Model. Generates a record of this model."),
|
||||
'action_id':fields.many2one('ir.actions.server', 'Email Server Action', required=False, domain="[('state','=','email')]", help="An Email Server Action. It will be run whenever an e-mail is fetched from server."),
|
||||
'object_id': fields.many2one('ir.model', "Model", required=True, help="OpenObject Model. Generates a record of this model.\nSelect Object with message_new attrbutes."),
|
||||
'priority': fields.integer('Server Priority', readonly=True, states={'draft':[('readonly', False)]}, help="Priority between 0 to 10, select define the order of Processing"),
|
||||
'user_id':fields.many2one('res.users', 'User', required=False),
|
||||
'message_ids': fields.one2many('mailgate.message', 'server_id', 'Messages', readonly=True),
|
||||
|
@ -82,8 +81,19 @@ class email_server(osv.osv):
|
|||
return False
|
||||
return True
|
||||
|
||||
def check_model(self, cr, uid, ids, context = None):
|
||||
if not context:
|
||||
context = {}
|
||||
current_rec = self.read(cr, uid, ids, context)[0]
|
||||
if current_rec:
|
||||
model = self.pool.get(current_rec.get('object_id')[1])
|
||||
if hasattr(model, 'message_new'):
|
||||
return True
|
||||
return False
|
||||
|
||||
_constraints = [
|
||||
(check_duplicate, 'Warning! Can\'t have duplicate server configuration!', ['user', 'password'])
|
||||
(check_duplicate, 'Warning! Can\'t have duplicate server configuration!', ['user', 'password']),
|
||||
(check_model, 'Warning! Record for slected Model can not be created\nPlease choose valid Model', ['object_id'])
|
||||
]
|
||||
|
||||
def onchange_server_type(self, cr, uid, ids, server_type=False, ssl=False):
|
||||
|
|
Loading…
Reference in New Issue