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

When I set foo to 0, this error pops up:

The operation cannot be completed:
- Create/update: a mandatory field is not set.
- Delete: another model requires the record being deleted. If possible, archive it instead.

Model: ir.config_parameter (ir.config_parameter), Field: Value (value)

Code:

foo = fields.Integer()

@api.multi
def set_values(self):
  ir_config_param_obj = self.env['ir.config_parameter'].sudo()
  ir_config_param_obj.set_param('my_module.foo', self.foo)

Why is this and how can I set the value to 0?

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

I solved it by using 'ir.values' instead of 'ir.config_parameter'

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

I hope it will help you to understand https://www.odoo.com/forum/help-1/question/how-to-use-the-default-settings-value-in-custom-module-field-128543

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
How to read a configuration setting ? แก้ไขแล้ว
4
ก.พ. 17
13440
2
เม.ย. 25
1343
5
มี.ค. 25
17094
1
มิ.ย. 24
1238
I can't open setting แก้ไขแล้ว
1
พ.ค. 24
970