Odooers论坛

欢迎!

该社区面向专业人士和我们产品和服务的爱好者。
分享和讨论最好的内容和新的营销理念,建立您的专业形象,一起成为更好的营销人员。


0

can't get parameter value from ir.config_parameter

形象
odoo
形象
丢弃
2 答案
0
形象
odoo
最佳答案

I have solved this problem using compute. Just a guess, maybe using @api.model can't do because the function that uses that decorator will only be called when entering the form. In my case I want to affect the whole record without having to enter the form, so it can only be done if i'm using compute

setting = fields.Boolean(compute='_compute_setting', string='Setting')
def_compute_setting(self):    
    for rec in self:
        config = self.env['ir.config_parameter'].sudo()
        get_setting = config.get_param('sale_order_multiple_pricelist', False)
        rec.setting = get_setting
1 备注
形象
丢弃
形象
odoo
-

Good, It can be done by onchange also as per reference of my previous answer.
Your get_values method is not called form any where. It will solved your issue if you call the get_value method.

0
形象
odoo
最佳答案

Hi Muhammad Imron,

Can you please tell me when you "get_values" method called ?

Also use the IrConfigParam as it is created in the database.

Please use this reference.

形象
丢弃