Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
1207 มุมมอง

hello,

i add a parameter to config setting , i want be true as defualt i add defualt = True to field but i could not chang the value later it still true 

class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'

full_hide = fields.Boolean(string='Full hide',config_parameter='sd_module.full_hide',default=True)

 then how can i get this value in form in another module form

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

@Sunny Sheth

thank you i try it and it work fine 
how can i get the value of parameter in another xml model form

อวตาร
ละทิ้ง

Hi,

you can get values in another model for the above config_parameter field

self.env['ir.config_parameter'].sudo().get_param('sd_module.full_hide')

Thanks & Regards

ผู้เขียน

can i use this code in xml

Yes, you can use similar way in XML and you can get some example in Odoo source code as well.

คำตอบที่ดีที่สุด
Hi nohaAhmad,

you can remove default parameter from python level and add default value from the data file.

<record id="enable_full_hide" model="ir.config_parameter" >
<field name="key">sd_module.full_hide</field>
<field name="value">True</field>
</record>

either you can try via below code as well if above not works in your case

<function model="ir.config_parameter" name="set_param" eval="('sd_module.full_hide', 'True')"/>


Best Regards,
Sunny Sheth (shethsunny555@gmail.com)




อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Parallel Currency feature in Odoo แก้ไขแล้ว
3
เม.ย. 24
2732
1
ต.ค. 17
5101