Ir al contenido
Menú
Se marcó esta pregunta

I have created a new module to display,create,edit and delete records on (project.task) model using Odoo Mobile framework 

https://github.com/Odoo-mobile/framework

public class ProjectTask extends OModel {

public static final String TAG = ProjectTask.class.getSimpleName();
public static final String AUTHORITY = "com.odoo.addons.projects.project_tasks";

OColumn name = new OColumn("Name", OVarchar.class).setSize(100);
OColumn project_id = new OColumn("Project", ProjectProject.class, OColumn.RelationType.ManyToOne);
OColumn description = new OColumn("Description", OText.class);

public ProjectTask(Context context, OUser user) {
super(context, "project.task", user);
setHasMailChatter(true);
}

@Override
public Uri uri() {
return buildURI(AUTHORITY);
}
}


and another model to view projects in the ManyToOne field (project_id)

public class ProjectProject extends OModel {
public static final String TAG = ProjectProject.class.getSimpleName();

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

public ProjectProject(Context context, OUser user) {
super(context, "project.project", user);
}

}


and when i defined the editable field (project_id) in the layout i made sure to add app:widgetType="SearchableLive" 

in order to use the selection widget to select projects 

<odoo.controls.OField
android:id="@+id/edit_project_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:controlLabel="Project"
app:fieldName="project_id"
app:fieldTextAppearance="?android:textAppearanceMedium"
app:widgetType="SearchableLive"></odoo.controls.OField>


ut the field appears only as the integer id of the selected projected as shown in this screen shot ! 

https://drive.google.com/file/d/1RqAB_Z6TiOZ_OaY2FsKfvBKfwAhXI4ky/view?usp=sharing


how can i fix this code so that the project name appears in the form and when i click on this editable field it goes to a search view and select the desired project the same way as country_id in res.partner as shown in the following screen shots ??

https://drive.google.com/file/d/1llaOGHN8rCXZVBPZK5BP_4Ktjyh7QFVf/view?usp=sharing


and when i click on country this search view appears ?


https://drive.google.com/file/d/1PhUBHZMNlPv3i3ESeolj5PdD3l77iymZ/view?usp=sharing

















Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
oct 20
3179
4
sept 20
9088
1
ago 17
3658
1
mar 15
6160
0
mar 15
3028