Tryton - Issues

 

Issue7918

Title negative product cost price for sales and production with UOM less than default
Priority bug Status resolved
Superseder Nosy List MR, angel, ced, reviewbot, roundup-bot
Type behavior Components product_cost_fifo
Assigned To ced Keywords review
Reviews 251121002
View: 251121002

Created on 2018-12-11.13:29:59 by MR, last changed by roundup-bot.

Messages
New changeset 04781145f71a by Cédric Krier in branch '5.0':
Do not get product from last fifo moves but from self move
https://hg.tryton.org/modules/product_cost_fifo/rev/04781145f71a

New changeset 0fd75e032b96 by Cédric Krier in branch '4.8':
Do not get product from last fifo moves but from self move
https://hg.tryton.org/modules/product_cost_fifo/rev/0fd75e032b96

New changeset 12557af3ba5c by Cédric Krier in branch '4.6':
Do not get product from last fifo moves but from self move
https://hg.tryton.org/modules/product_cost_fifo/rev/12557af3ba5c
New changeset e7c2fb042e49 by Cédric Krier in branch 'default':
Do not get product from last fifo moves but from self move
https://hg.tryton.org/tryton-env/rev/e7c2fb042e49
New changeset 19a69c93a7a5 by Cédric Krier in branch 'default':
Do not get product from last fifo moves but from self move
https://hg.tryton.org/modules/product_cost_fifo/rev/19a69c93a7a5
msg48786 (view) Author: [hidden] (MR) (Tryton translator) Date: 2019-04-09.23:28:11
It's seem not resolved already:
  
File "/trytond/modules/stock/move.py", line 603, in do
    cost_price = move._do()
  File "/trytond/modules/product_cost_fifo/move.py", line 104, in _do
    self._update_fifo_out_product_cost_price())
  File "/trytond/modules/product_cost_fifo/move.py", line 78, in _update_fifo_out_product_cost_price
    move.product.default_uom, cost_price, self.uom)
UnboundLocalError: local variable 'move' referenced before assignment
New changeset 96d9be7eb3a1 by Cédric Krier in branch '5.0':
Convert cost price into move uom to compute average cost price
https://hg.tryton.org/modules/product_cost_fifo/rev/96d9be7eb3a1

New changeset 7d285b9f991c by Cédric Krier in branch '4.8':
Convert cost price into move uom to compute average cost price
https://hg.tryton.org/modules/product_cost_fifo/rev/7d285b9f991c

New changeset 8511c6e7bd33 by Cédric Krier in branch '4.6':
Convert cost price into move uom to compute average cost price
https://hg.tryton.org/modules/product_cost_fifo/rev/8511c6e7bd33
New changeset 1b238a1bcc4e by Cédric Krier in branch 'default':
Convert cost price into move uom to compute average cost price
https://hg.tryton.org/tryton-env/rev/1b238a1bcc4e
New changeset 0e32a0ae4a16 by Cédric Krier in branch 'default':
Convert cost price into move uom to compute average cost price
https://hg.tryton.org/modules/product_cost_fifo/rev/0e32a0ae4a16

New changeset 07e3efb3ae50 by Cédric Krier in branch 'default':
Add test scenario with non default UoM
https://hg.tryton.org/modules/product_cost_fifo/rev/07e3efb3ae50
review251121002 updated at https://codereview.tryton.org/251121002/#ps279071002
msg47541 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-03-10.20:04:26
Here is review251121002 which should fix the problem introduced by issue6626.
msg45259 (view) Author: [hidden] (MR) (Tryton translator) Date: 2018-12-11.13:29:58
Tryton 5.0. If I select UOM less than default ( for example, the product with default UOM in meters I sale in centimeters) for sale or production input, after few sale or production cycles I get negative product cost price in product cost history.
I don't know the coding, but in my opinion the problem is the value move.unit_price attached in product_cost_fifo/move.py function _update_fifo_out_product_cost_price in default UOM and after recalculated in stock/move.py  Move class method _compute_product_cost_price from move UOM to default UOM, it's mean the unit_price is 100 times bigger in my centimeters-meters case
History
Date User Action Args
2019-05-04 11:13:57roundup-botsetmessages: + msg49601
2019-04-10 09:55:16roundup-botsetmessages: + msg48788
2019-04-10 09:55:13roundup-botsetstatus: chatting -> resolved
messages: + msg48787
2019-04-09 23:28:12MRsetstatus: resolved -> chatting
messages: + msg48786
2019-03-28 19:57:36roundup-botsetmessages: + msg48104
2019-03-22 11:18:56roundup-botsetmessages: + msg47765
2019-03-22 11:18:41roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg47764
2019-03-10 20:14:23reviewbotsetnosy: + reviewbot
messages: + msg47542
2019-03-10 20:04:26cedsetstatus: in-progress -> testing
reviews: 251121002
messages: + msg47541
keyword: + review
2019-03-10 19:12:10cedsetstatus: unread -> in-progress
assignedto: ced
type: behavior
component: + product_cost_fifo
nosy: + ced
2019-01-03 16:13:58angelsetnosy: + angel
2018-12-11 13:29:59MRcreate