Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/302.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在odoo 11中的res.config.settings中设置默认值True,以及如何并行管理真/假值?_Python_Odoo_Config_Settings_Default - Fatal编程技术网

Python 如何在odoo 11中的res.config.settings中设置默认值True,以及如何并行管理真/假值?

Python 如何在odoo 11中的res.config.settings中设置默认值True,以及如何并行管理真/假值?,python,odoo,config,settings,default,Python,Odoo,Config,Settings,Default,我想要设置,比如当我安装模块时,一些字段在常规设置中应该是真的。然后我也可以更改设置,所以我在res.confing.settings中设置了默认值 问题是当我取消选中复选框时,它不是取消勾选,因为它已经设置为真值 类重新配置设置(models.TransientModel): _inherit='res.config.settings' group_stock_multi_locations=fields.Boolean('Storage locations',default=True,隐含的

我想要设置,比如当我安装模块时,一些字段在常规设置中应该是真的。然后我也可以更改设置,所以我在res.confing.settings中设置了默认值

问题是当我取消选中复选框时,它不是取消勾选,因为它已经设置为真值

类重新配置设置(models.TransientModel):
_inherit='res.config.settings'
group_stock_multi_locations=fields.Boolean('Storage locations',default=True,隐含的_group='stock.group_stock_multi_locations',
help=“将产品存储在仓库的特定位置(如箱子、货架),并相应地跟踪库存。”)
组库存多仓库=字段。布尔值(
“多仓库”,默认值为True,隐含的\u group='stock.group\u stock\u Multi\u Warehouses')
group_stock_adv_location=fields.Boolean(“多步骤路由”,默认值=True,
隐含的\u group='stock.group\u adv\u location',
help=“添加和自定义路线操作以处理仓库中的产品移动:例如,卸货>质量控制>进货库存,提货>包装>出货产品。\n您还可以在仓库位置设置存放策略,以便将进货直接发送到特定的子位置(例如,特定的箱子、货架)。)
@api.multi
def设置_值(自身):
超级(重新配置设置,自我)。设置_值()
self.env['ir.config_参数'].sudo().set_参数(
“集团库存多个位置”,self.group库存多个位置)
self.env['ir.config_参数'].sudo().set_参数(
“集团库存多仓库”,self.group库存多仓库)
self.env['ir.config_参数'].sudo().set_参数(
“集团库存高级位置”,self.group库存高级位置)
@api.model
def get_值(自身):
res=super(重新配置设置,self).get_值()
params=self.env['ir.config_参数'].sudo()
位置=参数。获取参数(
“集团库存多地点”,默认值为True)
仓库=参数。获取参数(
“集团库存多仓库”,默认值为True)
adv_location=params.get_param(
“集团库存位置”,默认值为True)
res.update({'group\u stock\u multi\u locations':位置,
“组库存\u多仓库”:仓库,“组库存\u adv\u位置”:adv\u位置})
返回res

类别ResBaseConfigSettings(models.TransientModel): _inherit=“res.config.settings”

@api.model
def set_button_parameters(self):
    settings = self.env['res.config.settings'].write({
        'group_name': True,
    })
    settings.execute()