Skip to Content
Menu
This question has been flagged
2 Replies
2679 Views

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

Avatar
Discard
Author

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

Best Answer

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

Avatar
Discard

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.