中国本土应用
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.

43 lines
1021B

  1. # -*- coding: utf-8 -*-
  2. import random
  3. from odoo import api, models, tools, _
  4. import logging
  5. _logger = logging.getLogger(__name__)
  6. class WecomApiToolsString(models.AbstractModel):
  7. _name = "wecomapi.tools.string"
  8. _description = "Wecom API Tools - Fields"
  9. def str2bool(self):
  10. """
  11. 字符串转布尔值
  12. :param val: 字符串
  13. :return: 布尔值
  14. """
  15. # return self.value.lower() in ("yes", "true", "t", "1")
  16. if self.value.lower() in ["true", "t", "1"]:
  17. return True
  18. elif self.value.lower() in ["false", "f", "0"]:
  19. return False
  20. else:
  21. return False
  22. # def int2bool(self):
  23. # """
  24. # 整形转布尔值
  25. # :param val: 整形
  26. # :return: 布尔值
  27. # """
  28. # if self.value.lower() in ["true", "t", "1"]:
  29. # return True
  30. # elif self.value.lower() in ["false", "f", "0"]:
  31. # return False
  32. # else:
  33. # return False
上海开阖软件有限公司 沪ICP备12045867号-1