<commit_before># -*- coding: utf-8 -*-
from openerp import models, fields

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

    def get_country_name(self):
        email = self.env.context.get('default_email', False)
        if email:
            top_level_domain = email.split(".")[-1]
            country_name = self.env['res.country'].search([('code', '=', top_level_domain.upper())])[0]
            return country_name

    country_id = fields.Many2one('res.country', 'Country', ondelete='restrict', default=get_country_name)
<commit_msg>[FIX] delete non-changed attributes from field definition<commit_after># -*- coding: utf-8 -*-
from openerp import models, fields

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

    def get_country_name(self):
        email = self.env.context.get('default_email', False)
        if email:
            top_level_domain = email.split(".")[-1]
            if len(top_level_domain) == 2:
                country_name = self.env['res.country'].search([('code', '=', top_level_domain.upper())])[0]
                return country_name

    country_id = fields.Many2one(default=get_country_name)

{'fraction_non_alphanumeric': 0.14249578414839797, 'fraction_numerical': 0.007588532883642495, 'mean_word_length': 3.2697841726618706, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5982286', 'n_tokens_mistral': 373, 'n_tokens_neox': 362, 'n_words': 68}