<commit_before># -*- coding: utf-8 -*-
#    Copyright (c) 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
#                       <NAME> <<EMAIL>>
#    Copyright (c) 2015 Antiun Ingeniería S.L. (http://www.antiun.com)
#                       <NAME> <<EMAIL>>
# © 2015 Antiun Ingeniería S.L. - <NAME>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import models, fields


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

    department_id = fields.Many2one(
        "res.partner.department",
        "Department",
        oldname="department")


class ResPartnerDepartment(models.Model):
    _name = 'res.partner.department'
    _order = "parent_left"
    _parent_order = "name"
    _parent_store = True
    _description = "Department"

    name = fields.Char(required=True, translate=True)
    parent_id = fields.Many2one(
        "res.partner.department",
        "Parent department")
    child_ids = fields.One2many(
        "res.partner.department",
        "parent_id",
        "Child departments",
        oldname="children")
    parent_left = fields.Integer(index=True)
    parent_right = fields.Integer(index=True)
<commit_msg>Add ondelete option to parent_id, runbot fails to lack of attribute.<commit_after># -*- coding: utf-8 -*-
#    Copyright (c) 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
#                       <NAME> <<EMAIL>>
#    Copyright (c) 2015 Antiun Ingeniería S.L. (http://www.antiun.com)
#                       <NAME> <<EMAIL>>
# © 2015 <NAME>. - <NAME>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import models, fields


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

    department_id = fields.Many2one(
        "res.partner.department",
        "Department",
        oldname="department")


class ResPartnerDepartment(models.Model):
    _name = 'res.partner.department'
    _order = "parent_left"
    _parent_order = "name"
    _parent_store = True
    _description = "Department"

    name = fields.Char(required=True, translate=True)
    parent_id = fields.Many2one(
        "res.partner.department",
        "Parent department",
        ondelete='restrict')
    child_ids = fields.One2many(
        "res.partner.department",
        "parent_id",
        "Child departments",
        oldname="children")
    parent_left = fields.Integer(index=True)
    parent_right = fields.Integer(index=True)

{'fraction_non_alphanumeric': 0.13287281592848435, 'fraction_numerical': 0.014628199918732222, 'mean_word_length': 2.719033232628399, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, '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': '4932366', 'n_tokens_mistral': 843, 'n_tokens_neox': 792, 'n_words': 163}