This question has been flagged
3 Replies
2313 Views

  <field name="file_type"  attrs="{'readonly':[('field_type','!=', False)]}" on_change="onchange_file_type(file_type)" />

it causes the error as follows,

Uncaught Error: Unknown field field_type in domain [["field_type","!=",false]]

 

Avatar
Discard

[["field_type","!=",false]] or [["file_type","!=",false]] ??

Author

What??

Best Answer

you can use this in the xml.view.

<field name="field_type"/>

<field name="file_type"  attrs="{'readonly':[('field_type','=True)]}" on_change="onchange_file_type(file_type)" />

Avatar
Discard
Best Answer

I think there is no field named field_type. it should be file type. just change your attrs like

attrs="{'readonly':[('file_type','!=', False)]}"

or
if you have field_type field on your model, then put it in the form view. you can make it invisible.

Avatar
Discard
Best Answer

[Note: Is there a field "field_type" defined in your object
If field is unavailable, then modify your 

<field name="file_type"  attrs="{'readonly':[('file_type','!=', False)]}" on_change="onchange_file_type(file_type)" />
]

field_type  needs to be defined in your FORM view.

Generally,
when we try to use a field in the domain, it needs to be defined in its respective view.  Also, it works even if the field is hidden
<field name="field_type" invisible="1" />

Avatar
Discard
Author

It works .. but when i try to save the following error occured,Integrity Error:The operation cannot be completed, probably due to the following:- deletion: you may be trying to delete a record while other records still reference it - creation/update: a mandatory field is not correctly set [object with reference: file_type - file.type]