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.

30 lines
979 B

  1. # Copyright 2019 Simone Orsi - Camptocamp SA
  2. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
  3. from odoo import api, fields, models
  4. class WebsiteConfigSettings(models.TransientModel):
  5. _inherit = "res.config.settings"
  6. recaptcha_key_site = fields.Char(
  7. related="website_id.recaptcha_key_site", readonly=False
  8. )
  9. recaptcha_key_secret = fields.Char(
  10. related="website_id.recaptcha_key_secret", readonly=False
  11. )
  12. has_google_recaptcha = fields.Boolean(
  13. "Google reCaptcha",
  14. compute="_compute_has_google_recaptcha",
  15. inverse="_inverse_has_google_recaptcha",
  16. readonly=False,
  17. )
  18. @api.depends("website_id")
  19. def _compute_has_google_recaptcha(self):
  20. self.has_google_recaptcha = bool(self.recaptcha_key_site)
  21. def _inverse_has_google_recaptcha(self):
  22. if not self.has_google_recaptcha:
  23. self.recaptcha_key_site = False
  24. self.recaptcha_key_secret = False