diff --git a/addons/mail/mail_group.py b/addons/mail/mail_group.py
index 55587850872..6340504ccff 100644
--- a/addons/mail/mail_group.py
+++ b/addons/mail/mail_group.py
@@ -32,8 +32,9 @@ class mail_group(osv.osv):
"""
_name = 'mail.group'
- _inherits = {'res.groups': 'group_id'}
-
+ #_inherits = {'res.groups': 'group_id'}
+ _inherit = ['mail.thread']
+
def action_group_join(self, cr, uid, ids, context={}):
sub_obj = self.pool.get('mail.subscription')
menu_values = {'res_model': 'mail.group', 'user_id': uid}
@@ -49,10 +50,9 @@ 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),
+ #'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',
ondelete='set null', required=True),
@@ -93,14 +93,14 @@ class mail_group(osv.osv):
'name': _('%s') % group.name,
'parent_id': menu_root,
'action': 'ir.actions.act_window,%s' % (act_id),
- 'groups_id': [(6, 0, [group.group_id.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,
+ 'name': '%s' % group.name,
'model': 'ir.ui.menu',
- 'module': 'portal',
+ 'module': 'mail',
'res_id': menu_id,
'noupdate': 'True'}
data_id = ir_data.create(cr, uid, data_values, context)
@@ -108,13 +108,13 @@ class mail_group(osv.osv):
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)
+ #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 """
diff --git a/addons/mail/mail_group_view.xml b/addons/mail/mail_group_view.xml
index ee92758d5f9..fe7cb183b9f 100644
--- a/addons/mail/mail_group_view.xml
+++ b/addons/mail/mail_group_view.xml
@@ -33,6 +33,8 @@
+
+
@@ -142,32 +144,24 @@
[('user_id', '=', uid)]
-
- Subscriptions
- mail.subscription
- form
- tree,form
-
-
-
-
+
-
+
+
+
-
+
-
-
-
+
-
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py
index 23c131ec66b..c1e8f7aa098 100644
--- a/addons/mail/mail_thread.py
+++ b/addons/mail/mail_thread.py
@@ -82,7 +82,7 @@ class mail_thread(osv.osv):
})
return super(mail_thread, self).copy(cr, uid, id, default, context=context)
- def message_append(self, cr, uid, threads, subject, body_text=None, email_to=False,
+ def message_append(self, cr, uid, threads, subject, body_text=None, type='email', email_to=False,
email_from=False, email_cc=None, email_bcc=None, reply_to=None,
email_date=None, message_id=False, references=None,
attachments=None, body_html=None, subtype=None, headers=None,
@@ -166,7 +166,8 @@ class mail_thread(osv.osv):
'message_id': message_id,
'body_text': body_text or (hasattr(thread, 'description') and thread.description or False),
'attachment_ids': [(6, 0, to_attach)],
- 'state' : 'received',
+ 'state': 'received',
+ 'type': type,
}
if email_from:
@@ -215,9 +216,12 @@ class mail_thread(osv.osv):
to determine the model of the thread to
update (instead of the current model).
"""
+ # 6.2 Social feature: add default email type for old API
+ if not 'type' in msg_dict: msg_dict['type'] = 'email'
return self.message_append(cr, uid, ids,
subject = msg_dict.get('subject'),
body_text = msg_dict.get('body_text'),
+ type = msg_dict.get('type'),
email_to = msg_dict.get('to'),
email_from = msg_dict.get('from'),
email_cc = msg_dict.get('cc'),
@@ -235,8 +239,15 @@ class mail_thread(osv.osv):
context = context)
# Message loading
- def message_load(self):
- pass
+ def message_load(self, cr, uid, ids, context=None):
+ """ Social feature added this method
+ loading message: search in mail.messages where res_id = ids, (res_)model = current model """
+ msg_obj = self.pool.get('mail.message')
+ msg_ids = []
+ for id in ids:
+ msg_ids += msg_obj.search(cr, uid, ['&', ('res_id', '=', id), ('model', '=', self._name)], context=context)
+ msgs = msg_obj.browse(cr, uid, ids)
+ return msgs
#------------------------------------------------------
# Email specific
@@ -484,8 +495,8 @@ class mail_thread(osv.osv):
#------------------------------------------------------
# Note specific
#------------------------------------------------------
- def message_append_note(self, context, type='notification'):
- pass
+ def message_append_note(self, cr, uid, ids, subject, body, type='notification', context=None):
+ return self.message_append(cr, uid, ids, subject, body_text=body, type=type, context=context)
#------------------------------------------------------
# Subscription mechanism