Jump to content
thirty bees forum
  • 0

Supply Orders > Pending receipt. Bug associated to the front office.


Question

Posted

Hello.

I want to share with you a bug that I have detected.

[Conditions] - Advanced Stock Management: Activated.

To reproduce the bug just follow the steps:

  1. Create a supply order. Add a product with quantity equal 0 and choose for example order 2 new products. Current instant state: Physical quantity = 0 | Usable quantity = 0 | Real quantity = 0
  2. Change the status to Order Validated. Current instant state: Physical quantity = 0 | Usable quantity = 0 | Real quantity = 0
  3. Change the status to Pending Receipt. Current instant state: Physical quantity = 0 | Usable quantity = 0 | Real quantity = 2 0_1489175062741_upload-b28121e7-8c59-4236-9126-839b3a441a1a
  4. Go to the front office. You can see that there are 2 items to be ordered when you haven't received the products: 0_1489175125523_upload-2f008731-2f50-4230-baa5-56426b3c37bf

I guess is a heritated bug from Prestashop. But I think can produce severe problems in many stores. If the supplier needs 5 days to deliver your order, you can be in serious troubles with your customers :)

I have been taking a look in the code, and I think the problem must be in the AdminSupplyOrdersController.php line 1223:

``` // create stock entry if not exist when order is in pendingreceipt if ($newstate->pendingreceipt) { $supplyorderdetails = $supplyorder->getEntries(); foreach ($supplyorderdetails as $supplyorderdetail) { $ispresent = Stock::productIsPresentInStock($supplyorderdetail['idproduct'], $supplyorderdetail['idproductattribute'], $supplyorder->idwarehouse); if (!$is_present) { $stock = new Stock();

                                            $stock_params = array(
                                                'id_product_attribute' => $supply_order_detail['id_product_attribute'],
                                                'id_product' => $supply_order_detail['id_product'],
                                                'physical_quantity' => 0,
                                                'price_te' => $supply_order_detail['price_te'],
                                                'usable_quantity' => 0,
                                                'id_warehouse' => $supply_order->id_warehouse
                                            );

                                            // saves stock in warehouse
                                            $stock->hydrate($stock_params);
                                            $stock->add();
                                        }
                                    }

``` I hope this can help to fix the bug.

Thank you very much and regards.

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...