Product cost price with average cost price and supplier return


We have defined a cost price method “average” on our products. Recently, a user bought the wrong product reference but the error was noticed after the supplier shipment was done :frowning:.

So the cost price of the product is changed because of this supplier shipment.

Wondering if the cost price will be updated if i’m doing a supplier return of the whole shipment with the same cost price ?
If no, how to solve this kind of problem ?

Normally if you return just this product at the exact same date with the same cost price, both moves will cancel the update of the average cost price.

Here is the feedback from my test on Tryton version 7.0:

Starting stock quantity of product A = 0 u
I create a purchase for the product A quantity 1000 u unit price 1€
I validate receipt on 04/08/2024
The average cost price calculated is 1€ (this is correct)
I create a return from the purchase for -1000 u unit price 1€

I validate the return on 04/08/2024

I have :

  • a move From Supplier to Input zone of 1000 u at 1€ on 04/08/2024
  • a move From Storage to Supplier from 1000u to 1€ on 04/08/2024

The cost price is not impacted by the return movement, the cost price is always €1

In this scenario, we can take the case of an order for product A which is returned to the supplier following a quality problem identified after receipt.
The supplier will generate a credit note for us to take back the goods. There is no replacement of the product.
We therefore only have a stock of 0u of this product after the return.

In my opinion, the average cost price should be €0 after the return, because we returned the entire quantity at the same price as the purchase. Do you agree with my opinion?

In my opinion, the average cost price should be impacted by returns to the supplier at the unit price indicated on the return movement.
I think currently the calculation method only takes into account incoming movements to calculate the price, outgoing movements are used to determine quantity only.

Rem : SEN1-ZA is a location type STORAGE

Indeed you are right. But I think it is the correct way because we can not be sure that what is returned is exactly the same products as the last one received. So we do not know their exact cost so it is the average cost that is used to decrease the stock cost.
So in your case the average cost price does not change because it is still the same as you remove from the stock 1000u at the average price.
Also as your stock level is then 0, the cost price does not matter.

So I see two options to fix your situation:

  • cancel the shipment so the stock move will be cancelled and thus removed from the average cost price computation (on the next re-computation);
  • return the product and place a cost price update with the right cost price.

Shipment is done so impossible to cancel.

Is it possible to do a downgrade of a product in tryton ?
So the wrong product will be converted into the right product with another cost price ?

I’m wondering if we should not allow also to cancel done shipments since we have Allow cancelling done move (#11663) · Issues · Tryton / Tryton · GitLab.

Not sure what you mean.

Of course you could still manipulate the data in the database to change the wrong product on the move.
You will probably need to force a recomputation of the cost price for both products.