Odoo modules about association management
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.

119 lines
4.1 KiB

  1. # -*- coding: utf-8 -*-
  2. from odoo import models, fields, api
  3. class ResPartner(models.Model):
  4. _inherit = "res.partner"
  5. association = fields.Boolean(string="Is an association")
  6. is_french = fields.Boolean(
  7. string="French partner",
  8. related="country_id.is_french",
  9. store=True,
  10. )
  11. constituent_ga_date = fields.Date(
  12. string="Consitutent GA",
  13. tracking="80",
  14. help="Constituent General Assembly date",
  15. )
  16. prefecture_date = fields.Date(
  17. string="Declaration date",
  18. tracking="82",
  19. help="Prefecture declaration date",
  20. )
  21. prefecture = fields.Char(
  22. string="Prefecture",
  23. tracking="81",
  24. help="Prefecture (city) of declaration",
  25. )
  26. official_journal_date = fields.Date(
  27. string="Official Journal",
  28. tracking="83",
  29. help="Official Journal publication date",
  30. )
  31. official_journal_dept_id = fields.Many2one(
  32. comodel_name="res.country.department",
  33. string="OJ department",
  34. tracking="81",
  35. help="Official Journal publication department",
  36. domain=[
  37. (
  38. "country_id.code",
  39. "in",
  40. (
  41. "FR",
  42. "GP",
  43. "MQ",
  44. "GF",
  45. "RE",
  46. "YT",
  47. ),
  48. )
  49. ],
  50. )
  51. official_journal = fields.Char(
  52. string="OJ reference",
  53. tracking="81",
  54. help="Official Journal reference",
  55. )
  56. company_registry_date = fields.Date(
  57. string="Registration date",
  58. help="Association National Register declaration date",
  59. tracking="83",
  60. )
  61. company_registry = fields.Char(tracking="83")
  62. naf_ape = fields.Char(string="NAF/APE code", tracking="83")
  63. last_ga_date = fields.Date(string="Last general assembly", tracking="81")
  64. # Documents fields
  65. statuses_file = fields.Binary("Statuses file")
  66. statuses_filename = fields.Char("Statuses filename", tracking="83")
  67. statuses_update_date = fields.Date("Statuses update", tracking="83")
  68. internal_regul_file = fields.Binary("Internal Regulations file")
  69. internal_regul_filename = fields.Char(
  70. "Internal Regulations filename", tracking="83"
  71. )
  72. internal_regul_update_date = fields.Date("Internal Reg. update", tracking="85")
  73. asso_project_file = fields.Binary("Assocation project")
  74. asso_project_filename = fields.Char("Assocation project filename", tracking="83")
  75. asso_project_update_date = fields.Date("Project update", tracking="83")
  76. @api.onchange("is_company", "country_id")
  77. def onchange_asso_is_french_company(self):
  78. if self.association and (not self.is_company or not self.is_french):
  79. self.association = False
  80. # @api.onchange("association")
  81. # def onchange_association(self):
  82. # if not self.association:
  83. # values = {}
  84. # if self.statuses_file:
  85. # values.update(
  86. # {
  87. # "statuses_file": False,
  88. # "statuses_filename": False,
  89. # "statuses_update_date": False,
  90. # }
  91. # )
  92. # if self.internal_regul_file:
  93. # values.update(
  94. # {
  95. # "internal_regul_file": False,
  96. # "internal_regul_filename": False,
  97. # "internal_regul_update_date": False,
  98. # }
  99. # )
  100. # for field in [
  101. # "association",
  102. # "asso_creation_date",
  103. # "prefecture_date",
  104. # "prefecture",
  105. # "official_journal_date",
  106. # "company_registry_date",
  107. # "company_registry",
  108. # "naf_ape",
  109. # "last_ga_date",
  110. # ]:
  111. # if getattr(self, field) != False:
  112. # values.update({field: False})
  113. # if values:
  114. # self.update(values)