Skip to content

Commit

Permalink
m2o typeahead: fix when related to a relational field
Browse files Browse the repository at this point in the history
  • Loading branch information
wellingguzman committed Mar 18, 2018
1 parent 2b475f6 commit 234ffd8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/core/interfaces/many_to_one_typeahead/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ define(['app', 'handlebars', 'core/UIView', 'utils'], function (app, Handlebars,
afterRender: function () {
var self = this;
var url = app.API_URL + 'tables/' + this.collection.table.id + '/typeahead/';
var model = this.model.get(this.name);
var params = {};
var tableName = this.model.structure.get(this.name).getRelatedTableName();
var table = app.schemaManager.getTable(tableName);

if (this.visibleColumn) {
params.columns = this.visibleColumn;
Expand All @@ -64,8 +65,8 @@ define(['app', 'handlebars', 'core/UIView', 'utils'], function (app, Handlebars,
status = this.options.settings.get('visible_status_ids');
}

if (model.table.hasStatusColumn()) {
params[model.table.getStatusColumnName()] = status;
if (table.hasStatusColumn()) {
params[table.getStatusColumnName()] = status;
}

var urlParams = Utils.encodeQueryParams(params);
Expand Down

0 comments on commit 234ffd8

Please sign in to comment.