# Stock Account Unfuck Currently, Odoo considers that all inventory leaves for products with Costing Method equal to average must be booked at current Price Cost.
Chances that the Costing Price (average) changes are when products are incoming from Suppliers.
According to Official Documentation the reason this is done is explained [here](https://www.odoo.com/documentation/user/9.0/accounting/others/inventory/avg_price_valuation.html#purchase-return-use-cas://www.odoo.com/documentation/user/9.0/accounting/others/inventory/avg_price_valuation.html#purchase-return-use-case)
## Odoo's Approach on Purchase Returns - Case Remaining Qty equals zero
Looking at that rationale it is a feasible and acceptable solution that proves a point.
If this is not done this way and returns are done at cost price of transaction we could end up with either of two cases:
### Overvalued Inventory with no merchandise | Date | Transaction | Unit Cost | Average | Move Qty | Inv. Qty | Move Val. | Inv. Val. | | :--------: | :---------: | --------: | ------: | -------: | -------: | --------: | --------: | | 12/15/2016 | Purchase 01 | 32.00 | 32.00 | 10 | 10 | 320.00 | 320.00 | | 12/17/2016 | Purchase 02 | 48.00 | 40.00 | 10 | 20 | 480.00 | 800.00 | | 12/19/2016 | Sale 01 | 40.00 | 40.00 | -16 | 4 | -640.00 | 160.00 | | 12/21/2016 | Sale 02 | 40.00 | 40.00 | -2 | 2 | -80.00 | 80.00 | | 12/23/2016 | Pur. 01 Ret | 32.00 | - | -2 | 0 | -64.00 | 16.00 |
> It is to be noticed that under normal circumstances Purchase 01 Return can > only be performed if the merchandise sold to the customer is first returned > and then the supplier return can be fulfill as usual. Odoo will complain > because there is no Quant available to be returned.
### Undervalued Inventory with no merchandise | Date | Transaction | Unit Cost | Average | Move Qty | Inv. Qty | Move Val. | Inv. Val. | | :--------: | :---------: | --------: | ------: | -------: | -------: | --------: | --------: | | 12/15/2016 | Purchase 01 | 32.00 | 32.00 | 10 | 10 | 320.00 | 320.00 | | 12/17/2016 | Purchase 02 | 48.00 | 40.00 | 10 | 20 | 480.00 | 800.00 | | 12/19/2016 | Sale 01 | 40.00 | 40.00 | -16 | 4 | -640.00 | 160.00 | | 12/21/2016 | Sale 02 | 40.00 | 40.00 | -2 | 2 | -80.00 | 80.00 | | 12/23/2016 | Pur. 02 Ret | 48.00 | - | -2 | 0 | -96.00 | -16.00 |
## New Approach on Purchase Returns - Case Remaining Qty greater than zero However, for the following case the inventory that leaves cannot be booked at average cost because that implies an increase/decrease of inventory valuation without support as shown below.
> This is a real case scenario. Purchase Analyst wrongly set currency on > Purchase 03 which increases the cost of merchandise in local currency, > without being noticed it goes freely to Goods Receipt and Warehouse Analyst > receives the merchandise. Average is hugely increased and that action goes > unnoticed. Accounting People realizes about the mistake - wrong currency - > and triggers the process for merchandise returns. Meanwhile, Salesmen prepare > and successfully sales merchandise to one of his customers. Accounting > Analyst realizes that CoGS on Sale 02 was wrongly booked and Inventory > Valuation is overvalued and ultimately average is wrongly computed.
Because the process previously exposed, it is proposed that Purchase Returns to be performed at Cost of Transaction when remaining inventory is greater than zero which will result in a Stock Card like the following:
## New Approach on Sales Returns
Besides, incoming merchandise not coming from suppliers does not alter the average cost price, i.e., sales returns.
For example, if merchandise is sold to a customer and after some time and some purchase transactions, merchandise from the previous Sales Order is returned. According to Odoo Sales are return at current average price and not at Sales average price. In doing so, means that inventories will end building up creating profits or losses because the original value was less or greater.
As we can see Sale 01 Delivery was booked as follows:
Sale 01 Invoice was booked as followed:
Returns - Delivery & Invoice - were booked as follows:
Sale 01 Invoice was booked as followed:
As we can see, there is a net increase on Inventory Valuation and the CoGS is greater than that expected to be refunded by the Return
What is expected is a Stock Card like this:
Which results on a change on average cost when merchandise is returned and keeps both the Inventory Valuation and CoGS in harmony
- # Conclusions:
- When returns are made to suppliers and remaining quantity is zero Odoo's approach will be used leading to avoid over/under-valuation of inventory, i.e., average cost price will be used.
- When returns are made to suppliers and remaining quantity is different than zero then the transaction cost at which the merchaside was let in will be used.
- When returns are made to stock from other locations these are done a transaction cost.
# The Overall Expected Result:
In the image below is shown a Stock Card for Product VX Victrola with transactions as follows:
- Purchase Order for 10 items @ $100 Cost Price - Long Blue Arrow Tail.
- Sale Order for 4 items @ $100 (CoGS).
- Sale Order for 5 items @ $100 (CoGS) - Black Arrow Tail.
- Purchase Order for 3 items @ $300 Cost Price - Red Arrow Tail.
- Sale Order for 3 items @ $250 (CoGS).
- Customer Returns 1 items @ $100.00 - Cost of Good when it was sold - Black Arrow Head - Average changes.
- Purchase Order for 5 items @ $220 Cost Price - Short Blue Arrow Tail.
- Purchase Order for 3 items @ $400 Cost Price - Orange Arrow Tail.
- Return to Supplier 5 items from transaction 7 @ $220 - Short Blue Arrow Head - Average changes.
- Return to Supplier 1 items from transaction 4 @ $300 - Red Arrow Head - Average changes.
- Return to Supplier 1 items from transaction 1 @ $100 - Long Blue Arrow Head - Average changes.
- Return to Supplier 3 items from transaction 8 @ average - Orange Arrow Head - Average is kept the same.
As you can see we are trying to comply with the three cases in the scenario.
Now in the next image we are showing you that Accounting can be hand-in-hand with logistics.
All the Journal Items are the ones for the Stock Valuation Account for the product being presented previously.