From 471f5f4ce8bc593872216487db5e518968befd0d Mon Sep 17 00:00:00 2001 From: x620 Date: Mon, 28 Mar 2016 15:45:51 +0500 Subject: [PATCH] Show smart buttons and calculate mails count. notified_partner_ids was removed in 9.0, so it changed to partner_ids. --- res_partner_mails_count/models.py | 2 +- res_partner_mails_count/static/src/js/main.js | 26 ++++++++++++------- res_partner_mails_count/templates.xml | 22 ++++------------ .../views/res_partner_mails_count.xml | 16 +++++++++++- 4 files changed, 37 insertions(+), 29 deletions(-) diff --git a/res_partner_mails_count/models.py b/res_partner_mails_count/models.py index 0ca91e6..dcd036a 100644 --- a/res_partner_mails_count/models.py +++ b/res_partner_mails_count/models.py @@ -11,7 +11,7 @@ class res_partner(models.Model): @api.one def _mails_to(self): for r in self: - r.mails_to = self.env['mail.message'].sudo().search_count([('notified_partner_ids', 'in', r.id)]) + r.mails_to = self.env['mail.message'].sudo().search_count([('partner_ids', 'in', r.id)]) @api.one def _mails_from(self): diff --git a/res_partner_mails_count/static/src/js/main.js b/res_partner_mails_count/static/src/js/main.js index 16c9d56..4c44a0f 100644 --- a/res_partner_mails_count/static/src/js/main.js +++ b/res_partner_mails_count/static/src/js/main.js @@ -1,10 +1,16 @@ -openerp.res_partner_mails_count = function(instance){ - instance.mail.Wall.include({ - init: function(){ - this._super.apply(this, arguments); - if(this.context.ignore_search_model){ - delete this.defaults.model; - } - } - }); -}; +// openerp.res_partner_mails_count = function(instance){ +// instance.mail.Wall.include({ +// init: function(){ +// this._super.apply(this, arguments); +// if(this.context.ignore_search_model){ +// delete this.defaults.model; +// } +// } +// }); +// }; + + +// odoo.define('res_partner_mails_count.main', function(require) { +// "use strict"; +// +// }); diff --git a/res_partner_mails_count/templates.xml b/res_partner_mails_count/templates.xml index 936ba1c..79f4b1a 100644 --- a/res_partner_mails_count/templates.xml +++ b/res_partner_mails_count/templates.xml @@ -10,38 +10,26 @@ - - mail.message.search.notified_partner - mail.message - 50 - - - - - - - - res.partner.mails.count res.partner - - - - + diff --git a/res_partner_mails_count/views/res_partner_mails_count.xml b/res_partner_mails_count/views/res_partner_mails_count.xml index bd2d7d0..11f4302 100644 --- a/res_partner_mails_count/views/res_partner_mails_count.xml +++ b/res_partner_mails_count/views/res_partner_mails_count.xml @@ -3,7 +3,7 @@ Mails - mail.wall + mail.chat.instant_messaging mail.message { 'ignore_search_model': True, @@ -14,5 +14,19 @@

+ + + + + + + + + + + + + +