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.

93 lines
3.4 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. @api.onchange("data_policy_approval_required")
  79. def onchange_data_policy_approval_required(self):
  80. if self.data_policy_approval_required:
  81. self.display_data_policy_approval = True
  82. @api.onchange("internal_rules_approval_required")
  83. def onchange_internal_rules_approval_required(self):
  84. if self.internal_rules_approval_required:
  85. self.display_internal_rules_approval = True