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.

59 lines
2.2 KiB

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