Tracking Inventory - Deleting Orders ...Bug ?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Hello there,
Keep in mind that I'm tracking inventory here.


When you decide to CANCEL an existing Unpaid Order, the Cancel action returns the Qty used by that transaction back to the Product StockQuantity (which is good).

When you decide to DELETE an existing Unpaid Order, the Delete action seems to totally ignore the fact that it is holding product Qty and never updates back value on the Database.

For those Tracking Inventory like me,
this could be a problem.

Is this an expected behavior ?
12 years ago
You're right. I think deleting should also adjust the inventory
11 years ago
hi
i am using nop2.4
and still have the same problem
in which version this problem is solved?
11 years ago
It was fixed in 2.40
11 years ago
well i am using V2.4
and i have this problem...

i also noticed that when if buy button is disabled because low quantity
it is not enabled after canceling an order .
11 years ago
Would it be possible to give a "Step to Reproduce"
..so that they can quickly create a fix for it?
11 years ago
pint12 wrote:
well i am using V2.4
and i have this problem...

I've just tested it,. Everything works fine.
1. Do you have source code? If yes, please open \Libraries\Nop.Services\Orders\OrderProcessingService.cs file and post its DeleteOrder method here
2. Also got to an appropriate product variant details page (admin area). Is "Manage inventory method" set to "Track inventory"?

pint12 wrote:
i also noticed that when if buy button is disabled because low quantity
it is not enabled after canceling an order .

Find more info here
11 years ago
hi  this is the code

i have to mention that i did some coding before  

this is my code

//raise event        
                        if (order.PaymentStatus == PaymentStatus.Paid)
                        {
                            _eventPublisher.PublishOrderPaid(order);

                            //fileds for  dropship added by ilanp
                            //send email notifications to vendor  
                            var ml = _orderService.GetAllVendors(order.Id);

                            foreach (Manufacturer vendor in ml.Distinct())
                            {
                                if (vendor.IsDropShip == true)
                                {
                                    int SendOrderPlacedVendorNotificationId = _workflowMessageService.SendOrderPlacedVendorNotification(order, _localizationSettings.DefaultAdminLanguageId, vendor);
                                    if (SendOrderPlacedVendorNotificationId > 0)
                                    {
                                        order.OrderNotes.Add(new OrderNote()
                                        {
                                            Note = string.Format("\"Order placed\" email (to vendor) has been queued. Queued email identifier: {0}.", SendOrderPlacedVendorNotificationId),
                                            DisplayToCustomer = false,
                                            CreatedOnUtc = DateTime.UtcNow
                                        });
                                        _orderService.UpdateOrder(order);
                                    }
                                }
                            }

                                                  }


and then there is the Deletes an order




     /// <summary>
        /// Deletes an order
        /// </summary>
        /// <param name="order">The order</param>
        public virtual void DeleteOrder(Order order)
        {
            if (order == null)
                throw new ArgumentNullException("order");

            //add a note
            order.OrderNotes.Add(new OrderNote()
            {
                Note = "Order has been deleted",
                DisplayToCustomer = false,
                CreatedOnUtc = DateTime.UtcNow
            });
            _orderService.UpdateOrder(order);

            //cancel recurring payments
            //var recurringPayments = _orderService.SearchRecurringPayments(0, order.Id, null);
            //foreach (var rp in recurringPayments)
            //{
            //    var errors = CancelRecurringPayment(rp);
            //}

            //Adjust inventory
            foreach (var opv in order.OrderProductVariants)
                _productService.AdjustInventory(opv.ProductVariant, false, opv.Quantity, opv.AttributesXml);

            //now delete an order
            _orderService.DeleteOrder(order);
        }
11 years ago
The source code looks good. As I've written above everything works fine out of the box. Please set breakpoint in ProductService.AdjustInventory() method and see what happens there and why inventory is not adjusted.
11 years ago
ok. i need your help here

to that i need to compile the service with break point  and move it to my test site ?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.