[FIX] web: searchpanel: category on m2o with no parent_field

Rev. e264eca enabled the search with 'child_of' operator for
categories on many2one fields. However, it crashed if there is no
parent_field on the comodel.
This commit is contained in:
Aaron Bohy
2019-07-19 08:39:59 +00:00
parent 1c576c8ddf
commit 87f1d1c8a9
2 changed files with 54 additions and 3 deletions
@@ -442,7 +442,7 @@ var SearchPanel = Widget.extend({
var category = self.categories[categoryId];
if (category.activeValueId) {
var field = self.fields[category.fieldName];
var op = field.type === 'many2one' ? 'child_of' : '=';
var op = (field.type === 'many2one' && category.parentField) ? 'child_of' : '=';
domain.push([category.fieldName, op, category.activeValueId]);
}
return domain;