Skip to Content
Menu
This question has been flagged
2 Replies
23073 Views

The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a record while other records still reference it
- creation/update: a mandatory field is not correctly set

[object with reference: name - name]


this error is showing in my custom module ,i inherited maintenance.equipment table.

Avatar
Discard
Best Answer

Hi,

You are getting this error because the value for a required field is not given. Check your custom module or code. So that on creating record in the model named 'maintenance.equipment' whether value is given for the field named 'name'.

See this: How To Fix Mandatory Field is Not Correctly Set Error in Odoo


Thanks

Avatar
Discard
Best Answer

Hi,

I had the same error when I was doing any actions on the x2many fields in my self-written module. Because with them it is necessary to work by certain rules, delete, create, etc.

To fill or manipulate one2many or many2many field with according values (records) you need to use special command as says below.

This format is a list of triplets executed sequentially, where each triplet is a command to execute on the set of records. Not all commands apply in all situations. Possible commands are:

(0, _, values) adds a new record created from the provided value dict.

(1, id, values) updates an existing record of id id with the values in values. Can not be used in ~.create.

(2, id, _) removes the record of id id from the set, then deletes it (from the database). Can not be used in ~.create.

(3, id, _) removes the record of id id from the set, but does not delete it. Can not be used on ~openerp.fields.One2many. Can not be used in ~.create.

(4, id, _) adds an existing record of id id to the set. Can not be used on ~openerp.fields.One2many.

(5, _, _) removes all records from the set, equivalent to using the command 3 on every record explicitly. Can not be used on ~openerp.fields.One2many. Can not be used in ~.create.

(6, _, ids) replaces all existing records in the set by the ids list, equivalent to using the command 5 followed by a command 4 for each id in ids. Can not be used on ~openerp.fields.One2many.

Avatar
Discard