Skip to content

Commit

Permalink
fixes invalid relation in search form
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored and nyalldawson committed Jul 7, 2020
1 parent c28ed4a commit 78e08c3
Showing 1 changed file with 3 additions and 0 deletions.
Expand Up @@ -207,6 +207,9 @@ void QgsRelationReferenceSearchWidgetWrapper::initWidget( QWidget *editor )
}

QgsRelation relation = QgsProject::instance()->relationManager()->relation( config( QStringLiteral( "Relation" ) ).toString() );
// if no relation is given from the config, fetch one if there is only one available
if ( !relation.isValid() && !layer()->referencingRelations( mFieldIdx ).isEmpty() && layer()->referencingRelations( mFieldIdx ).count() == 1 )
relation = layer()->referencingRelations( mFieldIdx )[0];
mWidget->setRelation( relation, false );

mWidget->showIndeterminateState();
Expand Down

0 comments on commit 78e08c3

Please sign in to comment.