← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 779145] Re: stock move - price_unit missing for avg price and not "IN"

 

let's start with a bit of accounting theory

product value = qty*price

simplest case: product_values in all of these records are identical
* PO/SO line == stock_move == invoice_line == account_move 

if AVERAGE and REAL TIME price is used in a volatile market the product
average price will change with every incoming product move.

to be able to calculate correctly the value of a product at period
(month/year) end we MUST  store the product value (or it's components
qty and price) in every stock move.

this is also necessary to make stock reports and analysis - which must
include values - returning meaningful values.

currently only the price of incoming goods is stored - IMHO the
"current" price for all moves must be stored to be able to generate
reproducable results.

product_product.standard_price * product_product.qty_available gives
"only" the correct value for all other point in time it is WRONG!.

the patch adds the current "price_unit" to each stock move which allows to calculate
* stock value = sum(price_unit*qty) for every point in time.

I suggest to store move_value = price_unit * qty for every stock move.
* stock_value = sum(move_value) to avoid rounding differences and differences to account_move_lines.

in "Moves Analysis" there is a column "Total Value" and IMHO this must show correct figures 
similar in "Inventory Analysis" grouped by "Date"

in
./report/report_stock_move.py
                        CASE WHEN sp.type in ('in') THEN
                            sum(sm.product_qty * pu.factor) * pt.standard_price
                            ELSE 0.0
                            END AS in_value,

returns  wrong and unsusable values .....
it is absulutely necessary to use the price_unit of the move line.

and instead of haveing to calcualte
- sum(sm.product_qty * pu.factor) * move.price_unit
we should have 
- sum(move_value)

BTW much if this is available in 
http://bazaar.launchpad.net/~c2c/+junk/c2c_austria_dev/files/head:/c2c_stock_accounting/

we really should team up to get a working stock accounting ASAP.

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/779145

Title:
  stock move - price_unit missing for avg price and not "IN"

Status in OpenERP Modules (addons):
  Incomplete

Bug description:
  to be able to calculate the stock value for every point in time for avg price and real time
  obviously for accounting purpose real time we must have 
  account_balance == stock values
  and must be able to proove it

  if (pick.type != 'in') and (move.product_id.cost_method == 'average'):

  if all stock moves have the price_unit field  set:
  qty * price_unit= move_value
  and sum(+/- move_value) 
  enables to calculated  the total stock value per product in every point of time matching the account balance

  a little step further will be to calculated the average price per
  stock_location and lot


References