← Back to team overview

credativ team mailing list archive

[Bug 923191] Re: [trunk] incorrect stock accounting valuations using standard cost

 

Hi Graeme,

Thank you for your detailed analysis. You're absolutely correct and I
agree that removing the unnecessary override is the best solution. For
average costing the PO price is already made available via the default
receipt cost of the picking/move receipt wizard, so we don't need
anything else. The cost should always be properly set on the move once
it's been received, and we can simply use it.

The fix has landed in trunk (6.1) at revision 6461 rev-id:
odo@xxxxxxxxxxx-20120201113724-y18fna1v7z6kxka4

BTW until this case is properly covered by a YAML test we should not
consider it really fixed. If anyone from the community would like to
contribute on this topic, please make a merge proposal to complement the
current YAML tests with a minimalist case checking a scenario similar to
the one in the bug description. The test should fail before revision
6461, and pass afterwards.

Thanks for the excellent bug report!

** Changed in: openobject-addons
   Importance: Undecided => Medium

** Changed in: openobject-addons
       Status: Confirmed => Fix Released

** Changed in: openobject-addons
    Milestone: None => 6.1

** Changed in: openobject-addons
     Assignee: (unassigned) => OpenERP R&D Addons Team 3 (openerp-dev-addons3)

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

Title:
  [trunk] incorrect stock accounting valuations using standard cost

Status in OpenERP Addons (modules):
  Fix Released

Bug description:
  in purchase module stock.py the method
  _get_reference_accounting_values_for_valuation is incorrectly
  overridden.

  to reproduce.
  Set a product as standard cost of $1.00
  Raise a purchase order for this product at $1.50 * 10

  Expected entries
  Stock dr $10
  Stock Input cr $10

  Results
  $15 in each.

  if using standard cost the correct valuation at receipting time is the
  products standard cost * quantity.  this is the whole point of using
  standard cost in the first place.  However this override cause the
  stock valuation calculation to become po line price * qty.  When
  products are sold downstream this will cause an error in stock
  valuation.

  The line 
  if move.product_id.cost_method != 'average' or not move.price_unit:

  should be changed, probably to

  if move.product_id.cost_method == 'average' and not move.price_unit:

  but in truth, this function could just be deleted entirely as there is
  no condition where this should evaluate to true, and even if it did,
  it is safer to take the standard_price which already occurs than just
  assume that the po_line is the correct price as the scale of potential
  errors is significantly smaller with the former and po's have no
  accounting entries.

  In any case, with standard accounting it makes no difference, and with
  anglosaxon the price difference is picked up at invoice.  Note that
  this bug is a root cause of the symptons of bug 922077

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


References