Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import inventory results in incorrect binLocation !=null exception. #1633

Closed
glenheiberg opened this issue May 7, 2020 · 4 comments
Closed
Assignees

Comments

@glenheiberg
Copy link

glenheiberg commented May 7, 2020

version 0.8.11

Import inventory fails with assert binLocation != null | | null false

Select products, import inventory, download "Inventory template", fill out accordingly or leave example template, save.
Select data file. Enter date; click Upload.

Preview looks good. In particular the binLocation field shows the correct data. Click Finish.

Exception generated:

Error 500:
Servlet:
URI:
Exception Message: assert binLocation != null | | null false
Caused by: Executing action [importData] of controller [org.pih.warehouse.batch.BatchController] caused exception: Assertion failed: assert binLocation != null | | null false
Class: BatchController
At Line: [211]
Code Snippet:

org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Executing action [importData] of controller [org.pih.warehouse.batch.BatchController]  caused exception: Assertion failed: 
assert binLocation != null
       |           |
      null        false
	at grails.plugin.springcache.web.GrailsFragmentCachingFilter.doFilter(GrailsFragmentCachingFilter.groovy:66)
	at net.sf.ehcache.constructs.web.filter.Filter.doFilter(Filter.java:86)
	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.codehaus.groovy.runtime.InvokerInvocationException: Assertion failed: 
assert binLocation != null
       |           |
       null        false
@jmiranda
Copy link
Member

jmiranda commented May 7, 2020

Thanks for the bug report, @glenheiberg. Here's a summary of what I think the issue is, but I need to investigate to confirm.

If I remember correctly, the inventory import assumes that all bin locations have been created already. Therefore, it's just just going to look up to see if a bin location exists and throws the exception if a bin was specified but does not exists. Admittedly, this should be made more clear by the error message and import instructions.

FWIW, this is there to protect you from creating multiple bin locations based on typos (AB-CD-12, AB-CD--12, AB CD 12). We can look into changing the behavior to create a new bin location based on a config property if that's desired.

@jmiranda jmiranda self-assigned this May 7, 2020
@jmiranda
Copy link
Member

jmiranda commented May 7, 2020

So yeah that's what is happening in the import code

// Find the bin location
if (row.binLocation) {
    def binLocation = Location.findByNameAndParentLocation(row.binLocation, command.location)
    assert binLocation != null
    transactionEntry.binLocation = binLocation
}

See https://github.com/openboxes/openboxes/blob/develop/grails-app/services/org/pih/warehouse/inventory/InventoryService.groovy#L2934

@jmiranda
Copy link
Member

jmiranda commented May 7, 2020

So the proposed solution would be to add all of your bin locations before doing the inventory import. If you only have a few you can use the first option under instruction 5. If you have a lot I would recommend using the second option.

  1. Configuration > Locations
  2. Search for the desired location
  3. Click on the link to go to the Edit Location page
  4. Click on the Bin Locations tab
  5. Create new bin locations
    • Use the Add Bin Location feature to add bin locations one at a time
    • Use the Import Bin Locations feature to import all bin locations at once (create an XLS with a single column which should include the locator for that bin location using whatever locator format you desire i.e. AB-12-12-12, Bin 123, My most favorite bin, My Least Favorite Bin).

@glenheiberg
Copy link
Author

Thanks Justin! I've created the Bin Locations, and it now imports correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants