SpinSuite in iDempiere

The migration of Adempiere modules to iDempiere

SpinSuite in iDempiere

Postby red1 » Sat Jun 13, 2015 3:27 pm

Privet from Moscow where I am trying out something sexy which is to migrate Yamel Senih's http://www.adempiere.com/SpinSuite directly into iDempiere. Here are the following that i have done so far:

1. Upgrade the mobile side code from Eclipse ADK to Android Studio by IntelliJ. (I will upload the code after some more review and testing and edit which so far is already working very well.)

2. Reviewed and patched a bit the migration scripts (prior for some missing elements, and post for a proper menu display) for the server-side data model with its sample setup data. Download link: http://sourceforge.net/projects/red1/fi ... ration.zip

To understand how this project is designed by Yamel, you can see my 2 years ago review sponsored by SYSNOVA. From there you can see what my next tasks will be:
3. Review and working of webservice plugin
4. Full functional documentation of a full use case scenario.
This effort should take two full months in between my 3 month tour of Russian states.

From the migration scripts link above you can download them, unzip and execute them in your latest iDempiere 2.1/3.0 database. Then run the process-post-migration scripts. You should get the meta-model setup menu showing here.

iSpinMainMenu.png (28.64 KiB) Viewed 13867 times

And also find in the WebServices window:

SpinSuiteWebService.png (72.77 KiB) Viewed 13856 times

Below here are more screenshots:
1. From the Android Studio working environment. It is a very powerful IDE that does many intuitive needed things during Android development and testing. It works very fast with the mobile phone connected.

AndroidStudioiSpin.png (149.49 KiB) Viewed 13865 times

2. Below are screen captures from the mobile phone in action which runs under debug mode from the Android Studio easily.

spin0.png (96.43 KiB) Viewed 13865 times
spin1.png (25.42 KiB) Viewed 13865 times
spin2.png (37.93 KiB) Viewed 13865 times
spin3.png (39.64 KiB) Viewed 13865 times
spin4.png (37.72 KiB) Viewed 13865 times
spin5.png (50.44 KiB) Viewed 13865 times

3. There is a brand new feature from Yamel which is the Business Chat capability using http://www.mqtt.org. It works also off my phone. It not just allow internal chat among sales personnel within ad-hoc groups, but future integration for document and workflow tacking.

bchat.png (86.73 KiB) Viewed 13864 times
Site Admin
Posts: 2762
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: SpinSuite in iDempiere

Postby red1 » Thu Jun 18, 2015 7:17 pm

With the help of the Venezuelan team, Yamel Senih and Carlos Parada, and technical advice from Deepak Pansheriya, I managed to create and export the two plugins for server side and install on a Russian demo site http://demo.palichmos.ru. The InitialLoad web-service is active with the full data model factory loaded. Now it is a matter of going thru a first exciting test trial debugging from an Android phone. (Testing from SOAP UI went thru a good handshake). Sources of server and webservice plugins https://bitbucket.org/red1/ - org.spinsuite - .

FelixConsoleSpinSuiteInstall.png (108.93 KiB) Viewed 13795 times

demoWebService.png (138.18 KiB) Viewed 13811 times

SoapUITesting.png (98.26 KiB) Viewed 13795 times
Site Admin
Posts: 2762
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: SpinSuite in iDempiere

Postby red1 » Thu Jul 16, 2015 8:14 am

1. There are 2 missing fields due to the hardcoded POInfo SPS_Table handling:
Code: Select all
if(isBaseLanguage) {
         if(isBaseLanguage) {
         sql.append("SELECT " +
               "t.IsChangeLog, " +   
               "c.IsAllowLogging "
         //   From
         sql.append("FROM SPS_Table t " +
               "INNER JOIN SPS_Column c ON(c.SPS_Table_ID = t.SPS_Table_ID) ");

2. Then to define those two table colums in WebServiceFieldOutput.
3. GenerateScriptFromTable need parameters and put into menu
4. SystemConfig setting for WS_RECORDS_BY_PAGE = 64
5. Remove Callouts from metadata and transfer to source.
Migration scripts at JIRA ticket
6. Updated source code of web-service changes for iDempiere style login https://idempiere.atlassian.net/browse/IDEMPIERE-2729
Download binary web-service plugins:
server model http://sourceforge.net/projects/red1/fi ... r/download
web-service http://sourceforge.net/projects/red1/fi ... r/download
Site Admin
Posts: 2762
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: SpinSuite in iDempiere

Postby red1 » Thu Jul 23, 2015 4:13 pm

After filling in more missing scripts https://idempiere.atlassian.net/browse/IDEMPIERE-2728
Successfully gone through all three stages of InitialLoad and even taken out the resulting SQLite DB into my Mac, view and edit it in SQLite Editor and can put it back in res/raw/ as an embedded database and it works for further deployment. Using some patch from Deepak (TrekGlobal) we can also follow the progress during InitialLoad:

Screen Shot 2015-07-20 at 2.00.08 PM.png
Screen Shot 2015-07-20 at 2.00.08 PM.png (52.8 KiB) Viewed 13594 times
However at the last minute during Login to view the main menu, there was a missing AD_Session table and this morning Carlos Parada told me that they have (yet another) a repo here https://github.com/adempiere/spin-suite ... ee/cmp_370 with later migration scripts. I applied them and restart InitialLoad and hit back last week problem when DataSynchronization tries to get a result from:

Screen Shot 2015-07-23 at 11.10.42 AM.png
Screen Shot 2015-07-23 at 11.10.42 AM.png (79.98 KiB) Viewed 13594 times
which was solved last week by adding AD_Tree.AD_Table_ID but now that exists and so checking what could be the new missing data.
Site Admin
Posts: 2762
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: SpinSuite in iDempiere

Postby red1 » Sat Jul 25, 2015 3:18 am

SpinSuitePass.png (49.3 KiB) Viewed 13581 times
SpinSuiteMenu.png (75.78 KiB) Viewed 13581 times

More bugs solved in SyncService:
1. A - B != 0 is replaced with more surer A < B
2. EnvLoad at end of InitialLoad
3. Better status display to allow user know what stage InitialLoad is

There is an intermittent bug due to multithreading with multiply cached preparedstatement and cached synchmenu items where the old data is not released on time, stopping some records of been loaded, but by playing with the Tree structure gives a workaround
Site Admin
Posts: 2762
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: SpinSuite in iDempiere

Postby red1 » Sat Aug 01, 2015 2:24 pm

Android Studio app code is committed and pushed to http://github.com/red1org/iSpinSuite. An initial demo APK for immediate trial on Android OS phones is uploaded here - http://sourceforge.net/projects/red1/files/Android/ (take the updated final iDempiere migration scripts as well as the server-side plugins there too).
You can use the source to set further if needed. Otherwise it should work with configured URL and login/pass during InitialLoad. Follow the start screens below. After this, next post shows how to setup master files so that it can operate as an iDempiere ERP on mobile Android.

FirstInitialScreen.png (32.08 KiB) Viewed 13449 times
Above is what you get when you install or run SpinSuite for the first time. It detected no spin-suite SQLite database in your phone and wants to set it up for you automatically. Just tap on Next at the top right hand corner.

SecondInitialScreen.png (28.98 KiB) Viewed 13449 times
Here you can change your URL as i did to test my local WiFi use. But for this you have to bypass SSL security setting which is done in the source (later). As it is, it should default to the demo.idempiere.com site which you can install the server side and web service to test it ((Sources:server and service). But likely is that you going to use it for your own instance, so replace that with your own server URL.

ThirdInitialScreen.png (39.24 KiB) Viewed 13449 times
This advance messaging protocol is not covered in my migration so just click Next again.

LoadTestData.png (35.38 KiB) Viewed 13449 times
This is the final window where you can either select the preloaded database or uncheck Load Test Data to do your own synchronization to your own URL. When you press Finish, you can see the Synchronization happens in progress. This may fail but if all goes well, it should take about 15 mins to 25 mins depending on how large your database is. If you use preloaded GardenAdmin synched by me before, it will just take one second.
Site Admin
Posts: 2762
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: SpinSuite in iDempiere

Postby red1 » Sat Aug 01, 2015 7:37 pm

Either option of using Test DB (GardenWorld synched with iDempiere) or your own will end up as the System menu screen. However the user menu is in the GardenAdmin login. So do that - just tap on the top right, it will display two items, Configuration and Synchronization. Select Configuration and the following display screen appears.

ConfigurationMenu.png (76.24 KiB) Viewed 13447 times
Tap on Login:

LoginRoleChange.png (49.32 KiB) Viewed 13447 times
Fill in the values. The trick is just to tap on Login Role and select Garden Admin Role and the others are quite easily filtered. The idea is now to examine the contents of metadata synchronized from the iDempiere ERP on the server side via the spin-suite web services. Then exit (bottom left return icon or follow your local phone manufacturer design) until the app disappears from the display. Then launch again and you shall see the GardenAdmin menu:

MobileMenu.png (52.45 KiB) Viewed 13447 times
However, this menu only appears because of what you permit by its Role Access on the server side during synching. It is not enough to just have this defined in the Mobile Menu server side. This is important particularly during synching of new instance instead of preloaded Test DB. You can find a new tab for that when you access the Client Admin's Role window:

RoleMobileWindowAccess.png (114.75 KiB) Viewed 13447 times
Note that I have granted access to the role to have access not just to these mobile items but given complete read and write access to it. This is thus me as the admin's choice to control.
Now you can try to go and view the first item's window. But since there are no records yet, it will appear blank with a plus '+' icon on the top right to allow creation of records (only because i given write access or else that will not appear).

AddRecord.png (22.97 KiB) Viewed 13447 times
Tap that and you get an empty sheet to fill up but you cannot do anything yet because you do not even have underlying master data such as Business Partner Group. Now is the right time to do another important aspect of the synch process, which is the Update Menu. Again go to the top right selection and choose Synchronization this time.

UpdateUploadMenu.png (35.71 KiB) Viewed 13447 times
Select Update Data (download information from server), will appear a list of items

UpdateDataItems.png (80.51 KiB) Viewed 13447 times
Then hold down the item UD Business Partners Group for a second or two and a pop up selection appears.

UpdateHoldDown.png (67.9 KiB) Viewed 13447 times
You can select the Standard Synchronization
Again, you need to have the necessary setup at the server side before this can go through. Next posting will tell you all about it.
Site Admin
Posts: 2762
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: SpinSuite in iDempiere

Postby red1 » Sun Aug 02, 2015 9:59 pm

The important thing for an ERP especially is security as the web services is open to the outside world and very accessible via its web services interface. The additional control over at the server-side determines what table is accessible and if so, if they are only readable and not allowed to be written to back and if so exactly which fields. So you can of course see how complicated it is but very necessary in order to ensure a high level of security and certainty during ERP operations over the web to your mobile app using SpinSuite. The good news is that this is usually determined or setup only once. I have done so for the UD Business Partner Group data below:

WebServicesSetup.png (165.03 KiB) Viewed 13422 times
There must be a new Web Services Security record of the WebServiceType value (Search Key) stating exactly 'Update Business Partner Group' to correlate to the Sync Menu (reminder below).

SyncMenu.png (197.03 KiB) Viewed 13422 times
Remember this Sync Menu determines what appears in your mobile and is referred to during InitalLoad sync setup earlier, which I did for the GardenWorld sample. (I made a trick here because such records already existed in the SystemAdmin side, so it is a matter of going into the SQL Admin such as PGAdmin to modify or copy those records over to your ClientAdmin database.)
Continuing the WebServices setup, you have to go to the other two tabs, Field Output Parameters and Access and populate accordingly (again try the trick i mentioned here).

WebServicesFieldOutput.png (75.64 KiB) Viewed 13422 times
This tab defines what parameters are allowed to be taken from the main server database. (The Input tab determines what can be put into the main server db by the mobile.)

WebServiceAccess.png (58.55 KiB) Viewed 13422 times
This grants access to the client ID. With this, we can now try the UD function in the mobile again and see, after tapping on the Standard Synchronization. The status display above the phone should indicate a successful update. Then we go into the Business Partner item we shall find the BP group already has the three new records as shown below.

UpdateLoaded.png (51.26 KiB) Viewed 13422 times
From here on, we can do the same process for other tables that we want to fetch its records from the main server. Then we can try a final operation such as a Sales Order process and upload back to the main server its results. At this juncture, the concept proof has reached a big step forward. We can do synch both ways and play with the SpinSuite.

I hope there be testers out there and if anyone reach this stage and find any next step error such as Sales Order process, then do ask here and i should be able to debug and sort it out. Better quickly while everything is still fresh in my mind.
Site Admin
Posts: 2762
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: SpinSuite in iDempiere

Postby red1 » Wed Aug 05, 2015 8:09 pm

It is also beneficial to sum up the format of synchronizing as designed by Yamel Senih and Carlos Parada. The SpinSuite app basically starts off with the InitialLoad which brings over all the main utility tables and definition of metadata or workhorse first without getting anymore actual user data in. The only user data are referential ones such as AD_Role, AD_Users, AD_Role_Access, A_OrgAccess. However i modified slightly the InitialLoad DB to synch over also GardenWorld C_Order and C_OrderLines as a proof of concept but Yamel has explained to me that this is not necessary. I agree with him because there may be thousands of such orders and it hampers the InitialLoad itself which is one time. Subsequent actions are all to be handled by the Synchronization menu.
This way is very well drawn out and easier to troubleshoot and maintain as well as to train someone new on it. So what I achieved above is to trace out the InitialLoad, and the second aspect of updating user data i.e. the BP Groups. What i have yet to complete is the upload back of new data saved in the mobile side. That to me is trivial as compared to the main comm acts I have proven so far, as much time was taken in the initial proper migration to iDempiere, and then getting the 2 webservices to work. The org.spinsuite.webservice is the Venezuelan team own creation, but the second web service adoption is classic because they adapted the daily routine of communicating with the server to the standard web-service of ADempiere, and thus the migration to iDempiere's similar standard web-service was straightforward to existed some small but challenging bugs. The use of the standard WS is important because it requires no new learning curve, adopting all the standard CRUD model functions already existing.
Site Admin
Posts: 2762
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Return to iDempiere

Who is online

Users browsing this forum: No registered users and 1 guest