Skip to Content
Menu
This question has been flagged

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
Discard
Author Best Answer

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

Avatar
Discard

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

Author

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

Author

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

Author

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

Author

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

Best Answer

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
Discard
Related Posts Replies Views Activity
1
Nov 22
5747
1
Apr 19
3925
5
Jun 24
1567
2
Dec 23
11994
0
Oct 23
33