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.

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