From 9718be8b5fb41b37a99adf48336b7b4f0933dedc Mon Sep 17 00:00:00 2001 From: x620 Date: Tue, 22 Mar 2016 18:16:52 +0500 Subject: [PATCH] Remove logger and self -> r --- res_partner_mails_count/models.py | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/res_partner_mails_count/models.py b/res_partner_mails_count/models.py index 8befe5a..965ec60 100644 --- a/res_partner_mails_count/models.py +++ b/res_partner_mails_count/models.py @@ -2,23 +2,6 @@ from openerp import models, fields, api -import logging - - -def getlogger(name): - filename = 'test.log' - logger = logging.getLogger(name) - handler = logging.FileHandler(filename) - formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(name)s: %(message)s') - - handler.setFormatter(formatter) - logger.addHandler(handler) - logger.setLevel(logging.DEBUG) - - return logger - -logger = getlogger(__name__) - class res_partner(models.Model): _inherit = 'res.partner' @@ -28,9 +11,9 @@ class res_partner(models.Model): @api.one def _mails_from(self): for r in self: - self.mails_from = self.env['mail.message'].sudo().search_count([('partner_ids', 'in', r.id)]) + r.mails_from = self.env['mail.message'].sudo().search_count([('partner_ids', 'in', r.id)]) @api.one def _mails_to(self): for r in self: - self.mails_to = self.env['mail.message'].sudo().search_count([('author_id', '=', r.id)]) + r.mails_to = self.env['mail.message'].sudo().search_count([('author_id', '=', r.id)])