(self)
Age computed depending based on the birth date in the
         membership request.
Age computed depending based on the birth date in the
         membership request.
Age computed depending based on the birth date in the membership request .
def _compute_age(self):
        """ Age computed depending based on the birth date in the
         membership request.
        """
        now = datetime.now()
        for record in self:
            if record.birthdate_date:
                birthdate_date = fields.Datetime.from_string(
                    record.birthdate_date,
                )
                if record.is_deceased:
                    date_death = fields.Datetime.from_string(record.date_death)
                    delta = relativedelta(date_death, birthdate_date)
                    is_deceased = _(' (deceased)')
                else:
                    delta = relativedelta(now, birthdate_date)
                    is_deceased = ''
                years_months_days = '%d%s %d%s %d%s%s' % (
                    delta.years, _('y'), delta.months, _('m'),
                    delta.days, _('d'), is_deceased
                )
                years = delta.years
            else:
                years_months_days = _('No DoB')
                years = False
            record.age = years_months_days
            if years:
                record.age_years = years
def _compute_age ( self ) : now = datetime . now ( ) for record in self : if record . birthdate_date : birthdate_date = fields . Datetime . from_string ( record . birthdate_date , ) if record . is_deceased : date_death = fields . Datetime . from_string ( record . date_death ) delta = relativedelta ( date_death , birthdate_date ) is_deceased = _ ( ' (deceased)' ) else : delta = relativedelta ( now , birthdate_date ) is_deceased = '' years_months_days = '%d%s %d%s %d%s%s' % ( delta . years , _ ( 'y' ) , delta . months , _ ( 'm' ) , delta . days , _ ( 'd' ) , is_deceased ) years = delta . years else : years_months_days = _ ( 'No DoB' ) years = False record . age = years_months_days if years : record . age_years = years