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.

109 lines
4.0 KiB

  1. # Copyright 2019 Coop IT Easy SCRL fs
  2. # Houssine Bakkali <houssine@coopiteasy.be>
  3. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
  4. from odoo import api, fields, models
  5. class ResCompany(models.Model):
  6. _inherit = "res.company"
  7. def _compute_base_logo(self):
  8. base_url = (
  9. self.env["ir.config_parameter"].sudo().get_param("web.base.url")
  10. )
  11. self.logo_url = base_url + "/logo.png"
  12. coop_email_contact = fields.Char(
  13. string="Contact email address for the" " cooperator"
  14. )
  15. subscription_maximum_amount = fields.Float(
  16. string="Maximum authorised" " subscription amount"
  17. )
  18. default_country_id = fields.Many2one(
  19. "res.country",
  20. string="Default country",
  21. default=lambda self: self.country_id,
  22. )
  23. default_lang_id = fields.Many2one("res.lang", string="Default lang")
  24. allow_id_card_upload = fields.Boolean(string="Allow ID Card upload")
  25. create_user = fields.Boolean(
  26. string="Create user for cooperator", default=False
  27. )
  28. board_representative = fields.Char(string="Board representative name")
  29. signature_scan = fields.Binary(string="Board representative signature")
  30. property_cooperator_account = fields.Many2one(
  31. "account.account",
  32. company_dependent=True,
  33. string="Cooperator Account",
  34. domain=[
  35. ("internal_type", "=", "receivable"),
  36. ("deprecated", "=", False),
  37. ],
  38. help="This account will be"
  39. " the default one as the"
  40. " receivable account for the"
  41. " cooperators",
  42. required=True,
  43. )
  44. unmix_share_type = fields.Boolean(
  45. string="Unmix share type",
  46. default=True,
  47. help="If checked, A cooperator will be"
  48. " authorised to have only one type"
  49. " of share",
  50. )
  51. display_logo1 = fields.Boolean(string="Display logo 1")
  52. display_logo2 = fields.Boolean(string="Display logo 2")
  53. bottom_logo1 = fields.Binary(string="Bottom logo 1")
  54. bottom_logo2 = fields.Binary(string="Bottom logo 2")
  55. logo_url = fields.Char(string="logo url", compute="_compute_base_logo")
  56. display_data_policy_approval = fields.Boolean(
  57. help="Choose to display a data policy checkbox on the cooperator"
  58. " website form."
  59. )
  60. data_policy_approval_required = fields.Boolean(
  61. string="Is data policy approval required?"
  62. )
  63. data_policy_approval_text = fields.Html(
  64. translate=True,
  65. help="Text to display aside the checkbox to approve data policy.",
  66. )
  67. display_internal_rules_approval = fields.Boolean(
  68. help="Choose to display an internal rules checkbox on the"
  69. " cooperator website form."
  70. )
  71. internal_rules_approval_required = fields.Boolean(
  72. string="Is internal rules approval required?"
  73. )
  74. internal_rules_approval_text = fields.Html(
  75. translate=True,
  76. help="Text to display aside the checkbox to approve internal rules.",
  77. )
  78. display_financial_risk_approval = fields.Boolean(
  79. help="Choose to display a financial risk checkbox on the"
  80. " cooperator website form."
  81. )
  82. financial_risk_approval_required = fields.Boolean(
  83. string="Is financial risk approval required?"
  84. )
  85. financial_risk_approval_text = fields.Html(
  86. translate=True,
  87. help="Text to display aside the checkbox to approve financial risk."
  88. )
  89. @api.onchange("data_policy_approval_required")
  90. def onchange_data_policy_approval_required(self):
  91. if self.data_policy_approval_required:
  92. self.display_data_policy_approval = True
  93. @api.onchange("internal_rules_approval_required")
  94. def onchange_internal_rules_approval_required(self):
  95. if self.internal_rules_approval_required:
  96. self.display_internal_rules_approval = True
  97. @api.onchange('financial_risk_approval_required')
  98. def onchange_financial_risk_approval_required(self):
  99. if self.financial_risk_approval_required:
  100. self.display_financial_risk_approval = True