Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
3002 มุมมอง

i have an integer field and put the required condition so : [["category_id","in",[2]]], but in can let the integer field to 0 : it is accepted

with required condition on in text (char) field : [["category_id","in",[2]]]  : the field is really required when the condition is met

can you help please ?

Thanks

Denis

อวตาร
ละทิ้ง
ผู้เขียน

thanks but i am looking for a solution within Studio, not with a purchase of an external module.

คำตอบที่ดีที่สุด

Try Using -> https://apps.odoo.com/apps/modules/16.0/entrivis_required_numeric/

--
Meet Dholakia
www.entrivistech.com

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello Henkens Denis,

Please find below code it may help you to resolve this issue.

Please find Example in comment. 

I hope this can help you.

Thanks & Regards,
Email:   odoo@aktivsoftware.com 

Skype: kalpeshmaheshwari

อวตาร
ละทิ้ง

Please find code here :-

For integer field required, you need to add integer field in your object, and set the required parameter in field.

Py file code:

field_name = fields.Integer(string="Field Name" required=True)
when you are required integer field by py file, that field required in database and view both side.

xml file code:

<field name="field_name" required=1/>
when you are required integer field by xml file, that field required only for view not database.

Hi Jainesh, The idea that you are presenting is very basic for other datatype fields. However, It will not work if Integer and Float fields are required while saving records.