Hello! I need to add a new record to the ir_config_parameter table, but I want to make a check for the presence of this record and if it does not exist, then write it, and if it already exists, then do nothing. Also, I do not understand a bit how to correctly refer to this table env ['ir.config_parameter'] or env ['ir_config_parameter']. And do I need to be inherited in my model from ir.config_parameter or something else to make it work
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- ลูกค้าสัมพันธ์
- e-Commerce
- ระบบบัญชี
- สินค้าคงคลัง
- PoS
- Project
- MRP
คำถามนี้ถูกตั้งค่าสถานะ
Hello,
you no need to inherit this module into your module.
for create record into this model: this set_param method will check that the key is exist or not, if not then it will create automatically.
=> self.env['ir.config_parameter'].sudo().set_param(your_keyname, your_value)
for get the value from ir.config.parameter
=> value = self.env['ir.config_parameter'].sudo().get_param(your_keyname)
I hope this will helps you.
how can I check availability of this record before creation?
set_param method is already checking. if not exist then it will create.
but if you still want to check see the method set_param. into that you can find the code like param = self.search([('key', '=', key)])
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
Odoo Mail Sending Limit
แก้ไขแล้ว
|
|
2
ธ.ค. 23
|
14717 | |
|
0
ต.ค. 23
|
33 | ||
|
3
ต.ค. 23
|
788 | ||
|
1
ต.ค. 23
|
569 | ||
|
1
ส.ค. 23
|
2450 |