40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of SmartGo. See LICENSE file for full copyright and licensing details.
|
|
import logging
|
|
|
|
from odoo import api, fields, models, _
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
class WxWorkConfigSettings(models.TransientModel):
|
|
_inherit = 'res.config.settings'
|
|
|
|
wxwork_corp_id = fields.Char(string='企业微信CorpID')
|
|
wxwork_secret = fields.Char(string='企业微信Secret')
|
|
|
|
|
|
@api.model
|
|
def get_values(self):
|
|
"""
|
|
重载获取参数的方法,参数都存在系统参数中
|
|
:return:
|
|
"""
|
|
values = super(WxWorkConfigSettings, self).get_values()
|
|
config = self.env['ir.config_parameter'].sudo()
|
|
wxwork_corp_id = config.get_param('wxwork_corp_id', default='')
|
|
wxwork_secret = config.get_param('wxwork_secret', default='')
|
|
values.update(
|
|
wxwork_corp_id=wxwork_corp_id,
|
|
wxwork_secret=wxwork_secret,
|
|
|
|
|
|
)
|
|
return values
|
|
|
|
def set_values(self):
|
|
super(WxWorkConfigSettings, self).set_values()
|
|
ir_config = self.env['ir.config_parameter'].sudo()
|
|
ir_config.set_param("wxwork_corp_id", self.wxwork_corp_id or "")
|
|
ir_config.set_param("wxwork_secret", self.wxwork_secret or "")
|