123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- # -*- coding: utf-8 -*-
- ##############################################################################
- #
- # OpenERP, Open Source Management Solution
- # Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>)
- #
- # This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU Affero 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 Affero General Public License for more details.
- #
- # You should have received a copy of the GNU Affero General Public License
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
- #
- ##############################################################################
- from datetime import datetime
- from operator import itemgetter
- import openerp
- from openerp import SUPERUSER_ID
- from openerp import tools
- from openerp.osv import fields, osv, orm
- from openerp.tools.translate import _
- class crm_lead(osv.osv):
- _inherit = 'crm.lead'
- def _messenger_count(self, cr, uid, ids, field_name, arg, context=None):
- Event = self.pool['crm.mensaje']
- return {
- opportunity_id: Event.search_count(cr,uid, [('opportunity_id', '=', opportunity_id)], context=context)
- for opportunity_id in ids
- }
- _columns = {
- 'messenger_count': fields.function(_messenger_count, string='# Mensaje', type='integer'),
- }
- # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|