Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
7815 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ

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

Tác giả

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

Tác giả

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

Tác giả

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

Tác giả

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

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 11 22
7341
1
thg 4 19
5011
Validation Error Đã xử lý
4
thg 7 25
4811
2
thg 12 23
14721
0
thg 10 23
33