Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
10597 Vues

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?

Avatar
Ignorer
Auteur Meilleure réponse

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

Avatar
Ignorer
Meilleure réponse

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

Avatar
Ignorer
Publications associées Réponses Vues Activité
4
févr. 17
14063
2
avr. 25
2455
5
mars 25
18938
1
juin 24
1833
1
mai 24
1802