Files
test/sf_machine_connect/models/res_config_setting.py

43 lines
1.7 KiB
Python

# -*- coding: utf-8 -*-
import logging
from odoo import api, fields, models
_logger = logging.getLogger(__name__)
class ResBFMConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
# bfm_url = fields.Selection(
# [("https://bfm.cs.jikimo.com", "开发环境(https://bfm.cs.jikimo.com)"),
# ("https://bfm.t.jikimo.com", "测试环境(https://bfm.t.jikimo.com)"),
# ("https://bfm.r.jikimo.com", "预发布环境(https://bfm.r.jikimo.com)"),
# # ("正式环境", "https://bfm.jikimo.com")], string='bfm环境', store=True)
# ("https://bfm.jikimo.com", "正式环境(https://bfm.jikimo.com)")], string='bfm环境', store=True)
bfm_url_new = fields.Char('业务平台环境路径', placeholder='请输入当前对应的业务平台环境路径')
get_check_file_path = fields.Char('获取检查文件路径', default='')
@api.model
def get_values(self):
"""
重载获取参数的方法,参数都存在系统参数中
:return:
"""
values = super(ResBFMConfigSettings, self).get_values()
config = self.env['ir.config_parameter'].sudo()
bfm_url_new = config.get_param('bfm_url_new', default='')
get_check_file_path = config.get_param('get_check_file_path', default='')
values.update(
bfm_url_new=bfm_url_new,
get_check_file_path=get_check_file_path
)
return values
def set_values(self):
super(ResBFMConfigSettings, self).set_values()
ir_config = self.env['ir.config_parameter'].sudo()
ir_config.set_param("bfm_url_new", self.bfm_url_new or "")
ir_config.set_param("get_check_file_path", self.get_check_file_path or "")