~openerp-dev/openobject-addons/7.0-fix-mail_issues-adh

« back to all changes in this revision

Viewing changes to mail/mail_group.py

  • Committer: Anand Dharampuriya(OpenERP)
  • Date: 2014-06-12 11:57:03 UTC
  • Revision ID: adh@tinyerp.com-20140612115703-91bypoqsilnnj4hm
[FIX] Solve some mail issues which are currently present in 7.0/addons

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
from openerp.osv import osv
25
25
from openerp.osv import fields
26
26
from openerp import SUPERUSER_ID
 
27
from openerp.tools.translate import _
27
28
 
28
29
 
29
30
class mail_group(osv.Model):
46
47
 
47
48
    _columns = {
48
49
        'name': fields.char('Name', size=64, required=True, translate=True),
49
 
        'description': fields.text('Description'),
 
50
        'description': fields.text('Description', translate=True),
50
51
        'menu_id': fields.many2one('ir.ui.menu', string='Related Menu', required=True, ondelete="cascade"),
51
52
        'public': fields.selection([('public', 'Public'), ('private', 'Private'), ('groups', 'Selected Group Only')], 'Privacy', required=True,
52
53
            help='This group is visible by non members. \
172
173
        mail_alias = self.pool.get('mail.alias')
173
174
        alias_ids = [group.alias_id.id for group in groups if group.alias_id]
174
175
        # Delete mail_group
 
176
        if self.pool['ir.model.data'].get_object_reference(cr, uid, 'mail', 'group_all_employees')[1] in ids:
 
177
            raise osv.except_osv(_('Warning!'), _('You cannot delete this group because some other modules are dependent on it')) 
175
178
        res = super(mail_group, self).unlink(cr, uid, ids, context=context)
176
179
        # Delete alias
177
180
        mail_alias.unlink(cr, SUPERUSER_ID, alias_ids, context=context)