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.

57 lines
2.2 KiB

  1. # Copyright 2004-2010 Tiny SPRL http://tiny.be
  2. # Copyright 2010-2012 ChriCar Beteiligungs- und Beratungs- GmbH
  3. # http://www.camptocamp.at
  4. # Copyright 2015 Antiun Ingenieria, SL (Madrid, Spain)
  5. # http://www.antiun.com
  6. # Antonio Espinosa <antonioea@antiun.com>
  7. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  8. from odoo import api, models, fields
  9. class ResPartnerIdNumber(models.Model):
  10. _name = "res.partner.id_number"
  11. _order = "name"
  12. @api.constrains('name', 'category_id')
  13. def validate_id_number(self):
  14. self.category_id.validate_id_number(self)
  15. name = fields.Char(
  16. string="ID Number", required=True,
  17. help="The ID itself. For example, Driver License number of this "
  18. "person")
  19. category_id = fields.Many2one(
  20. string="Category", required=True,
  21. comodel_name='res.partner.id_category',
  22. help="ID type defined in configuration. For example, Driver License")
  23. partner_id = fields.Many2one(string="Partner", required=True,
  24. comodel_name='res.partner',
  25. ondelete='cascade')
  26. partner_issued_id = fields.Many2one(
  27. string="Issued by", comodel_name='res.partner',
  28. help="Another partner, who issued this ID. For example, Traffic "
  29. "National Institution")
  30. place_issuance = fields.Char(
  31. string="Place of Issuance",
  32. help="The place where the ID has been issued. For example the country "
  33. "for passports and visa")
  34. date_issued = fields.Date(
  35. string="Issued on",
  36. help="Issued date. For example, date when person approved his driving "
  37. "exam, 21/10/2009")
  38. valid_from = fields.Date(
  39. string="Valid from",
  40. help="Validation period stating date.")
  41. valid_until = fields.Date(
  42. string="Valid until",
  43. help="Expiration date. For example, date when person needs to renew "
  44. "his driver license, 21/10/2019")
  45. comment = fields.Text(string="Notes")
  46. status = fields.Selection(
  47. [('draft', 'New'),
  48. ('open', 'Running'),
  49. ('pending', 'To Renew'),
  50. ('close', 'Expired')])
  51. active = fields.Boolean(string="Active", default=True)