Openbravo Issue Tracking System - Retail Modules
View Issue Details
0038440Retail ModulesWeb POSpublic2018-04-25 02:022019-01-14 16:01
rbianchini 
rqueralta 
highmajorrandom
closedfixed 
5
 
RR18Q3 
marvintm
No
0038440: Error when POS select bp location.
When a business partner is selected in POS and he have locations of different organizations, the selected organization may be a no valid for this order, invoice or good shipment that the POS will be try generate.

It is because, the query use to select the business partner location take the first record using c_bpartner_id and order this using c_bpartner_location_id but the first record maybe is a location of other organization.
In livebuilds:

1) Create a new business partner using the * organization.
2) Create two Location/Adress using Vall Blanca Store and Central Mountains Store organizations in organiztion field (maybe you need set to visible=yes on this field before).
3) Set the POS Terminal VBS-1 to using this Business Partner created and Vall Blanca Store address as default values for POS.
4) Open the POS VBS-1, select the button to change the business partner and select again the default business partner, if all is ok maybe (depends of id asigned to these locations) the current location is change to use Central Mountains Store adress of this business partner, then when you try sell a product and syncronice this order the backend shows this error in Errors While Importing POS Data window:

org.openbravo.base.exception.OBException: Error in OrderLoader: Entity VBS1000009 - 24-04-2018 - 150.50 (Invoice) with organization Vall Blanca Store references an entity ., Central Montain Store Adress through its property partnerAddress but this referenced entity belongs to an organization Central Mountains Store which is not part of the natural tree of Vall Blanca Store
    at org.openbravo.retail.posterminal.OrderLoader.saveRecord(OrderLoader.java:529)
    at org.openbravo.mobile.core.process.DataSynchronizationProcess.saveRecord(DataSynchronizationProcess.java:200)
    at org.openbravo.mobile.core.process.DataSynchronizationProcess.exec(DataSynchronizationProcess.java:154)
    at org.openbravo.mobile.core.process.DataSynchronizationProcess.exec(DataSynchronizationProcess.java:86)
    at org.openbravo.mobile.core.process.MobileImportEntryProcessorRunnable.processEntry(MobileImportEntryProcessorRunnable.java:53)
    at org.openbravo.retail.posterminal.importprocess.OrderImportEntryProcessor$OrderLoaderRunnable.processEntry(OrderImportEntryProcessor.java:59)
    at org.openbravo.service.importprocess.ImportEntryProcessor$ImportEntryProcessRunnable.doRunCycle(ImportEntryProcessor.java:365)
    at org.openbravo.service.importprocess.ImportEntryProcessor$ImportEntryProcessRunnable.run(ImportEntryProcessor.java:287)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.openbravo.base.exception.OBSecurityException: Entity VBS1000009 - 24-04-2018 - 150.50 (Invoice) with organization Vall Blanca Store references an entity ., Central Montain Store Adress through its property partnerAddress but this referenced entity belongs to an organization Central Mountains Store which is not part of the natural tree of Vall Blanca Store
    at org.openbravo.dal.core.OBInterceptor.checkReferencedOrganizations(OBInterceptor.java:310)
    at org.openbravo.dal.core.OBInterceptor.onFlushDirty(OBInterceptor.java:189)
    at org.hibernate.event.def.DefaultFlushEntityEventListener.invokeInterceptor(DefaultFlushEntityEventListener.java:372)
    at org.hibernate.event.def.DefaultFlushEntityEventListener.handleInterception(DefaultFlushEntityEventListener.java:349)
    at org.hibernate.event.def.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:287)
    at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:155)
    at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
    at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
    at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
    at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
    at org.openbravo.dal.service.OBDal.flush(OBDal.java:260)
    at org.openbravo.retail.posterminal.OrderLoader.saveRecord(OrderLoader.java:520)
    ... 12 more
If you check the function:

loadBPLocations: function(shipping, billing, callback, bpId) {
            var criteria = {
                bpartner: {
                    operator: OB.Dal.EQ,
                    value: bpId || this.get('id')
                },
                '_orderByClause': 'c_bpartner_location_id desc'
            };
            if (OB.MobileApp.model.hasPermission('OBPOS_remote.customer', true)) {
                var filterBpartnerId = {
                    columns: ['bpartner'],
                    operator: OB.Dal.EQ,
                    value: this.get('id'),
                    isId: true
                };
                criteria.remoteFilters = [filterBpartnerId];
            }
            OB.Dal.find(OB.Model.BPLocation, criteria, function(collection) {
                if (!billing) {
                    billing = _.find(collection.models, function(loc) {
                        return loc.get('isBillTo');
                    });
                }
                if (!shipping) {
                    shipping = _.find(collection.models, function(loc) {
                        return loc.get('isShipTo');
                    });
                }
                if (!shipping && !billing) {
                    OB.UTIL.showError(OB.I18N.getLabel('OBPOS_BPartnerNoShippingAddress', [bpId]));
                    return;
                }
                callback(shipping, billing, collection.models);
            });
        },

in the file:

org.openbravo.retail.posterminal/web/org.openbravo.retail.posterminal/js/model/businesspartner.js

Maybe you need add in the criterial the organization used in Terminal.
No tags attached.
gz captures.tar.gz (855,586) 2018-04-25 02:02
https://issues.openbravo.com/file_download.php?file_id=11765&type=bug
Issue History
2018-04-25 02:02rbianchiniNew Issue
2018-04-25 02:02rbianchiniAssigned To => Retail
2018-04-25 02:02rbianchiniFile Added: captures.tar.gz
2018-04-25 02:02rbianchiniResolution time => 1494990000
2018-04-25 02:02rbianchiniTriggers an Emergency Pack => No
2018-04-25 02:12rbianchiniIssue Monitored: szapata
2018-04-27 13:40marvintmResolution time1494990000 => 1526508000
2018-05-02 16:55rqueraltaAssigned ToRetail => rqueralta
2018-05-02 16:56rqueraltaStatusnew => scheduled
2018-05-04 23:27hgbotCheckin
2018-05-04 23:27hgbotNote Added: 0104299
2018-05-04 23:27hgbotStatusscheduled => resolved
2018-05-04 23:27hgbotResolutionopen => fixed
2018-05-04 23:27hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/12edc8567ccd909338ccd5ec0984386841966e4f [^]
2018-05-18 15:03marvintmReview Assigned To => marvintm
2018-05-18 15:03marvintmStatusresolved => closed
2018-05-18 15:03marvintmFixed in Version => RR18Q3
2018-06-25 23:51hgbotCheckin
2018-06-25 23:51hgbotNote Added: 0105376
2019-01-10 15:26alekosmp86Note Added: 0108903
2019-01-10 15:26alekosmp86Note Edited: 0108903bug_revision_view_page.php?bugnote_id=0108903#r18107
2019-01-14 16:01hgbotCheckin
2019-01-14 16:01hgbotNote Added: 0108947
2019-01-14 16:01hgbotCheckin
2019-01-14 16:01hgbotNote Added: 0108949

Notes
(0104299)
hgbot   
2018-05-04 23:27   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 12edc8567ccd909338ccd5ec0984386841966e4f
Author: Rafael Queralta Pozo <rqueralta <at> nauta.cu>
Date: Thu May 03 17:05:58 2018 -0400
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/12edc8567ccd909338ccd5ec0984386841966e4f [^]

Fixed issue 38440: Error when POS select bp location

---
M src/org/openbravo/retail/posterminal/master/BPLocation.java
---
(0105376)
hgbot   
2018-06-25 23:51   
Repository: tools/automation/pi-mobile
Changeset: f9e2d214e0bc47bc0a9c0ce4848ba2e4d54d6639
Author: Alejandro <alekosmp86 <at> gmail.com>
Date: Sun Jun 24 21:57:09 2018 -0400
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/f9e2d214e0bc47bc0a9c0ce4848ba2e4d54d6639 [^]

Related to issue 38440: added automated test

---
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/customer/I38440_VerifyCustomerLocationWhenSelectedInPOS.java
---
(0108903)
alekosmp86   
2019-01-10 15:26   
Test have been refactored due it no longer creates its own sampledata.

https://code.openbravo.com/tools/automation/pi-mobile/rev/ebf1b4a2b382 [^]
https://code.openbravo.com/erp/pmods/org.openbravo.retail.sampledata/rev/6b8c099953fb [^]

(0108947)
hgbot   
2019-01-14 16:01   
Repository: tools/automation/pi-mobile
Changeset: d245d32c66c17971473920d47ba50460e445e4e6
Author: Alejandro <alekosmp86 <at> gmail.com>
Date: Mon Jan 14 09:44:17 2019 -0500
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/d245d32c66c17971473920d47ba50460e445e4e6 [^]

Related to issue 38440: test has been refactored due to changes in sampledata

---
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/customer/I38440_VerifyCustomerLocationWhenSelectedInPOS.java
---
(0108949)
hgbot   
2019-01-14 16:01   
Repository: erp/pmods/org.openbravo.retail.sampledata
Changeset: dca3ef5238bfd9e8e3aebd4fdec3f76ead388a4d
Author: Alejandro <alekosmp86 <at> gmail.com>
Date: Mon Jan 14 09:50:13 2019 -0500
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.sampledata/rev/dca3ef5238bfd9e8e3aebd4fdec3f76ead388a4d [^]

Related to issue 38440: changed active status of business partner used in test due
it was making other tests fail.

---
M referencedata/sampledata/The_White_Valley_Group/C_BPARTNER.xml
---