# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################

from openerp import models, fields, api


class ResPartner(models.Model):
    _inherit = 'res.partner'

    registrations = fields.One2many(
        string="Event registrations",
        comodel_name='event.registration', inverse_name="partner_id")
    registration_count = fields.Integer(
        string='Event registrations number', compute='_count_registration',
        store=True)
    attended_registration_count = fields.Integer(
        string='Event attended registrations number',
        compute='_count_registration', store=True)

    @api.one
    @api.depends('registrations')
    def _count_registration(self):
        self.registration_count = len(self.registrations)
        self.attended_registration_count = len(self.registrations.filtered(
            lambda x: x.state == 'done'))

@@ -763,32 +763,41 @@
 compute='_count_
+attended_
 registration', s
@@ -947,16 +947,114 @@
 rations)
+%0A%0A    @api.one%0A    @api.depends('registrations.state')%0A    def _count_attended_registration(self):
 %0A       

Revert last commit and tiggers _count_attended_registration method when one registrations.state changes