{"action":"created","issue":{"url":"https://api.github.com/repos/Odoo-mobile/framework/issues/138","repository_url":"https://api.github.com/repos/Odoo-mobile/framework","labels_url":"https://api.github.com/repos/Odoo-mobile/framework/issues/138/labels{/name}","comments_url":"https://api.github.com/repos/Odoo-mobile/framework/issues/138/comments","events_url":"https://api.github.com/repos/Odoo-mobile/framework/issues/138/events","html_url":"https://github.com/Odoo-mobile/framework/issues/138","id":145647866,"number":138,"title":"Why framework is looking for relation table for inserting OneToMany record.","user":{"login":"kasim1011","id":7657803,"avatar_url":"https://avatars.githubusercontent.com/u/7657803?v=3","gravatar_id":"","url":"https://api.github.com/users/kasim1011","html_url":"https://github.com/kasim1011","followers_url":"https://api.github.com/users/kasim1011/followers","following_url":"https://api.github.com/users/kasim1011/following{/other_user}","gists_url":"https://api.github.com/users/kasim1011/gists{/gist_id}","starred_url":"https://api.github.com/users/kasim1011/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kasim1011/subscriptions","organizations_url":"https://api.github.com/users/kasim1011/orgs","repos_url":"https://api.github.com/users/kasim1011/repos","events_url":"https://api.github.com/users/kasim1011/events{/privacy}","received_events_url":"https://api.github.com/users/kasim1011/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-04-04T10:47:34Z","updated_at":"2016-04-04T12:34:08Z","closed_at":null,"body":"I've two `Models` called `HrAttendance` and `AttReport`. here's they are:\r\n\r\n    public class AttReport extends OModel {\r\n\r\n        public static final String TAG = AttReport.class.getSimpleName();\r\n\r\n        OColumn lat = new OColumn(\"Latitude\", OFloat.class);\r\n        OColumn lng = new OColumn(\"Longitude\", OFloat.class);\r\n        OColumn employee_id = new OColumn(\"Name\", HrEmployee.class,\r\n                OColumn.RelationType.ManyToOne);\r\n\r\n        OColumn date_reported = new OColumn(\"Date Reported\", ODate.class);\r\n        OColumn date_reporting = new OColumn(\"Date Reporting\", ODateTime.class);\r\n        OColumn hr_attendance_ids = new OColumn(\"Order Lines\", HrAttendance.class,\r\n                OColumn.RelationType.OneToMany)\r\n                .setRelatedColumn(\"attendance_report_id\");\r\n\r\n        public AttReport(Context context, OUser user) {\r\n            super(context, \"attendance.report\", user);\r\n        }\r\n    }\r\n\r\n\r\n    public class HrAttendance extends OModel {\r\n\r\n        public static final String TAG = HrAttendance.class.getSimpleName();\r\n\r\n        OColumn employee_id = new OColumn(\"Name\", HrEmployee.class,\r\n            OColumn.RelationType.ManyToOne);\r\n        OColumn name = new OColumn(\"Date\", ODateTime.class);\r\n        OColumn state = new OColumn(\"State\", OSelection.class)\r\n                .addSelection(\"sign_in\", \"Sign In\")\r\n                .addSelection(\"sign_out\", \"Sign Out\");\r\n        OColumn attendance_report_id = new OColumn(\"Name\", AttReport.class,\r\n                OColumn.RelationType.ManyToOne);\r\n\r\n        public HrAttendance(Context context, OUser user) {\r\n            super(context, \"hr.attendance\", user);\r\n        }\r\n\r\n    }\r\n\r\nNow, when I'm attempting to insert data in `AttReport` table. framework says `no such table: attendance_report_hr_attendance_rel`\r\n\r\nhere's code:\r\n\r\n    AttReport report = new AttReport(getContext(), user());\r\n    JSONArray hrAttendanceIDs = new JSONArray()\r\n            .put(8)\r\n            .put(\"2016-04-03 15:28:30\")\r\n            .put(\"sign_in\");\r\n    OValues values = new OValues();\r\n    values.put(\"lat\", 0f);\r\n    values.put(\"lng\", 0f);\r\n    values.put(\"date_reported\", \"2016-04-03\");\r\n    values.put(\"employee_id\", 8);\r\n    values.put(\"hr_attendance_ids\", hrAttendanceIDs);\r\n\r\n    Log.e(TAG, \"Values before inserting: \" + values.toString());\r\n    Log.e(TAG, \"newID\" + report.insert(values));\r\n\r\nhere's the Log:\r\n  \r\n    E/Employees: Values before inserting: {hr_attendance_ids=[8,\"2016-04-03 15:28:30\",\"sign_in\"], date_reported=2016-04-03, lat=0.0, employee_id=8, lng=0.0}\r\n    I/AccountManagerService: getTypesVisibleToCaller: isPermitted? false\r\n    E/SQLiteLog: (1) no such table: attendance_report_hr_attendance_rel // <--This one\r\n    D/AndroidRuntime: Shutting down VM\r\n    E/AndroidRuntime: FATAL EXCEPTION: main\r\n                      Process: com.serpentcs.saltracker, PID: 4500\r\n                      android.database.sqlite.SQLiteException: no such table: attendance_report_hr_attendance_rel (code 1): , while compiling: DELETE FROM attendance_report_hr_attendance_rel WHERE attendance_report_id = ?\r\n                          at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)\r\n                          at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:887)\r\n                          at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:498)\r\n                          at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)\r\n                          at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)\r\n                          at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)\r\n                          at android.database.sqlite.SQLiteDatabase.delete(SQLiteDatabase.java:1496)\r\n                          at com.odoo.core.orm.OModel.storeManyToManyRecord(OModel.java:953)\r\n                          at com.odoo.core.orm.provider.BaseModelProvider.storeUpdateRelationRecords(BaseModelProvider.java:253)\r\n                          at com.odoo.core.orm.provider.BaseModelProvider.insert(BaseModelProvider.java:166)\r\n                          at android.content.ContentProvider$Transport.insert(ContentProvider.java:263)\r\n                          at android.content.ContentResolver.insert(ContentResolver.java:1231)\r\n                          at com.odoo.core.orm.OModel.insert(OModel.java:799)\r\n                          at com.odoo.addons.employees.Employees.onViewCreated(Employees.java:119)\r\n                          at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)\r\n                          at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)\r\n                          at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)\r\n                          at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)\r\n                          at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)\r\n                          at android.os.Handler.handleCallback(Handler.java:739)\r\n                          at android.os.Handler.dispatchMessage(Handler.java:95)\r\n                          at android.os.Looper.loop(Looper.java:148)\r\n                          at android.app.ActivityThread.main(ActivityThread.java:5417)\r\n                          at java.lang.reflect.Method.invoke(Native Method)\r\n                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)\r\n                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)\r\n\r\nI can't figure out what's going on. any kind of help or suggestions are welcome."},"comment":{"url":"https://api.github.com/repos/Odoo-mobile/framework/issues/comments/205277057","html_url":"https://github.com/Odoo-mobile/framework/issues/138#issuecomment-205277057","issue_url":"https://api.github.com/repos/Odoo-mobile/framework/issues/138","id":205277057,"user":{"login":"kasim1011","id":7657803,"avatar_url":"https://avatars.githubusercontent.com/u/7657803?v=3","gravatar_id":"","url":"https://api.github.com/users/kasim1011","html_url":"https://github.com/kasim1011","followers_url":"https://api.github.com/users/kasim1011/followers","following_url":"https://api.github.com/users/kasim1011/following{/other_user}","gists_url":"https://api.github.com/users/kasim1011/gists{/gist_id}","starred_url":"https://api.github.com/users/kasim1011/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kasim1011/subscriptions","organizations_url":"https://api.github.com/users/kasim1011/orgs","repos_url":"https://api.github.com/users/kasim1011/repos","events_url":"https://api.github.com/users/kasim1011/events{/privacy}","received_events_url":"https://api.github.com/users/kasim1011/received_events","type":"User","site_admin":false},"created_at":"2016-04-04T12:34:07Z","updated_at":"2016-04-04T12:34:07Z","body":"@saltracker I've created demo app dedicated to this issue for you. please have a [look](https://github.com/kasim1011/Odoo-mobile-sample)"}}