Cancel single line item

198 views
Skip to first unread message

wielliam tell

unread,
Dec 10, 2014, 12:58:14 PM12/10/14
to django...@googlegroups.com
after changing the status of a single line item to Cancelled I would like the change to be reflected in the order itself and the price on the orders index page /dashboard/orders/ .does oscar have some functions that I can call to handle that scenario

David Winterbottom

unread,
Dec 10, 2014, 4:56:00 PM12/10/14
to django-oscar
On Wed, Dec 10, 2014 at 5:58 PM, wielliam tell <wiel...@gmail.com> wrote:
after changing the status of a single line item to Cancelled I would like the change to be reflected in the order itself and the price on the orders index page /dashboard/orders/ .does oscar have some functions that I can call to handle that scenario

​Not out-of-the-box but it's easy to implement. Just override set_status on your line model (https://github.com/django-oscar/django-oscar/blob/master/src/oscar/apps/order/abstract_models.py#L521-L536) and make it update the parent order if the appropriate conditions are met.​

 

--
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/04141f4b-5d6e-47d5-92df-4f37950b9e66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

wielliam tell

unread,
Dec 10, 2014, 8:04:14 PM12/10/14
to django...@googlegroups.com
can I simply cancel stock allocation, subtract the line_price_incl_tax from the total_incl_tax and then remove the record from the order_line inside that function to reflect the change? I'm worried that I might mess something up after reading this link about pricing http://django-oscar.readthedocs.org/en/latest/topics/prices_and_availability.html

David Winterbottom

unread,
Dec 13, 2014, 5:08:17 PM12/13/14
to django-oscar
On Thu, Dec 11, 2014 at 1:04 AM, wielliam tell <wiel...@gmail.com> wrote:
can I simply cancel stock allocation, subtract the line_price_incl_tax from the total_incl_tax and then remove the record from the order_line inside that function to reflect the change? I'm worried that I might mess something up after reading this link about pricing http://django-oscar.readthedocs.org/en/latest/topics/prices_and_availability.html

​Changing the order/line info won't affect anything else, so you should be safe. 

FWIW, that sounds like unusual behaviour. Every store I've worked on has kept the order total the same after a cancellation​ and just recorded the amount paid and lines shipped. Are you going to do the same thing for returns and refunds?

 


On Wednesday, December 10, 2014 4:56:00 PM UTC-5, David Winterbottom wrote:


On Wed, Dec 10, 2014 at 5:58 PM, wielliam tell <wiel...@gmail.com> wrote:
after changing the status of a single line item to Cancelled I would like the change to be reflected in the order itself and the price on the orders index page /dashboard/orders/ .does oscar have some functions that I can call to handle that scenario

​Not out-of-the-box but it's easy to implement. Just override set_status on your line model (https://github.com/django-oscar/django-oscar/blob/master/src/oscar/apps/order/abstract_models.py#L521-L536) and make it update the parent order if the appropriate conditions are met.​

 

--
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/04141f4b-5d6e-47d5-92df-4f37950b9e66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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.

wielliam tell

unread,
Dec 14, 2014, 12:54:39 PM12/14/14
to django...@googlegroups.com
Yes, the same thing will happen for refunds. Different user groups will be using different versions of the order management page and I didnt want them to be confused by the order total. I went ahead and cancelled the stock allocations and recalculated the order total each time a line status is set to cancelled. If I find that its too much work for the database to recalculate the order total each time in the future, I will remove the code.
Reply all
Reply to author
Forward
0 new messages