【发布时间】:2017-11-05 12:25:21
【问题描述】:
我已经使用models.TransientModel 在Odoo 中进行了自定义配置设置,并实现了get_default 和set 函数。我这样做的方式与此问题的答案中显示的相同
Set and get store data Odoo with TransientModel
模块安装后,设置为空。如何在安装时获得该配置设置的默认值?
我尝试过使用init 函数。
def init(self, cr):
config = self.pool.get("ir.config.parameter")
config_value = {
"value": "randomaddress@gmail.com",
"key": "myapplication.email_address"
}
config.create(cr, uid, config_value, context=None)
没用。
【问题讨论】:
-
改用
__init__。 -
这里还有关于自定义设置的文档:ludwiktrammer.github.io/odoo/custom-settings-odoo.html
-
你找到解决办法了吗?