from odoo import models, fields, api, _ from odoo.exceptions import ValidationError from datetime import date from datetime import timedelta import datetime class CandidateExperience(models.Model): _name = "candidate.experience" _description = "Candidate Experience" _rec_name = 'experience_code' experience_code = fields.Char('Experience Code') experience_from = fields.Integer(string="Experience From (Years)") experience_to = fields.Integer(string="Experience To (Years)") # display_name = fields.Char(string="Display Name") # active = fields.Boolean() # def name_get(self): # for record in self: # name = f"{record.experience_code} ({record.experience_from} - {record.experience_to})" # return name @api.depends('experience_code', 'experience_from', 'experience_to') def _compute_display_name(self): for template in self: template.display_name = False if not template.experience_code else f"{template.experience_code} ({template.experience_from} - {template.experience_to} Years)"