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.

30 lines
1.2 KiB

  1. # -*- coding: utf-8 -*-
  2. ##############################################################################
  3. # For copyright and license notices, see __openerp__.py file in root directory
  4. ##############################################################################
  5. from openerp import models, fields
  6. class ResPartnerNuts(models.Model):
  7. _name = 'res.partner.nuts'
  8. _order = "parent_left"
  9. _parent_order = "name"
  10. _parent_store = True
  11. _description = "NUTS Item"
  12. # NUTS fields
  13. level = fields.Integer(required=True)
  14. code = fields.Char(required=True)
  15. name = fields.Char(required=True, translate=True)
  16. country_id = fields.Many2one(comodel_name='res.country', string="Country",
  17. required=True)
  18. state_id = fields.Many2one(comodel_name='res.country.state',
  19. string='State')
  20. # Parent hierarchy
  21. parent_id = fields.Many2one(comodel_name='res.partner.nuts',
  22. ondelete='restrict')
  23. children = fields.One2many(comodel_name='res.partner.nuts',
  24. inverse_name='parent_id')
  25. parent_left = fields.Integer('Parent Left', select=True)
  26. parent_right = fields.Integer('Parent Right', select=True)