[REF] mail.group: cleaned code
bzr revid: tde@openerp.com-20120307151027-azhi43u0k086gh0i
This commit is contained in:
parent
89eec3624c
commit
90d29c16b7
|
@ -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',
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -55,13 +55,45 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Group List View !-->
|
||||
<record model="ir.ui.view" id="view_group_tree">
|
||||
<field name="name">mail.group.tree</field>
|
||||
<field name="model">mail.group</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="10"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Groups">
|
||||
<field name="name" colspan="2"/>
|
||||
<field name="responsible_id" colspan="2"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Group Search View !-->
|
||||
<record model="ir.ui.view" id="view_group_search">
|
||||
<field name="name">mail.group.search</field>
|
||||
<field name="model">mail.group</field>
|
||||
<field name="type">search</field>
|
||||
<field name="priority" eval="10"/>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search groups">
|
||||
<field name="name" colspan="2"/>
|
||||
<field name="responsible_id" colspan="2"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- group record !-->
|
||||
<record id="action_view_groups" model="ir.actions.act_window">
|
||||
<field name="name">Groups</field>
|
||||
<field name="res_model">mail.group</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">kanban,tree,form</field>
|
||||
<field name="search_view_id" ref="view_group_search"/>
|
||||
</record>
|
||||
|
||||
<!-- left-side menu: Groups !-->
|
||||
<menuitem id="mail_groups" name="Groups" parent="mail_feeds_main"/>
|
||||
<menuitem id="mail_allgroups" name="All groups" parent="mail_groups" action="action_view_groups"/>
|
||||
</data>
|
||||
</openerp>
|
||||
</openerp>
|
||||
|
|
|
@ -22,9 +22,6 @@
|
|||
<field name="action" ref="action_mail_all_feeds"/>
|
||||
<field name="parent_id" ref="mail_feeds"/>
|
||||
</record>
|
||||
<!-- left-side menu: Groups !-->
|
||||
<menuitem id="mail_groups" name="Groups" parent="mail_feeds_main"/>
|
||||
<menuitem id="mail_allgroups" name="All groups" parent="mail_groups" action="action_view_groups"/>
|
||||
<!-- left-side menu: Tmp !-->
|
||||
<menuitem id="mail_debug" name="Debug/Tmp" parent="mail_feeds_main"/>
|
||||
<menuitem id="mail_debug_msgs" name="Messages" parent="mail_debug" action="action_view_all_message"/>
|
||||
|
|
Loading…
Reference in New Issue