# -*- coding: utf-8 -*- ############################################################################## # # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see # ############################################################################## from openerp.tools.translate import _ from datetime import datetime, timedelta, date from dateutil.relativedelta import relativedelta from openerp import tools, api from openerp.tools import DEFAULT_SERVER_DATE_FORMAT from openerp import api, fields, models, _ import logging from openerp.osv import osv from openerp import SUPERUSER_ID class crm_lead(models.Model): """ CRM Lead Case """ _inherit = "crm.lead" @api.multi def mensaje_count(self): mensaje_obj = self.env['crm.mensaje'] self.mensaje_number = mensaje_obj.search_count([('opportunity_id', 'in', [a.id for a in self])]) mensaje_number = fields.Integer(compute='mensaje_count', string='Mensaje')