diff --git a/addons/mail/mail_group_view.xml b/addons/mail/mail_group_view.xml
index 48cfe735abc..d205caf87d1 100644
--- a/addons/mail/mail_group_view.xml
+++ b/addons/mail/mail_group_view.xml
@@ -110,7 +110,8 @@
string="Unfollow" icon="gtk-go-forward" colspan="2"/>
-
+
+
diff --git a/addons/mail/mail_subscription.py b/addons/mail/mail_subscription.py
index 64125a44e11..e56a8e5a192 100644
--- a/addons/mail/mail_subscription.py
+++ b/addons/mail/mail_subscription.py
@@ -36,27 +36,25 @@ class mail_subscription(osv.osv):
_name = 'mail.subscription'
_rec_name = 'id'
_columns = {
- 'res_model': fields.char('Related Document model', size=128, select=1),
+ 'res_model': fields.char('Related Document Model', size=128, select=1, required=True),
'res_id': fields.integer('Related Document ID', select=1),
#'res_domain': fields.char('res_domain', size=256),
- 'user_id': fields.integer('Related User ID', select=1),
+ 'user_id': fields.integer('Related User ID', select=1, required=True),
}
-
_defaults = {
}
-
mail_subscription()
class mail_notification(osv.osv):
"""
TODO
"""
-
_name = 'mail.notification'
_rec_name = 'id'
+ _log_access = False
_columns = {
'user_id': fields.many2one('res.users', string='User',
- ondelete='cascade', required=True),
+ ondelete='cascade', required=True, select=1),
'message_id': fields.many2one('mail.message', string='Message',
ondelete='cascade', required=True),
'read': fields.boolean('Read'),
diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py
index 88cb78380a7..a23d8292b31 100644
--- a/addons/mail/mail_thread.py
+++ b/addons/mail/mail_thread.py
@@ -58,7 +58,7 @@ class mail_thread(osv.osv):
res = {}
for thread in self.browse(cr, uid, ids, context=context):
records = self.message_load(cr, uid, [thread.id], context=context)
- res[thread.id] = [obj.id for obj in records]
+ res[thread.id] = [obj['id'] for obj in records]
return res
# TODO remove this and copy method, this will be replaced by message_load
@@ -255,8 +255,14 @@ class mail_thread(osv.osv):
msg_obj = self.pool.get('mail.message')
msg_ids = []
for id in ids:
+ print id
+ print self._name
+ print context
msg_ids += msg_obj.search(cr, uid, ['&', ('res_id', '=', id), ('model', '=', self._name)], context=context)
- msgs = msg_obj.browse(cr, uid, msg_ids)
+ print msg_ids
+ #msgs = msg_obj.browse(cr, uid, msg_ids)
+ msgs = msg_obj.read(cr, uid, msg_ids, context=context)
+ print msgs
return msgs
#------------------------------------------------------
diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js
index cd2391642ef..9073313f980 100644
--- a/addons/mail/static/src/js/mail.js
+++ b/addons/mail/static/src/js/mail.js
@@ -2,34 +2,47 @@ openerp.mail = function(session) {
var mail = session.mail = {};
- mail.Wall = session.web.Widget.extend({
- init: function(parent) {
- },
- start: function() {
-// this.$element
- },
- });
-
- mail.ThreadView = session.web.Widget.extend({
+ session.web.form.widgets.add(
+ 'ThreadView', 'openerp.mail.ThreadView');
+
+ /* ThreadView Widget: thread of comments */
+ mail.ThreadView = session.web.form.Field.extend({
+ // QWeb template to use when rendering the object
template: 'MailTest',
+ // autogenerated id prefix, specificity helps when debugging
+// identifier_prefix: 'my-id-prefix-',
- init: function(parent) {
- this._super(parent);
- }
-
- start: function() {
-// this.$element
+ init: function() {
+ this.timeout;
+ this._super.apply(this, arguments);
+ this.ds = new session.web.DataSet(this, this.view.model);
},
+ stop: function () {
+ clearTimeout(this.timeout);
+ this._super();
+ },
+
+ set_value: function() {
+ this._super.apply(this, arguments);
+ if (! this.view.datarecord.id) { return; }
+ return this.fetch_messages();
+ },
+
+ fetch_messages: function () {
+ return this.ds.call('message_load', [[this.view.datarecord.id]]).then(
+ this.proxy('display_records'));
+ },
+
+ display_records: function (records) {
+ // this.$element.empty();
+ var self = this;
+ _(records).each(function (record) {
+ $('
').text(record.body_text).appendTo(self.$element);
+ });
+ this.timeout = setTimeout(this.proxy('fetch_messages'), 5000);
+ }
});
- mail.MessgageInput = session.web.Widget.extend({
- });
-
-
-// var tv = new mail.ThreadView(this);
-// tv.appendTo($("td.oe_form_field_mail.ThreadView"));
-// tv.appendTo($("body"));
-
};
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml
index 005b4b23a79..c5c1b64cbd2 100644
--- a/addons/mail/static/src/xml/mail.xml
+++ b/addons/mail/static/src/xml/mail.xml
@@ -1,11 +1,9 @@
-
-
-
+
+ vdvgfxdfxdfv
+