Reputation: 135
this is my fragment i put information in list view
@Override
public void onViewBind(View view, Cursor cursor, ODataRow row) {
OControls.setText(view, R.id.name, row.getString("name"));
OControls.setText(view, R.id.email, row.getString("message"));
(ligne 131) ODataRow resPartnerRow =
row.getM2ORecord("student_id").browse();
OControls.setText(view, R.id.company_name, resPartnerRow.getString("Name"));
}
and this is the class i retrive informations from table
public class Sanction extends OModel {
public static final String TAG = Sanction.class.getSimpleName();
public static final String AUTHORITY = "com.odoo.Etudiant";
OColumn message = new OColumn("message", OText.class).setRequired();;
OColumn type_id= new OColumn("type_id", typee.class,
OColumn.RelationType.ManyToOne);
OColumn student_id = new OColumn("Name", ResPartner.class,
OColumn.RelationType.ManyToOne);
he shows me
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.ClassCastException: java.lang.Integer cannot be cast to
com.odoo.core.orm.OM2ORecord
at
com.odoo.core.orm.ODataRow.getM2ORecord(ODataRow.java:69)
at
com.odoo.Etudiant.Student.onViewBind(PersonFragement.java:131)
what can i do to show the name not id
Upvotes: 0
Views: 94
Reputation: 251
it means it is returning direct id of that particular student.
so now do two things check that it is returning the integer or not.if yes you are getting id directly(i think it's a bug of odoo mobile framework :p) and if not then your code for student_id
will work.
Upvotes: 0