# Copyright 2019-2020: Druidoo () # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import _, api, fields, models from odoo.exceptions import ValidationError from .ffck_membership_type import RANGES class ResPartnerAgeRange(models.Model): _inherit = "res.partner.age.range" name = fields.Char(translate=True) age_range = fields.Selection( selection=RANGES, string="Global range", compute="_get_age_range", store=True, ) active = fields.Boolean(string="Active", default=True) @api.depends("age_to") def _get_age_range(self): for range in self: if range.age_to <= 18: range.age_range = "young" else: range.age_range = "adult"