Odoo Help


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.


How to create two Odoo many2many fields of same class in one Omodel in Andriod

Bipin Prajapati
on 3/29/16, 9:40 AM 286 views
public class AttendanceReport extends OModel {

public static final String TAG = AttendanceReport.class.getSimpleName();
public static final String AUTHORITY = "com.odoo.addons.hremployee.att_report";

OColumn employee_present_ids = new OColumn("Employees present", HrEmployee.class,
OColumn lat = new OColumn("Latitude", OFloat.class);
OColumn lng = new OColumn("Longitude", OFloat.class);
OColumn employee_id = new OColumn("Name", HrEmployee.class, OColumn.RelationType.ManyToOne);
OColumn date_reported = new OColumn("Date Reported", ODate.class);
OColumn date_reporting = new OColumn("Date Reporting", ODate.class);
OColumn employee_absent_ids = new OColumn("Employees absent", HrEmployee.class,

public AttendanceReport(Context context,  OUser user) {
    super(context, "attendance.report", user);

I have created a model named 'attendance.report'. Inside it, I have created two many2many (employee_present_ids & employee_absent_ids).

Both Many2many belong to HrEmployee.class.

Now when i execute this code(app), only one table named 'attendance_report_hr_empoyee_rel' is created in local database.

In python we can give many2many table name while field declaration.

Please guide me, How to create two manymany fields of same class in one Omodel?

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)


Asked: 3/29/16, 9:40 AM
Seen: 286 times
Last updated: 3/29/16, 10:41 AM