I have some 5 fields.
field_1: fields.char("Field")
field_2: fields.char("Field")
field_3: fields.char("Field")
field_4: fields.char("Field")
field_5: fields.selection((('Incomplete','Incomplete'),('Completed','Completed')),'Field'),
By default field_5 will always be 'Incomplete':
_defaults = {
'field_5': 'Incomplete',
}
My query is when all four fields has values, field_5 should automatically change to 'Completed' How to do this?
I had written an on_change function:
def on_change_module_code(self, cr, uid, ids, field_1,field_2,field_3,field_4):
if field_1 :
return {'value': {'field_5': 'Completed'}}
if field_2 :
return {'value': {'field_5': 'Completed'}}
if field_3 :
return {'value': {'field_5': 'Completed'}}
if field_4 :
return {'value': {'field_5': 'Completed'}}
And in XML:
<field name="field_1" on_change="on_change_module_code(field_1,field_2,field_3,field_4)"/>;
Here when i enter first field, data is turning to 'Completed'. But it should turn to 'Completed' when all the fields has value.
How to do this?