Negative inventory

2 views
Skip to first unread message

Chris Hart

unread,
Nov 24, 2009, 9:56:53 AM11/24/09
to Satchmo users
Django 1.0.3, Satchmo 0.8.1

For some reason we occasionally get orders that were allowed to take
more inventory than was available for certain products. We have the
correct setting in the store configuration and have added a custom
message asking customers to call in if there's not enough of something
and they would still like to backorder it.

All testing confirms that nobody can order more of something than is
available and yet we still see orders appearing that have caused items
to go into the negative.

Can anyone suggest what the best first steps to troubleshoot this
might be? Thanks,

Chris

Chris Hart

unread,
Nov 24, 2009, 10:34:21 AM11/24/09
to Satchmo users
Ohh it seems that if you keep going back to the product page and
adding to the cart a quantity within the available inventory it allows
that line item to exceed the actual inventory available. It's only if
e.g. somebody types that they want 50 of something with only 2
available that they are refused.

Anyone else experience this?

Johannes Berg

unread,
Nov 24, 2009, 10:35:48 AM11/24/09
to satchm...@googlegroups.com

Sounds a bit like a race condition; try having a product with an
inventory of 1, adding it to two different carts (different
browsers/machines) and then checking out twice?

johannes

signature.asc

Chris Hart

unread,
Nov 24, 2009, 4:37:15 PM11/24/09
to Satchmo users
Hmm found the original problem in satchmo/shop/models.py:

Had to change:

if not alreadyInCart:
signals.satchmo_cart_add_verify.send(self, cart=self,
cartitem=item_to_modify, added_quantity=number_added,
details=details)
self.cartitem_set.add(item_to_modify)

...to:

signals.satchmo_cart_add_verify.send(self, cart=self,
cartitem=item_to_modify, added_quantity=number_added,
details=details)
if not alreadyInCart:
self.cartitem_set.add(item_to_modify)


Will post again with results of the test for the race condition.

Chris
>  signature.asc
> < 1KViewDownload
Reply all
Reply to author
Forward
0 new messages