Openbravo Issue Tracking System - Retail Modules
View Issue Details
0043818Retail ModulesRetail APIpublic2020-04-22 10:032020-06-03 10:23
santi_lozano 
prakashmurugesan88 
highmajoralways
closedfixed 
5
 
RR20Q3 
marvintm
No
0043818: Error thrown using Retail API module for Business Partner POST method filling example values
Error (see code below) using Retail API for a POST request that creates BussinesPartner items.
Create a POST request to:
https://livebuilds.openbravo.com/retail_modules_pgsql_pi/ws/org.openbravo.retail.api.ImportService/BusinessPartner [^]
With the example data (filling the fields for the concrete role):
https://livebuilds.openbravo.com/retail_modules_pgsql_pi/api?urls.primaryName=RetailAPI#/BusinessPartner/Import_BusinessPartner [^]
Then error is thrown on EDL Request window:
"Error while importing an item: class java.lang.String cannot be cast to class org.openbravo.base.structure.BaseOBObject (java.lang.String is in module java.base of loader 'bootstrap'; org.openbravo.base.structure.BaseOBObject is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @6a3aab04)”
* go to livebuilds, enter with role The White Valley Group Admin:
https://livebuilds.openbravo.com/retail_modules_pgsql_pi/ [^]
* go to Role window, set on main header Is Web Service Enabled for role The White Valley Group Admin
* go to EDL Configuration, create a new record. EDL Process = JSON Based Import Process, Active = yes
* go to tab Output, create a new one with default values (Sequence Number = 10, Output Type = Debug, Active = yes)
* open Postman program (see screenshot), create a new request. Type POST. Url request = https://livebuilds.openbravo.com/retail_modules_pgsql_pi/ws/org.openbravo.retail.api.ImportService/BusinessPartner [^]
* open tab Authorization (Postman) type = Basic Auth, Username and Password for Openbravo livebuilds.
* open tab Body (Postman), set raw button checked, and Text on the drop-down list. Copy and paste that content:

[{"client":"39363B0921BB4293B48383844325E84C","organization":"67839EEFA49E44AC969BD60093FCC899","searchKey":"SNItest SNItest","commercialName":"test","fiscalName":"","description":"Description test","bpCategory":"B1DD8B371643421C987EF1D5B358D5E9","taxID":"","greeting":"Monsieur","currency":"102","birthDay":"1992-01-09","paymentMethod":"45A202BF44884F05B8A1BF741E2063B6","paymentTerms":"D8955F8808A54C63BBF478A6843D834D","priceList":"496CF965DF9744D2A41248392D1DE407","customerConsent":"Y","creditLineLimit":0,"currentBalance":0,"invoiceTerms":"I","locations":[{"address":"102 test street","city":"Barcelona","zipCode":"08028","country":"102","region":"A44A7F2FCFD34CC78DC5546B067CD816"}],"contactInformation":[{"firstName":"Patrik","lastName":"Mils","phone":"65986597","email":"patrik.mils@practicsbs.com"}]}]

* Go to Openbravo livebuilds, with role The White Valley Group Admin, enter to EDL request window, check if the record has been sent here. Otherwise it has been sent to F&B International Group role, change to that role, and create a new request with Postman to make values for that role coincide, fill the request with the following

[{
    "client": "23C59575B9CF467C9620760EB255B389",
    "organization": "0",
    "searchKey": "10001-001",
    "commercialName": "Patrik Mils",
    "fiscalName": "Patrik Mils",
    "description": "Description test",
    "bpCategory": "713643BF6582479BAD2AF21B80836AA2",
    "taxID": "1234569586A",
    "greeting": "Monsieur",
    "currency": "102",
    "birthDay": "1992-01-09",
    "paymentMethod": "A97CFD2AFC234B59BB0A72189BD8FC2A",
    "paymentTerms": "66BA1164A7394344BB9CD1A6ECEED05D",
    "priceList": "AEE66281A08F42B6BC509B8A80A33C29",
    "customerConsent": "Y",
    "creditLineLimit": 0,
    "currentBalance": 0,
    "invoiceTerms": "I",
    "locations": [{
        "address": "102 test street",
        "city": "Barcelona",
        "zipCode": "08028",
        "country": "102",
        "region": "A44A7F2FCFD34CC78DC5546B067CD816"
    }],
    "contactInformation": [{
        "firstName": "Patrik",
        "lastName": "Mils",
        "phone": "65986597",
        "email": "patrik.mils@practicsbs.com"
    }]
}]

* then the error is raised on the corresponding role EDL request window:
"Error while importing an item: class java.lang.String cannot be cast to class org.openbravo.base.structure.BaseOBObject (java.lang.String is in module java.base of loader 'bootstrap'; org.openbravo.base.structure.BaseOBObject is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @6a3aab04)"

* note that for the request we have been using the Swagger UI proposed by Retail API module, just filling the string data with values that match for that role
https://livebuilds.openbravo.com/retail_modules_pgsql_pi/api?urls.primaryName=RetailAPI#/BusinessPartner/Import_BusinessPartner [^]
No tags attached.
png issue - postman.png (113,100) 2020-04-22 10:06
https://issues.openbravo.com/file_download.php?file_id=14357&type=bug
png

png issue - is web service enabled.png (165,418) 2020-04-22 10:06
https://issues.openbravo.com/file_download.php?file_id=14358&type=bug
png

png issue - error.png (234,779) 2020-04-22 10:06
https://issues.openbravo.com/file_download.php?file_id=14359&type=bug
png

png issue - edl configuration.png (106,580) 2020-04-22 10:06
https://issues.openbravo.com/file_download.php?file_id=14360&type=bug
png

patch I43818_Export.patch (36,414) 2020-05-15 09:02
https://issues.openbravo.com/file_download.php?file_id=14485&type=bug
patch I43818_Import.patch (37,642) 2020-05-15 09:03
https://issues.openbravo.com/file_download.php?file_id=14486&type=bug
Issue History
2020-04-22 10:03santi_lozanoNew Issue
2020-04-22 10:03santi_lozanoAssigned To => Retail
2020-04-22 10:03santi_lozanoResolution time => 1589320800
2020-04-22 10:03santi_lozanoTriggers an Emergency Pack => No
2020-04-22 10:03santi_lozanoSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=20832#r20832
2020-04-22 10:05santi_lozanoDescription Updatedbug_revision_view_page.php?rev_id=20834#r20834
2020-04-22 10:06santi_lozanoFile Added: issue - postman.png
2020-04-22 10:06santi_lozanoFile Added: issue - is web service enabled.png
2020-04-22 10:06santi_lozanoFile Added: issue - error.png
2020-04-22 10:06santi_lozanoFile Added: issue - edl configuration.png
2020-04-22 10:09santi_lozanoSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=20835#r20835
2020-04-22 11:42guillermogilSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=20838#r20838
2020-05-05 07:47prakashmurugesan88Assigned ToRetail => prakashmurugesan88
2020-05-05 15:24prakashmurugesan88Statusnew => scheduled
2020-05-15 09:02prakashmurugesan88File Added: I43818_Export.patch
2020-05-15 09:03prakashmurugesan88File Added: I43818_Import.patch
2020-05-18 07:57hgbotCheckin
2020-05-18 07:57hgbotNote Added: 0119957
2020-05-18 08:00prakashmurugesan88Statusscheduled => resolved
2020-05-18 08:00prakashmurugesan88Resolutionopen => fixed
2020-05-18 08:30marvintmReview Assigned To => marvintm
2020-05-18 08:30marvintmStatusresolved => closed
2020-05-18 08:30marvintmFixed in Version => RR20Q3
2020-05-18 11:49hgbotCheckin
2020-05-18 11:49hgbotNote Added: 0119967
2020-05-20 19:25hgbotCheckin
2020-05-20 19:25hgbotNote Added: 0120107
2020-06-03 10:23hgbotCheckin
2020-06-03 10:23hgbotNote Added: 0120568

Notes
(0119957)
hgbot   
2020-05-18 07:57   
Repository: erp/pmods/org.openbravo.retail.api
Changeset: da7291db4dfccee866eeb63a49a2eb32b0cc3707
Author: Prakash M <prakash <at> qualiantech.com>
Date: Sat May 16 16:12:50 2020 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.api/rev/da7291db4dfccee866eeb63a49a2eb32b0cc3707 [^]

Related to BUG-43818: Fixed error on importing Business Partner

* Created new Entity Mapping for "Greeting" [Export & Import]
* In BusinessPartner Entity Mapping, Changed mapping of "Greeting" property from
DirectPropertyMapping to EntityMapping [Export & Import]
* In ADUser Entity Mapping, included new Java property mapping for the name
property. Therefore name generated dynamically from firstName and lastName of
contactInfo. [Import]
* Changes BusinessPartner locations property to java property
mapping [Import]

---
M api/org.openbravo.retail.api-RetailAPI.json
M src-db/database/sourcedata/OBEI_ENTITY_MAPPING.xml
M src-db/database/sourcedata/OBEI_PROP_MAP_INSTANCE.xml
A src/org/openbravo/retail/api/mappings/businesspartner/ImportBusinessPartnerJavaPropertyMappingHandler.java
A src/org/openbravo/retail/api/mappings/user/ImportUserJavaPropertyMappingHandler.java
---
(0119967)
hgbot   
2020-05-18 11:49   
Repository: erp/pmods/org.openbravo.retail.api
Changeset: e20157190d2c0a19ce6fe3ec30df8f1fd374d9db
Author: Prakash M <prakash <at> qualiantech.com>
Date: Mon May 18 15:19:16 2020 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.api/rev/e20157190d2c0a19ce6fe3ec30df8f1fd374d9db [^]

Related to BUG-43818: Included name property in BPartner location expected data
of retail api test

---
M src-test/data/export/filter/bpartner/BPartnerByBPartnerCategory.json
M src-test/data/export/filter/bpartner/BPartnerById.json
M src-test/data/export/filter/bpartner/BPartnerByName.json
M src-test/data/export/filter/bpartner/BPartnerByOrg.json
M src-test/data/export/filter/bpartner/BPartnerBySearchKey.json
M src-test/data/export/filter/bpartner/BPartnerByStoreId.json
M src-test/data/export/filter/bpartner/BPartnerByStoreName.json
M src-test/data/export/filter/bpartner/BPartnerByStoreSearchKey.json
---
(0120107)
hgbot   
2020-05-20 19:25   
Repository: erp/pmods/org.openbravo.retail.api
Changeset: edd6e23b50202fc9161534924613026e811f2834
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Wed May 20 18:54:37 2020 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.api/rev/edd6e23b50202fc9161534924613026e811f2834 [^]

Related to BUG 43818: minor code improvements

---
M src/org/openbravo/retail/api/mappings/businesspartner/ImportBusinessPartnerJavaPropertyMappingHandler.java
---
(0120568)
hgbot   
2020-06-03 10:23   
Repository: erp/pmods/org.openbravo.retail.api
Changeset: 5350f0199751795c42e05ca8ee9741284cdcbbb0
Author: Prakash M <prakash <at> qualiantech.com>
Date: Wed Jun 03 13:52:26 2020 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.api/rev/5350f0199751795c42e05ca8ee9741284cdcbbb0 [^]

Related to BUG-43818: Changed country query by validating isocode with ilike
instead of equals

---
M src/org/openbravo/retail/api/mappings/businesspartner/ImportBusinessPartnerJavaPropertyMappingHandler.java
---