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

When i try to install custom module it says 

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: Warehouse (stock.warehouse), Field: Company (company_id)

my odoo version is 12.

Please help me how i can fix it with example.

Thanks

Muhammad Imran

Avatar
Ignorer
Auteur Meilleure réponse

Dear Sir i have not did anything i have not deleted any records i have not made any changes in it.

Avatar
Ignorer

Okay, as you have mentioned when installing custom module, it can be the issue with one who developed it right ? We cannot say all the custom modules are 100% working, there are modules with issues. Just make sure that the module is installed in correct version. Also check the first case am mentioned, regarding the mandatory fields. Or share the link of module here

Auteur

When i have created it. That time it was working fine. suddenly it stop working and give me above mentioned error.

Auteur

Sorry i can not share it with you because it is not live yet. it's on localhost.

Then check the data files, there might be some data creating in the model stock.warehouse

Auteur

Yes i am getting this error psycopg2.IntegrityError: null value in column "company_id" violates not-null constraint

DETAIL: Failing row contains (4, Your New barcode Company, t, null, 43, 44, 45, Your , one_step, ship_only, 46, 47, 48, 49, 16, 18, 19, 17, 16, 20, 13, 11, 12, 1, 2019-12-13 10:53:01.371073, 1, 2019-12-13 10:53:01.371073).

CONTEXT: SQL statement "UPDATE ONLY "public"."stock_warehouse" SET "company_id" = NULL WHERE $1 OPERATOR(pg_catalog.=) "company_id""

when i run odoo in pycharm. In which data file i have to check.

You have to provide the value for company_id field. if you check the video you will understand the issue

Auteur

Yes i have checked that video but i am confused where i have to provide the value for company_id field because in my created mode there is not any function to pass values like mentioned in video.

The video is case of creating record from python code, in your case it is xml file

Meilleure réponse

Hi,

If you are loading some data into the system from the data files, make sure that the values for all the required fields are given or not.

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

Or if you are deleting some records then that record might be referenced in some another tables, so you cannot delete it, unless you remove all the references first, which is not possible/good, instead of it, you can archive the record that you are trying to delete.

Thanks

Avatar
Ignorer
Publications associées Réponses Vues Activité
1
nov. 22
7298
1
avr. 19
4968
4
juil. 25
4733
2
déc. 23
14648
0
oct. 23
33