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.

73 lines
2.3 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. _description = "Partner ID Number"
  12. _order = "name"
  13. @api.constrains("name", "category_id")
  14. def validate_id_number(self):
  15. self.category_id.validate_id_number(self)
  16. name = fields.Char(
  17. string="ID Number",
  18. required=True,
  19. help="The ID itself. For example, Driver License number of this "
  20. "person",
  21. )
  22. category_id = fields.Many2one(
  23. string="Category",
  24. required=True,
  25. comodel_name="res.partner.id_category",
  26. help="ID type defined in configuration. For example, Driver License",
  27. )
  28. partner_id = fields.Many2one(
  29. string="Partner",
  30. required=True,
  31. comodel_name="res.partner",
  32. ondelete="cascade",
  33. )
  34. partner_issued_id = fields.Many2one(
  35. string="Issued by",
  36. comodel_name="res.partner",
  37. help="Another partner, who issued this ID. For example, Traffic "
  38. "National Institution",
  39. )
  40. place_issuance = fields.Char(
  41. string="Place of Issuance",
  42. help="The place where the ID has been issued. For example the country "
  43. "for passports and visa",
  44. )
  45. date_issued = fields.Date(
  46. string="Issued on",
  47. help="Issued date. For example, date when person approved his driving "
  48. "exam, 21/10/2009",
  49. )
  50. valid_from = fields.Date(
  51. string="Valid from", help="Validation period stating date."
  52. )
  53. valid_until = fields.Date(
  54. string="Valid until",
  55. help="Expiration date. For example, date when person needs to renew "
  56. "his driver license, 21/10/2019",
  57. )
  58. comment = fields.Text(string="Notes")
  59. status = fields.Selection(
  60. [
  61. ("draft", "New"),
  62. ("open", "Running"),
  63. ("pending", "To Renew"),
  64. ("close", "Expired"),
  65. ]
  66. )
  67. active = fields.Boolean(string="Active", default=True)