<commit_before># Copyright 2004-2010 Tiny SPRL http://tiny.be
# Copyright 2010-2012 ChriCar Beteiligungs- und Beratungs- GmbH
#             http://www.camptocamp.at
# Copyright 2015 <NAME>, SL (Madrid, Spain)
#        http://www.antiun.com
#        <NAME> <<EMAIL>>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


from odoo import api, fields, models


class ResPartnerIdNumber(models.Model):
    _name = "res.partner.id_number"
    _description = "Partner ID Number"
    _order = "name"

    @api.constrains("name", "category_id")
    def validate_id_number(self):
        self.category_id.validate_id_number(self)

    name = fields.Char(
        string="ID Number",
        required=True,
        help="The ID itself. For example, Driver License number of this person",
    )
    category_id = fields.Many2one(
        string="Category",
        required=True,
        comodel_name="res.partner.id_category",
        help="ID type defined in configuration. For example, Driver License",
    )
    partner_id = fields.Many2one(
        string="Partner", required=True, comodel_name="res.partner", ondelete="cascade"
    )
    partner_issued_id = fields.Many2one(
        string="Issued by",
        comodel_name="res.partner",
        help="Another partner, who issued this ID. For example, Traffic "
        "National Institution",<commit_msg>[FIX][13.0] partner_identification id number check<commit_after># Copyright 2004-2010 Tiny SPRL http://tiny.be
# Copyright 2010-2012 ChriCar Beteiligungs- und Beratungs- GmbH
#             http://www.camptocamp.at
# Copyright 2015 <NAME>, SL (Madrid, Spain)
#        http://www.antiun.com
#        <NAME> <<EMAIL>>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


from odoo import api, fields, models


class ResPartnerIdNumber(models.Model):
    _name = "res.partner.id_number"
    _description = "Partner ID Number"
    _order = "name"

    @api.constrains("name", "category_id")
    def validate_id_number(self):
        for record in self:
            record.category_id.validate_id_number(record)

    name = fields.Char(
        string="ID Number",
        required=True,
        help="The ID itself. For example, Driver License number of this person",
    )
    category_id = fields.Many2one(
        string="Category",
        required=True,
        comodel_name="res.partner.id_category",
        help="ID type defined in configuration. For example, Driver License",
    )
    partner_id = fields.Many2one(
        string="Partner", required=True, comodel_name="res.partner", ondelete="cascade"
    )
    partner_issued_id = fields.Many2one(
        string="Issued by",
        comodel_name="res.partner",
        help="Another partner, who issued this ID. For example, Traffic "
        "National Institution",
{'fraction_non_alphanumeric': 0.11810743507648523, 'fraction_numerical': 0.018854500177872643, 'mean_word_length': 2.9717514124293785, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '3310645', 'n_tokens_mistral': 926, 'n_tokens_neox': 857, 'n_words': 209}