You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.3 KiB

  1. # -*- coding: utf-8 -*-
  2. # -*- coding: utf-8 -*-
  3. # Copyright 2015 Antonio Espinosa <antonio.espinosa@tecnativa.com>
  4. # Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
  5. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
  6. from odoo import fields, models
  7. class ResPartnerNuts(models.Model):
  8. _name = 'res.partner.nuts'
  9. _order = 'parent_left'
  10. _parent_order = 'name'
  11. _parent_store = True
  12. _description = 'NUTS Item'
  13. # NUTS fields
  14. level = fields.Integer(required=True)
  15. code = fields.Char(required=True)
  16. name = fields.Char(required=True, translate=True)
  17. country_id = fields.Many2one(comodel_name='res.country', string='Country',
  18. required=True)
  19. state_id = fields.Many2one(comodel_name='res.country.state',
  20. string='State')
  21. not_updatable = fields.Boolean()
  22. # Parent hierarchy
  23. parent_id = fields.Many2one(comodel_name='res.partner.nuts',
  24. ondelete='restrict')
  25. child_ids = fields.One2many(comodel_name='res.partner.nuts',
  26. inverse_name='parent_id', string='Children',
  27. oldname='children')
  28. parent_left = fields.Integer('Parent Left', index=True)
  29. parent_right = fields.Integer('Parent Right', index=True)