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.

32 lines
999 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 website_config_settings(models.TransientModel):
  5. _inherit = 'res.config.settings'
  6. recaptcha_key_site = fields.Char(
  7. related='website_id.recaptcha_key_site',
  8. readonly=False,
  9. )
  10. recaptcha_key_secret = fields.Char(
  11. related='website_id.recaptcha_key_secret',
  12. readonly=False,
  13. )
  14. has_google_recaptcha = fields.Boolean(
  15. 'Google reCaptcha',
  16. compute='_compute_has_google_recaptcha',
  17. inverse='_inverse_has_google_recaptcha',
  18. readonly=False,
  19. )
  20. @api.depends('website_id')
  21. def _compute_has_google_recaptcha(self):
  22. self.has_google_recaptcha = bool(self.recaptcha_key_site)
  23. def _inverse_has_google_recaptcha(self):
  24. if not self.has_google_recaptcha:
  25. self.recaptcha_key_site = False
  26. self.recaptcha_key_secret = False