Dear all
Steps to replicate the Bug:
- Create a production order for product A
- Create a second production order where product A is a raw material.
- Validate production orders in the same creation order, validation must be parallel
* Product A is configured; Cost Method: average y Property valuation : Real time
* First production order has more lines than second production order
As a result we obtain:
DATE_MOVE | DOCUMENT | LOCATION(ORIGIN) | LOCATION(DESTINATION) | QTY. | Unit._Cost | Transaction_cost | resulting_quantity |
Resulting_Unit_Cost | Resulting_Cost_Total | Resulting_cost_total (Calculated) | Difference |
2021-10-20 10:46:52 | Previous balance |
1.794,87000 | 1,884604 | 3.382,619181 | 1.794,87000 | 1,884604 | 3.382,619181 | 3382,619181 | 0 | ||
2021-10-20 11:22:45 | CONS/0001 | WHPSJ/Existencias | Ubicaciones virtuales/Producción | -137,16000 | 1,884604 | -258,492285 | 1.657,71000 | 1,884604 | 3.124,126897 | 3124,12689636 | 0 |
2021-10-20 11:23:53 | OP-41841 | Ubicaciones virtuales/Producción | WHO/Existencias | 600,00000 | 0,634400 | 380,640000 | 2.257,71000 | 1,571383 | 3.547,727113 | 3504,76689636 | 42,96 |
Where;
The calculated average cost of the last line is incorrect. el costo promedio debería ser 1,5523 y no 1,571383
Average cost and stock value calculation is
average cost = ((1.657,71000 * 1,884604)+(600,00 * 0,6344))/ ( 1.657,71000 +600,00)
average cost = 1,55235
I think the bug is caused by odoo not detecting yet the dispatch of the second production order.
affecting the formula of the product_price_update_before_done method.