Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
10616 Переглядів

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 Відповіді Переглядів Дія
4
лют. 17
14069
2
квіт. 25
2502
5
бер. 25
18972
1
черв. 24
1847
I can't open setting Вирішено
1
трав. 24
1823