Odoo Help

1

android odoo mobile framework

By
Amzz
on 10/14/16, 5:00 AM 474 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.

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

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