<commit_before># Copyright 2017 <NAME> - Openforce
# Copyright 2019 <NAME> (Associazione PNLUG - Gruppo Odoo)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models, fields, api, _
from odoo.exceptions import ValidationError


class CodiceCarica(models.Model):
    _name = 'codice.carica'
    _description = 'Role Code'

    @api.constrains('code')
    def _check_code(self):
        for codice in self:
            domain = [('code', '=', codice.code)]
            elements = self.search(domain)
            if len(elements) > 1:
                raise ValidationError(
                    _("The element with code %s already exists") % codice.code)<commit_msg>FIX license LGPL-3 conflicts<commit_after># Copyright 2017 <NAME> - Openforce
# Copyright 2019 <NAME> (Associazione PNLUG - Gruppo Odoo)

from odoo import models, fields, api, _
from odoo.exceptions import ValidationError


class CodiceCarica(models.Model):
    _name = 'codice.carica'
    _description = 'Role Code'

    @api.constrains('code')
    def _check_code(self):
        for codice in self:
            domain = [('code', '=', codice.code)]
            elements = self.search(domain)
            if len(elements) > 1:
                raise ValidationError(
                    _("The element with code %s already exists") % codice.code)
{'fraction_non_alphanumeric': 0.11185682326621924, 'fraction_numerical': 0.015659955257270694, 'mean_word_length': 2.6666666666666665, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '3304519', 'n_tokens_mistral': 438, 'n_tokens_neox': 402, 'n_words': 115}