[FIX] - Some changes to make code consistent with 6.1 style.
parent
fc0cd8a45c
commit
ddbfaca329
|
@ -6,35 +6,34 @@ Created on 16 apr. 2013
|
||||||
|
|
||||||
http://www.therp.nl
|
http://www.therp.nl
|
||||||
'''
|
'''
|
||||||
from openerp.osv import osv
|
from openerp.osv.orm import Model
|
||||||
from openerp.osv import fields
|
from openerp.osv import fields
|
||||||
|
|
||||||
|
|
||||||
class mail_message(osv.osv):
|
class mail_message(Model):
|
||||||
'''Extend mail_message with action_needed flag'''
|
'''Extend mail_message with action_needed flag'''
|
||||||
_inherit = 'mail.message'
|
_inherit = 'mail.message'
|
||||||
|
|
||||||
def set_action_needed_off(self, cr, user, ids, args):
|
def set_action_needed_off(self, cr, user, ids, context=None):
|
||||||
self.write(cr, user, ids, {'action_needed': False})
|
self.write(cr, user, ids, {'action_needed': False}, context=context)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def set_action_needed_on(self, cr, user, ids, args):
|
def set_action_needed_on(self, cr, user, ids, context=None):
|
||||||
self.write(cr, user, ids, {'action_needed': True, })
|
self.write(cr, user, ids, {'action_needed': True}, context=context)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def create(self, cr, user, vals, context=None):
|
def create(self, cr, user, vals, context=None):
|
||||||
# Set newly received messages as needing action, unless an
|
# Set newly received messages as needing action, unless an
|
||||||
# explicit value for action_needed has been passed.
|
# explicit value for action_needed has been passed.
|
||||||
if ((not 'action_needed' in vals)
|
if ((not 'action_needed' in vals)
|
||||||
and ('state' in vals)
|
and ('state' in vals) and (vals['state'] == 'received')):
|
||||||
and (vals['state'] == 'received')):
|
|
||||||
vals['action_needed'] = True
|
vals['action_needed'] = True
|
||||||
mm_id = super(mail_message, self).create(cr, user, vals, context)
|
mm_id = super(mail_message, self).create(
|
||||||
|
cr, user, vals, context=context)
|
||||||
return mm_id
|
return mm_id
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'action_needed': fields.boolean('Action needed',
|
'action_needed': fields.boolean('Action needed',
|
||||||
help='Action needed is True whenever a new mail is received, or'
|
help='Action needed is True whenever a new mail is received, or'
|
||||||
' when a user flags a message as needing attention.'
|
' when a user flags a message as needing attention.'),
|
||||||
),
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue