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.

33 lines
1.0KB

  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 ResConfigSettings(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. for config in self:
  21. config.has_google_recaptcha = bool(config.recaptcha_key_site)
  22. def _inverse_has_google_recaptcha(self):
  23. for config in self:
  24. if not config.has_google_recaptcha:
  25. config.recaptcha_key_site = False
  26. config.recaptcha_key_secret = False
上海开阖软件有限公司 沪ICP备12045867号-1