fix id_condition for models with different primary key