← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 688493] Re: Stock wizard_partial_picking Average price computation doesnt work as expectet

 

Hello,

Steps for Reproducing this bug:

1) Make new product with costing method as an average price and give the
price 1500 and update the real stock with 2 units.

2)Make a new purchase order for this product with the same price and
qty=2 and then process its picking with the change in price 1000 at the
time of incoming shipments.(Here process the picking without splitting
the move line).

So For that product we have Qty=4 and Average Price=1250 in product's
form view which is correct.

3)Now for same product please follow the steps:1,2 and this time split
the move line into 2 lines with qty=1 of each.

After that open the product's form view Average Price=1222.22 which is
not correct as it is the same case as previous one.

Thanks.

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

** Changed in: openobject-addons
       Status: Incomplete => Confirmed

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

-- 
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/688493

Title:
  Stock wizard_partial_picking Average price computation doesnt work as expectet

Status in OpenObject Addons Modules:
  Confirmed

Bug description:
  In the wizard_partial_picking.py in line 146 the new standard_price of a product (cost_method = average) is calculated:
new_std_price = ((product.standard_price * product.qty_available) + (new_price * qty))/(product.qty_available + qty)

I've a product with a standard_price of 1500 and an available qty of 2, now i purchase 2 additional product with a unit price of 1000:

if ive one move_line with qty:2 price 1000 the calculation works fine:

((1500 * 2) + (1000 * 2)) / (2 + 2) = 1250 

but if i split the the line in 2 lines each with a qty of 1 and a price of 1000 the product_qty_available will not be taken in count wich causes this problem:

((1500 * 2) + (1000 * 1)) / (2 + 1) = 1333,33 
after calculating the new cost_price for the first line the new price is written in the product but the qty_available doesnt change
as the workflow action that ends the move is called later in the method.
((1333,33 * 2) + (1000 * 1)) / (2 + 1) = 1222,22 
This average price is wrong, the right one would take the additional qty of the first line in count :
((1333,33 * 3) + (1000 * 1)) / (2 + 1) = 1250





References