跳至内容
菜单
此问题已终结
1 回复
2653 查看

In Odoo14 I am trying to get value of field module_sale_margin from res.config.settings. but it always return False 


See below code for what I have tried.


sale_margin_module = self.env['ir.config_parameter'].sudo().get_param('sale.module_sale_margin') or False

形象
丢弃
最佳答案

Hi,

If you check the field in the code, you can see that this field value is not stored inside the ir config parameter model. Currently when we enable and disable this field, the module sale_margin will get installed/uninstalled from the database.

So if you need to know whether this is activated or not, just see the status of the corresponding module.

Code sample:

sale_margin = self.env['ir.module.module'].search([('name' ,'=', 'sale_margin')])

if sale_margin.state == 'installed':

  


Thanks

形象
丢弃
相关帖文 回复 查看 活动
0
5月 25
11
2
1月 25
2346
1
12月 24
6048
1
11月 24
2498
1
11月 24
1864