Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

android odoo mobile framework

By
Amzz
on 10/14/16, 5:00 AM 202 views

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.

1
Dharmang Soni (dpr)
On 10/17/16, 2:17 AM

Try with 

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

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 10/14/16, 5:00 AM
Seen: 202 times
Last updated: 10/20/16, 6:03 AM