← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 648678] Re: [trunk] store move_value_cost in stock_move

 

r 3960 fixes the total value issue

I just wonder if it will perform well 
why do we need a 2 level group by ? 
IMHO product_qty, in_qty, out_qty ,in_value,out_value, total_qty,taotal_amount can be calculated in one group by

                            sum(case when type='in' then sm.product_qty when type='out' then sm.product_qty else 0 end) * pu.factor) * pt.standard_price
                            END AS value,

I also would suggest to use 'type' = 'in' instead of type in ('in')

can we discuss this report ?

IMHO what users need is group by stock location to see the in+out moves, quantity and value per stock which is
a union view like

---incoming moves
                create or replace view chricar_report_location_moves
                as (
                select id*2 as id,name,
                     picking_id,product_id, 
                     location_dest_id as location_id,
                     partner_id,period_id,prodlot_id,
                     date_planned,   
                     product_qty,move_value_cost,move_value_sale,
                     case when product_qty != 0 then  move_value_cost/product_qty  else 0 end as cost_price,
                     case when product_qty != 0 then  move_value_sale/product_qty  else 0 end as sale_price,
                     state
                from stock_move
 -- outgoing moves                   
                union all
                select id*2-1 as id,name,
                     picking_id,product_id, 
                     location_id,
                     partner_id,period_id,prodlot_id,
                     date_planned,   
                     -product_qty,-move_value_cost,-move_value_sale,
                     case when product_qty != 0 then  move_value_cost/product_qty  else 0 end as cost_price,
                     case when product_qty != 0 then  move_value_sale/product_qty  else 0 end as sale_price,
                     state
                from stock_move

-- 
[trunk] store move_value_cost in stock_move 
https://bugs.launchpad.net/bugs/648678
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.

Status in OpenObject Addons Modules: Confirmed

Bug description:
this patch adds move_value_cost to stock move and allows stock analysis for real time accounting with values which are identical to accounting moves.

Please check "Total Value"
which originally is calculated as
pt.standard_price * sum(sm.product_qty) as value

IMHO this adds up incoming and outgoing qty and multiplies it with price - result is "Total Move Value" (a rarely used figure)
what would be of interest is
"Move Value In"
"Move Value Out"
"Stock Value" (but this is problematic if records are filtered by time) (In - Out)

Please add also test cases for "real time" evaluation