Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
2988 Prikazi

There are 2 models in my application

 public class FirstClass extends OModel {

public static final String AUTHORITY = "com.odoo.addons.O2M.first_class";

OColumn name = new OColumn("First Name", OVarchar.class);

OColumn password = new OColumn("Password", OVarchar.class);

OColumn bottles = new OColumn("Bottles",SecClass.class, OColumn.RelationType.OneToMany).setRelatedColumn("bottle_ids");

public FirstClass(Context context, OUser user) {

super(context,"first.class", user);

}

@Override

public Uri uri() {

return buildURI(AUTHORITY); }

}

 public class SecClass extends OModel {

OColumn name = new OColumn("Name Second", OVarchar.class);

OColumn bottle_ids = new OColumn("Bottle Ids",FirstClass.class, OColumn.RelationType.ManyToOne);

public SecClass(Context context, OUser user) { super(context,"second.class", user);  }

@Override

public String authority() { return FirstClass.AUTHORITY; } 

I have ODataRow of FirstClass, how can i get row.getO2MRecord("bottles").

An example related to these will be appreciated. 

Thank You.

Avatar
Opusti
Best Answer

Try with 

List<ODataRow> bottles = row.getO2MRecord("bottles").browseEach();

.browseEach() will return record list of related bottles.

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
2
jun. 17
7844
0
nov. 16
3223
0
nov. 16
2713
0
nov. 16
3059
0
nov. 16
3021