You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Giulio Speri (Jira)" <ji...@apache.org> on 2021/07/04 15:32:00 UTC

[jira] [Commented] (OFBIZ-12264) Multiple Facility Inventory reservation does not consider store facility thru date

    [ https://issues.apache.org/jira/browse/OFBIZ-12264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17374306#comment-17374306 ] 

Giulio Speri commented on OFBIZ-12264:
--------------------------------------

HI, I've created a patch for the reserveStoreInventory service, both for version 13 and 17.

I post here some considerations on the patch:

 
 * the service mainly checks for the existence of input the parameter "facilityId"; *CASE 1)* if it does not exists (front-end/ecommerce application scenario) and the flag "oneInventoryFacility" is set to "N" on the ProductStore, it retrieves the list of all the ProductStoreFacility records and try to find a valid facility for reservation. In this step I added a filter-by-date entity filter to exclude disabled facilities;
 * in the above scenario, if a valid facility for reservation is not found I explicitly rise and return an error in the service, otherwise sales order is created anyway; thinking about an ecommerce context, I think that this is necessary to avoid that a customer pays for a product that is not available;
 *  *CASE 2)* the input parameter facilityId exists (backoffice order entry scenario where inventory facility is selected in the process) and "oneInventoryFacility" flag is "N" ; The system retrieves the ProductStoreFacility records for the store and facility given as parameters: I added a filter-by-date filter to this find. In this scenario I do not rise an error for the service and I simply log an updated message in case there is quantityNotAvailable for a product. Basically it does the same thing as always and I kept it as is, because backoffice order entry flow is performed for manual handle of orders so I I think is ok having some more flexibility.

I really appreciate if you could give me your opinion on this; in the meanwhile I will investigate the front-end part of this: I think that a variant that has quantity in a disabled facility should not appear in a product detail page and a user should not be able to add it to the cart.

Thanks,

Giulio

[^OFBIZ-12264_v17.patch]

> Multiple Facility Inventory reservation does not consider store facility thru date
> ----------------------------------------------------------------------------------
>
>                 Key: OFBIZ-12264
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-12264
>             Project: OFBiz
>          Issue Type: Bug
>          Components: ecommerce, product
>    Affects Versions: 17.12.03, 17.12.04, 17.12.05, 17.12.06, 17.12.07
>         Environment: Linux/Ubuntu 18.04 LTS, Java jdk 8, OFBiz v13.07.03
>  
>            Reporter: Giulio Speri
>            Assignee: Giulio Speri
>            Priority: Major
>         Attachments: OFBIZ-12264_v130703.patch, OFBIZ-12264_v17.patch, image-2021-06-24-00-35-10-392.png, image-2021-06-24-00-37-21-890.png, image-2021-06-24-00-40-41-737.png, image-2021-06-24-00-41-56-344.png, image-2021-06-24-00-43-33-640.png, image-2021-06-24-00-46-17-924.png, image-2021-06-24-00-49-23-904.png
>
>
> The ProductStore is set up to reserve inventory from more than one facility, so the flag oneInventoryFacility is set to N. 
>  The we have 8 different facilities configured (each with a specific sequence num from 1 to 8) in the entity ProductStoreFacility.
>   
>  Due to customer requests I had to disable 6 out of 8 facilities associated with the store, so basically only facilities with (sequence) numbers 1 and 2 are left. To achieve this I set the thruDate on the other six records.
>   
>  After that, an order came in with a variant product that had only 1 quantity left available in one of the disabled facilities and 0 in both the two facilities left enabled, but despite this the system reserved inventory from the disabled facility: I wouldn't expect that.
>   
>  The service responsible for the reservation is reserveStoreInventory that in our ofbiz version (13.07.03) is minilang and is implemented in ProductStoreServices.xml: I checked that service and I noticed that when the ProductStore is set to multi facility (oneInventoryFacility to N) and the list of productStoreFacility records are retrieved, they are not filtered by date, and this lead to a "bad" reservation.
>  I took a look also at the current revision of ofbiz and the code (groovy script) is basically the same, so the issue is present there also.
>  
> ADDITIONAL NOTE:
> The the reservation should not be done for this product, but this part is only the last step of the ecommerce sales order flow.
> I think that with a scenario like the one above, the specific product variant should not even be added to the cart, so in the item page (productdetail) this particular variant should not have been visible/selected by the user.
> But I have to take a better look at this part.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)