Community mailing list archives

community@mail.odoo.com

Many2One Issue in framework 1.0 of odoo-mobile

by
Devang Pipaliya
- 07/30/2015 02:07:33
Hello !

I am using Odoo-mobile framework 1.0 with odoo v8 on server side.
The issue I am facing is in odoo v8,
 "**stock.warehouse**" has a _many2one filed relating to_ "**stock.picking.type**", and,
"**stock.picking.type**" also has a _many2one field relating to_ "**stock.warehouse**".
A kind of loop.

So when ever I start syncing the data in app or I install the app for very first time,  I am getting this error:
```
03-31 05:32:38.769: E/AndroidRuntime(1468): FATAL EXCEPTION: AsyncTask #5
03-31 05:32:38.769: E/AndroidRuntime(1468): Process: com.odoo, PID: 1468
03-31 05:32:38.769: E/AndroidRuntime(1468): java.lang.RuntimeException: An error occured while executing doInBackground()
03-31 05:32:38.769: E/AndroidRuntime(1468):     at android.os.AsyncTask$3.done(AsyncTask.java:300)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at java.util.concurrent.FutureTask.run(FutureTask.java:242)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at java.lang.Thread.run(Thread.java:841)
03-31 05:32:38.769: E/AndroidRuntime(1468): Caused by: java.lang.StackOverflowError
03-31 05:32:38.769: E/AndroidRuntime(1468):     at java.util.GregorianCalendar.computeFields(GregorianCalendar.java:573)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at java.util.Calendar.complete(Calendar.java:830)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at java.util.Calendar.setTimeInMillis(Calendar.java:1195)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at java.util.GregorianCalendar.<init>(GregorianCalendar.java:331)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at java.util.GregorianCalendar.<init>(GregorianCalendar.java:231)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at java.text.SimpleDateFormat.set2DigitYearStart(SimpleDateFormat.java:1262)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at org.apache.http.impl.cookie.DateUtils.parseDate(DateUtils.java:158)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at org.apache.http.impl.cookie.DateUtils.parseDate(DateUtils.java:115)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at org.apache.http.impl.cookie.BasicExpiresHandler.parse(BasicExpiresHandler.java:58)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at org.apache.http.impl.cookie.CookieSpecBase.parse(CookieSpecBase.java:95)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at org.apache.http.impl.cookie.NetscapeDraftSpec.parse(NetscapeDraftSpec.java:144)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at org.apache.http.impl.cookie.BestMatchSpec.parse(BestMatchSpec.java:125)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at org.apache.http.client.protocol.ResponseProcessCookies.processCookies(ResponseProcessCookies.java:120)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at org.apache.http.client.protocol.ResponseProcessCookies.process(ResponseProcessCookies.java:101)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at org.apache.http.protocol.BasicHttpProcessor.process(BasicHttpProcessor.java:304)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at org.apache.http.protocol.HttpRequestExecutor.postProcess(HttpRequestExecutor.java:319)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:464)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at asd.odoo.Odoo.requestData(Odoo.java:253)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at asd.odoo.Odoo.search_read(Odoo.java:597)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.syncWithServer(OEHelper.java:271)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.handleResultArray(OEHelper.java:317)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.syncWithServer(OEHelper.java:274)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.handleResultArray(OEHelper.java:317)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.syncWithServer(OEHelper.java:274)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.handleResultArray(OEHelper.java:317)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.syncWithServer(OEHelper.java:274)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.handleResultArray(OEHelper.java:317)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.syncWithServer(OEHelper.java:274)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.handleResultArray(OEHelper.java:317)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.syncWithServer(OEHelper.java:274)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.handleResultArray(OEHelper.java:317)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.syncWithServer(OEHelper.java:274)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.handleResultArray(OEHelper.java:317)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.syncWithServer(OEHelper.java:274)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.handleResultArray(OEHelper.java:317)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.syncWithServer(OEHelper.java:274)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.handleResultArray(OEHelper.java:317)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.syncWithServer(OEHelper.java:274)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.handleResultArray(OEHelper.java:317)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.syncWithServer(OEHelper.java:274)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.handleResultArray(OEHelper.java:317)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.syncWithServer(OEHelper.java:274)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.handleResultArray(OEHelper.java:317)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo.orm.OEHelper.syncWithServer(OEHelper.java:274)
03-31 05:32:38.769: E/AndroidRuntime(1468):     at com.odoo
03-31 05:32:39.765: E/WindowManager(1468): android.view.WindowLeaked: Activity com.odoo.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{529b85f4 V.E..... R......D 0,0-729,324} that was originally added here
03-31 05:32:39.765: E/WindowManager(1468):  at android.view.ViewRootImpl.<init>(ViewRootImpl.java:346)
03-31 05:32:39.765: E/WindowManager(1468):  at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:248)
03-31 05:32:39.765: E/WindowManager(1468):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
03-31 05:32:39.765: E/WindowManager(1468):  at android.app.Dialog.show(Dialog.java:286)
03-31 05:32:39.765: E/WindowManager(1468):  at com.odoo.addons.stock.InternalShipment$StockLoader.onPreExecute(InternalShipment.java:341)
03-31 05:32:39.765: E/WindowManager(1468):  at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:587)
03-31 05:32:39.765: E/WindowManager(1468):  at android.os.AsyncTask.execute(AsyncTask.java:535)
03-31 05:32:39.765: E/WindowManager(1468):  at com.odoo.addons.stock.InternalShipment.onCreate(InternalShipment.java:79)
03-31 05:32:39.765: E/WindowManager(1468):  at android.support.v4.app.Fragment.performCreate(Fragment.java:1437)

```

Due to recursive many2one fields in "**stock.picking.type**" and "**stock.picking.type**" on server side, the *syncWithServer* method is also going into loop with *handleResultArray*..... you can see there is toooo many log entries for *syncWithServer* and *HandleResultArray*. and the model names inside syncWithServer method are given below....
```

03-31 07:57:55.661: D/com.odoo.orm.OEHelper(1141): Model: stock.picking
03-31 07:57:55.717: D/com.odoo.orm.OEHelper(1141): Model: stock.move
03-31 07:57:55.773: D/com.odoo.orm.OEHelper(1141): Model: product.product
03-31 07:57:56.273: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:56.297: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:56.309: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:56.325: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:56.565: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:56.585: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:56.597: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:56.613: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:56.629: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:56.665: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:56.677: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:56.693: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:56.709: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:56.725: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:56.741: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:56.757: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:56.773: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:56.793: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:56.805: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:56.821: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:56.837: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:56.861: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:56.877: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:56.889: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:56.901: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:56.917: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:56.929: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:56.945: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:56.957: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:56.977: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:56.985: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:57.001: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:57.013: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:57.029: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:57.041: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:57.057: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:57.069: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:57.089: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:57.097: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:57.113: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:57.125: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:57.141: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:57.157: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:57.177: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:57.193: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:57.209: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:57.217: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:57.233: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:57.245: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:57.261: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:57.273: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:57.293: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse
03-31 07:57:57.305: D/com.odoo.orm.OEHelper(1141): Model: stock.picking.type
03-31 07:57:57.349: D/com.odoo.orm.OEHelper(1141): Model: stock.warehouse

```
Have you guys ever faced this kind of scenario? Can you guys provide a solution or guidance or any better alternative for this situation?

--
Thanks & regards,
Devang Pipaliya.


​--
Regards,
 
--
 
Devang Pipaliya
http://about.me/DevanGPipaliyA
 
​" Have a nice rest of the remaining day ! "​​