Browse Source

[FIX] avoid a crash when value is False for a M2O field

pull/1461/head
Alexis de Lattre 8 years ago
committed by sbejaoui
parent
commit
e681d9b80e
  1. 2
      onchange_helper/models/ir_rule.py

2
onchange_helper/models/ir_rule.py

@ -12,7 +12,7 @@ def get_new_values(model, record, on_change_result):
for fieldname, value in vals.iteritems(): for fieldname, value in vals.iteritems():
if fieldname not in record: if fieldname not in record:
column = model._fields[fieldname] column = model._fields[fieldname]
if column.type == 'many2one':
if value and column.type == 'many2one':
value = value[0] # many2one are tuple (id, name) value = value[0] # many2one are tuple (id, name)
new_values[fieldname] = value new_values[fieldname] = value
return new_values return new_values

Loading…
Cancel
Save