2013-06-24 15:28:50 +00:00
-
2013-08-22 12:51:50 +00:00
Set product category removal strategy as LIFO
2013-06-24 15:28:50 +00:00
-
2013-08-23 10:13:59 +00:00
!record {model: product.category, id: product.product_category_001}:
2013-08-23 06:50:53 +00:00
name : Lifo Category
2014-04-16 15:13:45 +00:00
removal_strategy_id : stock.removal_lifo
2013-04-26 11:17:30 +00:00
-
Set a product as using lifo price
-
!record {model: product.product, id: product_lifo_icecream}:
default_code : LIFO
name : LIFO Ice Cream
type : product
2013-09-16 12:03:43 +00:00
categ_id : product.product_category_001
2013-04-26 11:17:30 +00:00
list_price : 100.0
standard_price : 70.0
uom_id : product.product_uom_kgm
uom_po_id : product.product_uom_kgm
valuation : real_time
2013-06-25 15:26:20 +00:00
cost_method : real
2013-04-26 11:17:30 +00:00
property_stock_account_input : account.o_expense
property_stock_account_output : account.o_income
description : LIFO Ice Cream can be mass-produced and thus is widely available in developed parts of the world. Ice cream can be purchased in large cartons (vats and squrounds) from supermarkets and grocery stores, in smaller quantities from ice cream shops, convenience stores, and milk bars, and in individual servings from small carts or vans at public events.
-
I create a draft Purchase Order for first in move for 10 pieces at 60 euro
-
!record {model: purchase.order, id: purchase_order_lifo1}:
partner_id : base.res_partner_3
location_id : stock.stock_location_stock
2013-12-11 17:04:39 +00:00
pricelist_id : purchase.list0
2013-04-26 11:17:30 +00:00
order_line :
- product_id : product_lifo_icecream
product_qty : 10.0
2013-11-28 10:18:23 +00:00
product_uom : product.product_uom_kgm
2013-04-26 11:17:30 +00:00
price_unit : 60.0
name : 'LIFO Ice Cream'
-
I create a draft Purchase Order for second shipment for 30 pieces at 80 euro
-
!record {model: purchase.order, id: purchase_order_lifo2}:
partner_id : base.res_partner_3
location_id : stock.stock_location_stock
2013-12-11 17:04:39 +00:00
pricelist_id : purchase.list0
2013-04-26 11:17:30 +00:00
order_line :
- product_id : product_lifo_icecream
product_qty : 30.0
2013-11-28 10:18:23 +00:00
product_uom : product.product_uom_kgm
2013-04-26 11:17:30 +00:00
price_unit : 80.0
name : 'LIFO Ice Cream'
-
I confirm the first purchase order
-
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_lifo1}
-
I check the "Approved" status of purchase order 1
-
!assert {model: purchase.order, id: purchase_order_lifo1}:
- state == 'approved'
-
Process the reception of purchase order 1
-
2013-08-22 12:51:50 +00:00
!python {model: stock.picking}: |
order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_lifo1")).picking_ids[0]
2013-11-18 13:47:01 +00:00
order.do_transfer(context=context)
2013-04-26 11:17:30 +00:00
-
Check the standard price of the product (lifo icecream)
-
!python {model: product.product}: |
assert self.browse(cr, uid, ref("product_lifo_icecream")).standard_price == 70.0, 'Standard price should not have changed!'
2013-05-10 11:42:08 +00:00
-
I confirm the second purchase order
-
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_lifo2}
2014-03-13 15:10:15 +00:00
-
2013-04-26 11:17:30 +00:00
Process the reception of purchase order 2
-
2013-08-22 12:51:50 +00:00
!python {model: stock.picking}: |
order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_lifo2")).picking_ids[0]
2013-11-18 13:47:01 +00:00
order.do_transfer(context=context)
2013-04-26 11:17:30 +00:00
-
Check the standard price should not have changed
-
!python {model: product.product}: |
assert self.browse(cr, uid, ref("product_lifo_icecream")).standard_price == 70.0, 'Standard price as lifo price of second reception incorrect!'
-
Let us send some goods
-
!record {model: stock.picking, id: outgoing_lifo_shipment}:
2013-08-22 12:51:50 +00:00
picking_type_id : stock.picking_type_out
2013-04-26 11:17:30 +00:00
-
Picking needs movement from stock
-
!record {model: stock.move, id: outgoing_shipment_lifo_icecream}:
picking_id : outgoing_lifo_shipment
product_id : product_lifo_icecream
product_uom : product.product_uom_kgm
2013-08-22 12:51:50 +00:00
location_id : stock.stock_location_stock
location_dest_id : stock.stock_location_customers
2013-09-16 12:03:43 +00:00
product_uom_qty : 20.0
2013-08-22 12:51:50 +00:00
picking_type_id : stock.picking_type_out
2013-06-29 20:53:24 +00:00
-
I assign this outgoing shipment
-
!python {model: stock.picking}: |
self.action_assign(cr, uid, [ref("outgoing_lifo_shipment")])
2013-04-26 11:17:30 +00:00
-
Process the delivery of the outgoing shipment
-
2013-08-22 12:51:50 +00:00
!python {model: stock.picking}: |
pick_order = self.pool.get('stock.picking').browse(cr, uid, ref("outgoing_lifo_shipment"))
2013-11-18 13:47:01 +00:00
pick_order.do_transfer(context=context)
2013-04-26 11:17:30 +00:00
-
2013-06-29 20:53:24 +00:00
Check standard price became 80 euro
2013-04-26 11:17:30 +00:00
-
2013-06-29 20:53:24 +00:00
!python {model: product.product}: |
assert self.browse(cr, uid, ref("product_lifo_icecream")).standard_price == 80.0, 'Price should have been 80 euro'