Browse Source

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

pull/1128/head
Alexis de Lattre 8 years ago
committed by Andrea
parent
commit
97d31839aa
  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():
if fieldname not in record:
column = model._fields[fieldname]
if column.type == 'many2one':
if value and column.type == 'many2one':
value = value[0] # many2one are tuple (id, name)
new_values[fieldname] = value
return new_values

Loading…
Cancel
Save