Files
test/sf_wxwork_approval/models/wxwork_config.py
2023-05-30 11:26:03 +08:00

25 lines
879 B
Python

# models/wxwork_config.py
from odoo import fields, models
class WxWorkConfigSettings(models.TransientModel):
_name = 'wxwork.config.settings'
_inherit = 'res.config.settings'
wxwork_corp_id = fields.Char(string='企业微信CorpID')
wxwork_secret = fields.Char(string='企业微信Secret')
def set_values(self):
super(WxWorkConfigSettings, self).set_values()
self.env['ir.config_parameter'].set_param('wxwork.corp_id', self.wxwork_corp_id)
self.env['ir.config_parameter'].set_param('wxwork.secret', self.wxwork_secret)
def get_values(self):
res = super(WxWorkConfigSettings, self).get_values()
res.update(
wxwork_corp_id=self.env['ir.config_parameter'].get_param('wxwork.corp_id'),
wxwork_secret=self.env['ir.config_parameter'].get_param('wxwork.secret'),
)
return res