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

36 lines
1.1KB

  1. # -*- coding: utf-8 -*-
  2. from odoo import api, fields, models, tools, SUPERUSER_ID, _
  3. from odoo.exceptions import UserError
  4. class ResConfigSettings(models.TransientModel):
  5. _inherit = "res.config.settings"
  6. company_id = fields.Many2one(
  7. "res.company",
  8. string="Company",
  9. required=True,
  10. default=lambda self: self.env.company,
  11. )
  12. material_app_id = fields.Many2one(
  13. related="company_id.material_app_id", readonly=False,
  14. )
  15. material_agentid = fields.Integer(related="material_app_id.agentid", readonly=False)
  16. material_secret = fields.Char(related="material_app_id.secret", readonly=False)
  17. material_access_token = fields.Char(related="material_app_id.access_token")
  18. def get_material_app_info(self):
  19. """
  20. 获取应用信息
  21. :return:
  22. """
  23. for record in self:
  24. # print(record.material_agentid,record.material_secret)
  25. if record.material_agentid== 0 or record.material_secret == '':
  26. raise UserError(_("Material application ID and secret cannot be empty!"))
  27. else:
  28. record.material_app_id.get_app_info()
上海开阖软件有限公司 沪ICP备12045867号-1