num_in_stock never changes

83 views
Skip to first unread message

vijay....@jaarwis.com

unread,
Mar 25, 2015, 8:39:49 AM3/25/15
to django...@googlegroups.com
Hi
I am working on a store using django oscar, and there is this issue that i am facing. Even after i change status to shipped or complete in dashboard, the num_in_stock never changes.I did dig into the source to find that processing.py in apps/order have a method  consume_stock_allocations which in turn calls consume_allocation(quantity) over each line to update num_in_stock and num_allocated. But the catch is consume_stock_allocations is never called, thus, num_in_stock remains same and num_allocated keeps on increasing.
I dont get it. Was it intentional ? or should i try to call this consume_stock_allocations when order status (from dashboard's OrderDetailView) is changed to shipping  or from OrderListView ) when line status is made to change.Please help me out.
Regards
vijay

John P

unread,
Mar 25, 2015, 1:33:26 PM3/25/15
to django...@googlegroups.com
I think the intention is that you're supposed to manually set num_in_stock and reset num_allocated to zero when you actually do a real count of how many items you have on hand.

David Winterbottom

unread,
Mar 25, 2015, 5:57:00 PM3/25/15
to django-oscar
Placing an order will record the stock allocations, but you need to
call the "consume_stock_allocations" method as part of your order
processing. That method needs to be called when you actually ship
something, which happens in different ways in different shops.
> --
> https://github.com/tangentlabs/django-oscar
> http://django-oscar.readthedocs.org/en/latest/
> https://twitter.com/django_oscar
> ---
> You received this message because you are subscribed to the Google Groups
> "django-oscar" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-oscar...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-oscar.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/django-oscar/b543eec3-97f5-4d0d-a1d3-5c710001793c%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

BugSpencer

unread,
Mar 26, 2015, 7:54:34 AM3/26/15
to django...@googlegroups.com
Just for reference, here's how stock allocations are consumed in demo application:
https://github.com/django-oscar/django-oscar/blob/master/sites/demo/apps/order/processing.py#L20

To accomplish this you have to fork checkout app, define your own EventHandler that inherits from Oscar's one,
override handle_shipping_event method and call consume_stock_allocations (which in turn is already in Oscar core).
Reply all
Reply to author
Forward
0 new messages