On Monday, July 7, 2014 10:26:07 AM UTC+2, Cédric Krier wrote:
>
> On 07 Jul 01:06, Michal wrote: 
> > 
> > 
> > 
> > > > This is the average of the remaining product of the fifo stack. 
> > > 
> > > Oops, no it is the next cost price out of the fifo stack. 
>
> I should really read more carefully the code. 
> It is the average see the test scenario: 
>
> http://hg.tryton.org/modules/product_cost_fifo/file/3f9793486d52/tests/scenario_product_cost_fifo.rst#l122
>  
>
>  
Thanks for a quick answer, but your scenario is working while mine is not.
As I understand cost_price is a calculation of average prices of what is 
not consumed yet (it is ok for me)

I do the following tests:

Test 1)

Supplier Shipment                                 Account move
Line No                 Quantity  Price           Debit   Credit
------------------------------------------------------------------
  1      Product_1        5.00       5.00           25.00    25.00
  2      Product_1        5.00      10.00           50.00    50.00

Customer Shipment                                  Account move
 Line No                 Quantity  Price           Debit   Credit
------------------------------------------------------------------
  1      Product_1        7.00       fifo           45.00    45.00 


Cost Price  3.75 <---- WRONG PRICE
----------------------------------

Test 2)

Supplier Shipment 1                                Account move
 Line No                 Quantity  Price           Debit   Credit
-------------------------------------------------------------------
    1     Product_1        5.00       5.00           25.00    25.00

Supplier Shipment 2                                 Account move
 Line No                  Quantity  Price           Debit   Credit
-------------------------------------------------------------------
    1     Product_1        5.00      10.00           50.00    50.00

Customer Shipment                          Account move
 Line No                 Quantity  Price           Debit   Credit
-------------------------------------------------------------------
    1     Product_1        7.00       fifo           45.00    45.00 

Cost Price  10.00 <--- CORRECT PRICE  (3 pieces left each at 10.00)
------------------------------------

As you can see in first test I made one supplier shipment with 2 lines and 
in second
test I made two supplier shipments. In first case system did not
updated the cost_price at second line of stock move.

So the bottom line is that on one incoming move there cannot be the same
product twice at different prices. Am I correct ?

regards
Michal    
 

> > 
> > I did some more tests with incoming and outgoing moves: 
> > 
> > cost price method = fifo 
> > 
> > Supplier Shipment                            Account move 
> >                  Quantity  Price           Debit   Credit 
> > --------------------------------------------------------- 
> > Product_1        5.00       5.00           25.00    25.00 
> > Product_1        5.00      10.00           50.00    50.00 
> > 
> > Customer Shipment                            Account move 
> >                  Quantity  Price           Debit   Credit 
> > --------------------------------------------------------- 
> > Product_1        7.00       fifo           45.00    45.00 
> >                                              ^ 
> >                                              | 
> >                                              +----- 5*5+2*10 - OK 
> > 
> > stock moves - ok 
> > account moves - ok 
> > but on Product form you can see: 
> > Cost Price  3.75     <-   this is neither average price (7.5 in this 
> case) 
> >                                    nor the one of fifo prices (5 or 10) 
> > How this value is calculated ? 
>
> It is the average but of course it depends on the initial values. 
>
> > By the way 
> > There is also a functional field cost_value in stock module which is 
> also 
> > not 
> > working with fifo cost pricing method. 
> > You can see cost_value on Inventory & Stock->Locations, dbl click on 
> > location 
> > an there is a report Products by locations. 
> > 
> > There is: 
> > 
> > Product Template    Quantity   Cost Value 
> > ----------------------------------------- 
> > Product_1               3.00        11.25 
> > 
> > while there should be: 
> > 
> > Product Template    Quantity   Cost Value 
> > ----------------------------------------- 
> > Product_1               3.00        30.00 
> > 
> > I see that function stock.location.get_cost_value() does simple 
> > calculation product.cost_price  * location.quantity, 
> > while it could use function product.template.get_fifo_move() 
> > from module product_cost_fifo. 
>
> This will be too slow so by using the average normally we get the right 
> value. 
>
> -- 
> Cédric Krier - B2CK SPRL 
> Email/Jabber: [email protected] <javascript:> 
> Tel: +32 472 54 46 59 
> Website: http://www.b2ck.com/ 
>

Reply via email to