FrontAccountingERP / FA

Official FrontAccounting mirror repository
94 stars 96 forks source link

`standard_cost` is calculated wrongly and stamped into `stock_moves` then used in update account COGS #51

Open zybersup opened 1 year ago

zybersup commented 1 year ago

Sometimes I find that the value of some items in the remaining stock are over or under so much more than what they should be. After digging into the data I found that there are some records in stock_moves that has wrong value of standard_cost when we sell that item. (I means it happens with the transaction of delivery note.) The values are just much higher or lower than the last one above without reason or clue to find the cause.

I found a case that it was the total cost of that item (quantity x price) rather than the value of each, and the same wrong value is stamped in debtor_tran_details of delivery note while the value in debtor_tran_details of invoice is correctly the value of each item.

Sometimes it is not rational to any value around it and I had no clue to investigate the case.

The values in stock_moves are used to inserted as COGS account in gl_trans so it makes the stock valuation much higher or lower than it should be. And as the last one will be used with the next next transactions, so it makes the coming COGS transactions wrongly recorded.

I tried to find the code that calculating this standard cost so I might be able to correct it but it is not successful yet.

I will capture some examples and put here later soon.