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.

31 lines
1.3 KiB

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