1234567891011121314151617181920212223242526 |
- import math
- from openerp.osv import osv, fields
- class res_partner(osv.osv):
- _inherit = 'res.partner'
- def _activity_count(self, cr, uid, ids, field_name, arg, context=None):
- res = dict(map(lambda x: (x,0), ids))
- # The current user may not have access rights for sale orders
- try:
- for partner in self.browse(cr, uid, ids, context):
- res[partner.id] = len(partner.activity_ids)
- except:
- pass
- return res
- """ Inherits partner and adds Tasks information in the partner form """
- _columns = {
- 'activity_ids': fields.one2many('project.task.activity', 'user_id', 'Actividad'),
- 'activity_count': fields.function(_activity_count, string='#Actividad', type='integer'),
- }
- # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|