From 97d31839aa3368a6504ab2fa4b9833bc528c2bce Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 28 Feb 2017 09:01:00 +0100 Subject: [PATCH] [FIX] avoid a crash when value is False for a M2O field --- onchange_helper/models/ir_rule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onchange_helper/models/ir_rule.py b/onchange_helper/models/ir_rule.py index 4a20ef0dc..b4f67af16 100644 --- a/onchange_helper/models/ir_rule.py +++ b/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