Issue 10206

Wrong cost price shown on product cost history (and used for inventory valuation)
Nosy list
ced, pokoli, reviewbot, roundup-bot
Assigned to

Created on 2021-03-17.15:51:36 by pokoli, last changed 1 month ago by roundup-bot.


New changeset 8b42557cdedd by Cédric Krier in branch 'default':
Include outgoing moves in history computation
New changeset dee4f72ef04b by Cédric Krier in branch 'default':
Include outgoing moves in history computation
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-10-23.00:36:56

Indeed we should always include the in and out moves like the recomputation does and by using existing methods. The bonus point is that we gain history per warehouse if product_cost_warehouse is activated.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-04-25.18:46:59

For me it is a border case because in FIFO the last cost_price computed is only stored on the outgoing moves. But the history takes only the incoming moves as source.
I guess we could include also the outgoing moves in the history query (even if it will slow down the query). (Maybe it can be done only if product_cost_fifo is activated).

Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2021-03-17.16:47:28

El 17/3/21 a les 16:04, Cédric Krier ha escrit:

Cédric Krier added the comment:

Did the recompute_cost_price run?

No, but running them does not fix the issue.
What I've done:

  1. Use the recompute cost price wizard from the variant
  2. Run the schedule task to recompute cost price from moves

None of the options fixed the issue as it do not produce any change to the cost price nor the history.
Should I do something else?

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-03-17.16:04:02

Did the recompute_cost_price run?

Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2021-03-17.15:51:35

When both product_cost_history and product_cost_fifo are activated the product cost history showns a wrong price when the cost is updated by an outgoing move.

Here are the steps to reproduce:

  1. Create a product with fifo cost method
  2. Receive 4 unit at 10€
  3. Receive 4 unit at 12€
  4. Check the cost price of the product is 11€ and the cost shown on history is 11€
  5. Send 3 units of the product

Now the cost price on the product is updated to 11.6€ but on the history is still showing 11€.
Also browsing the locations at the current date shows a valuation of 55€ (5units x 11€) while it should be 58€ (5 units x 11.6€)

This was introduced by changeset 6542d4065178

Date User Action Args
2021-10-28 08:59:25roundup-botsetmessages: + msg71339
2021-10-28 08:59:19roundup-botsetmessages: + msg71338
nosy: + roundup-bot
status: testing -> resolved
2021-10-23 00:39:26reviewbotsetmessages: + msg71250
nosy: + reviewbot
2021-10-23 00:37:42cedsetkeyword: + review
reviews: 366171003
status: in-progress -> testing
2021-10-23 00:36:56cedsetassignedto: ced
messages: + msg71249
status: chatting -> in-progress
2021-04-25 18:46:59cedsetmessages: + msg66952
2021-03-17 16:47:28pokolisetmessages: + msg65601
status: need-eg -> chatting
2021-03-17 16:04:02cedsetmessages: + msg65598
nosy: + ced
status: unread -> need-eg
2021-03-17 15:51:36pokolicreate

Showing 10 items. Show all history (warning: this could be VERY long)