From 90d29c16b731007fade1deb918b4097934baa5ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 7 Mar 2012 16:10:27 +0100 Subject: [PATCH] [REF] mail.group: cleaned code bzr revid: tde@openerp.com-20120307151027-azhi43u0k086gh0i --- addons/mail/__openerp__.py | 2 +- addons/mail/mail_group.py | 69 ++------------------------------ addons/mail/mail_group_view.xml | 34 +++++++++++++++- addons/mail/mail_thread_view.xml | 3 -- 4 files changed, 37 insertions(+), 71 deletions(-) diff --git a/addons/mail/__openerp__.py b/addons/mail/__openerp__.py index a644caea5e7..9596804b114 100644 --- a/addons/mail/__openerp__.py +++ b/addons/mail/__openerp__.py @@ -58,9 +58,9 @@ The main features are: 'data': [ "wizard/mail_compose_message_view.xml", "mail_message_view.xml", - "mail_group_view.xml", "mail_subscription_view.xml", "mail_thread_view.xml", + "mail_group_view.xml", "res_partner_view.xml", 'security/ir.model.access.csv', 'mail_data.xml', diff --git a/addons/mail/mail_group.py b/addons/mail/mail_group.py index a669f736013..7be931d7e34 100644 --- a/addons/mail/mail_group.py +++ b/addons/mail/mail_group.py @@ -26,13 +26,12 @@ from tools.translate import _ class mail_group(osv.osv): """ - A mail group is a collection of users sharing messages. Mail groups are different from user groups - because they don't have a specific field holding users. Group users are users that follow - the mail group, using the subscription/follow mechanism of Chatter. + A mail_group is a collection of users sharing messages in a discussion group. + Mail groups are different from user groups because they don't have a specific field holding users. + Group users are users that follow the mail group, using the subscription/follow mechanism of OpenChatter. """ _name = 'mail.group' - #_inherits = {'res.groups': 'group_id'} _inherit = ['mail.thread'] def action_group_join(self, cr, uid, ids, context={}): @@ -53,8 +52,6 @@ class mail_group(osv.osv): return True _columns = { - #'group_id': fields.many2one('res.groups', required=True, ondelete='cascade', - #string='Group', help='The group extended by this portal'), 'name': fields.char('Name', size=64, required=True), 'description': fields.text('Description'), 'responsible_id': fields.many2one('res.users', string='Responsible', @@ -65,65 +62,5 @@ class mail_group(osv.osv): _defaults = { 'public': True, } - - - def create(self, cr, uid, values, context=None): - """ extend create() to automatically create a menu for the group """ - if context is None: context = {} - # create group - group_id = super(mail_group, self).create(cr, uid, values, context) - # create menu - #self._create_menu(cr, uid, [group_id], context) - return group_id - - #def _create_menu(self, cr, uid, ids, context=None): - #""" create a menu for the given groups """ - #menu_obj = self.pool.get('ir.ui.menu') - #ir_data = self.pool.get('ir.model.data') - #act_win_obj = self.pool.get('ir.actions.act_window') - #menu_root = self._get_res_xml_id(cr, uid, 'mail', 'mg_groups') - - #for group in self.browse(cr, uid, ids, context): - ## create an ir.action.act_window action - #act_values = { - #'name': '%s' % group.name, - #'res_model': 'mail.message', - #'domain': '["&", ("res_model", "=", "mail.group"), ("res_id", "=", %s)]' % group.id, - #} - #act_id = act_win_obj.create(cr, uid, act_values, context) - ## create a menuitem under 'mail.mg_groups' - #menu_values = { - #'name': _('%s') % group.name, - #'parent_id': menu_root, - #'action': 'ir.actions.act_window,%s' % (act_id), - ##'groups_id': [(6, 0, [group.group_id.id])], - #} - #menu_id = menu_obj.create(cr, uid, menu_values, context) - ## create data - #data_values = { - #'name': '%s' % group.name, - #'model': 'ir.ui.menu', - #'module': 'mail', - #'res_id': menu_id, - #'noupdate': 'True'} - #data_id = ir_data.create(cr, uid, data_values, context) - #return True - - #def _assign_menu(self, cr, uid, ids, context=None): - """ assign groups (ids) menu to the users joigning the groups""" - #user_obj = self.pool.get('res.users') - #for p in self.browse(cr, uid, ids, context): - ## user menu action = portal menu action if set in portal - #if p.menu_action_id: - #user_ids = [u.id for u in p.users if u.id != 1] - #user_values = {'menu_id': p.menu_action_id.id} - #user_obj.write(cr, uid, user_ids, user_values, context) - - #def _get_res_xml_id(self, cr, uid, module, xml_id): - #""" return the resource id associated to the given xml_id """ - #data_obj = self.pool.get('ir.model.data') - #data_id = data_obj._get_id(cr, uid, module, xml_id) - #return data_obj.browse(cr, uid, data_id).res_id - mail_group() diff --git a/addons/mail/mail_group_view.xml b/addons/mail/mail_group_view.xml index 28da6a31be9..741d25c5932 100644 --- a/addons/mail/mail_group_view.xml +++ b/addons/mail/mail_group_view.xml @@ -55,13 +55,45 @@ + + + mail.group.tree + mail.group + tree + + + + + + + + + + + + mail.group.search + mail.group + search + + + + + + + + + Groups mail.group form kanban,tree,form + + + + - \ No newline at end of file + diff --git a/addons/mail/mail_thread_view.xml b/addons/mail/mail_thread_view.xml index a71ae040328..db180baa2cb 100644 --- a/addons/mail/mail_thread_view.xml +++ b/addons/mail/mail_thread_view.xml @@ -22,9 +22,6 @@ - - -