如何更改模块安装上的设置? [英] How to change settings on module installation?
本文介绍了如何更改模块安装上的设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想更改sale.config.settings
设置中的值.我发现此方式.但是我想使用Odoo v8的api.那可能吗?我在源代码中找到的所有示例都使用osv.osv_memory
I want to change a value in the settings of sale.config.settings
. I found this way to do it. But I would like to use the api of Odoo v8. Is that possible? All the examples I found in the source code are using osv.osv_memory
推荐答案
xml =================
xml ===================
<?xml version="1.0"?>
<openerp>
<data>
<function model="my.model.init" name="_init_settings" />
</data>
</openerp>
python ====================
python ======================
from openerp import api, models
class my_model_init(models.TransientModel):
_name = ''my.model.init"
@api.multi
def _init_settings(self):
sale_settings_pool = self.env['sale.config.settings']
sale_settings_id = sale_settings_pool.create({'group_route_so_lines':True})
sale_settings_obj = sale_settings_pool.browse(sale_settings_id)
sale_settings_obj.execute() # this call is actually changes the setting, you're missing this step.
return True
这篇关于如何更改模块安装上的设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文