Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
2972 Vizualizări

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

Imagine profil
Abandonează
Autor

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

Cel mai bun răspuns

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

Imagine profil
Abandonează

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.