← Back to team overview

openerp-india team mailing list archive

[Bug 1163060] Re: average price computation

 

*** This bug is a duplicate of bug 610738 ***
    https://bugs.launchpad.net/bugs/610738

@Kevin: thanks for the code suggestion, I think it will work.
Stephan.

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1163060

Title:
  average price computation

Status in OpenERP Addons (modules):
  New

Bug description:
  This affects both V6 and V7

  stock/stock.py - do_partial - average price computation

  The first if statement limits the average price computation to a pcik
  type of 'in'.

  This means that a stock return for a purchase does not update average cost.
  For example:

  Receive  10 @ 20.00       SOH = 10     Avg Cost = $20.00       Value 200.00
  Receive  10  @ 15.00      SOH = 20    Avg Cost = $17.50        Value 350.00
  Return to Supplier 
   Per curr logic:    5 @ $20.00     SOH = 15   Avg Cost = $17.50
   Should be:           5 @ $20.00    SOH = 15   Avg Cost = $ 16.67

  Note - the return is correctly picking up the cost from the inwards
  move, so does that outwards move (ie the return) at the cost
  applicable for the receipt. Howver line 1256 means that this move is
  not catered for in the average cost computation

  I suggest the following logic:

  if pick.purchase_id and move.product_id.cost_method == 'average'
    if pick.type == 'in'
      [do as per current]
    else
    [similar logic except is an out not an in for qty calculations]

  
  NOTE: I have checked the sale returns logic. The cost of the return move uses the current average cost of the product rather than the cost of the orinal move. While this is technically incorrect, both the average cost and the journal entries created align, so at least it doesn't make an immediate error. Ideally, the sale return move should use the cost from the original sale move, in which case the average cost will need to be recalculated as well.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1163060/+subscriptions