Odoo-mobile / framework

Odoo Mobile Framework
https://play.google.com/store/apps/dev?id=8607973775002477408
Other
327 stars 374 forks source link

getDefaultNameColumn is not always returning "name" #342

Open Mraimou opened 6 years ago

Mraimou commented 6 years ago

Hello! I'm getting the error "no such column" while diplaying a ManyToOne field , when i read the code I found a call to a function getDefaultNameColumn that returns "name" but in my model I have no column named "name". I want to add the field _rec_name to get the record name for each model and then pass it to the function "getDefaultNameColumn", can I access the field _rec_name by ORM or i should create it and where? This is how I fixed the problem but I'm looking for a better solution. Class: OModel

private String default_name_column = "name";
private String name_column = "my_model_name";
private List<String> MyModels = Arrays.asList("modelA", "modelB","modelC");
public String getDefaultNameColumn() {
        String  name;
        if (MyModels.contains(model_name) == true )
            {name= name_column;}
        else
            {name= default_name_column;}
        return name;
    }