تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
7759 أدوات العرض

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

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

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

الصورة الرمزية
إهمال

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

الكاتب

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

الكاتب

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

الكاتب

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

الكاتب

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

أفضل إجابة

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
نوفمبر 22
7297
1
أبريل 19
4966
Validation Error تم الحل
4
يوليو 25
4730
2
ديسمبر 23
14646
0
أكتوبر 23
33