コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
10586 ビュー

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

アバター
破棄
関連投稿 返信 ビュー 活動
4
2月 17
14057
2
4月 25
2448
5
3月 25
18930
1
6月 24
1830
1
5月 24
1798