product_reserve: test orderpoint

test that reservations will trigger orderpoint procurements
This commit is contained in:
Alexandre Fayolle
2014-09-08 16:40:29 +02:00
parent 7e81c6c314
commit 8061ad3ada

View File

@@ -1,7 +1,7 @@
-
I create a product to test the stock reservation
-
!record {model: product.product, id: product_sorbet}:
!record {model: product.product, id: product_sorbet}:
default_code: 001SORBET
name: Sorbet
type: product
@@ -10,6 +10,16 @@
standard_price: 70.0
uom_id: product.product_uom_kgm
uom_po_id: product.product_uom_kgm
-
I create a stock orderpoint for the product
-
!record {model: stock.warehouse.orderpoint, id: sorbet_orderpoint}:
warehouse_id: stock.warehouse0
location_id: stock.stock_location_stock
product_id: product_sorbet
product_uom: product.product_uom_kgm
product_min_qty: 4.0
product_max_qty: 15.0
-
I update the current stock of the Sorbet with 10 kgm
-
@@ -58,6 +68,19 @@
!python {model: product.product}: |
product = self.browse(cr, uid, ref('stock_reserve.product_sorbet'), context=context)
assert product.virtual_available == 3.5, "Stock is not updated."
-
I run the scheduler
-
!python {model: procurement.order}: |
self.run_scheduler(cr, uid)
-
The procurement linked to the orderpoint must be in exception (no routes configured)
-
!python {model: stock.warehouse.orderpoint}: |
orderpoint = self.browse(cr, uid, ref('sorbet_orderpoint'))
assert orderpoint.procurement_ids[0].state == 'exception', 'procurement must be in exception as there is no rule for procurement'
import math
assert orderpoint.procurement_ids[0].product_qty == math.ceil(15 - 3.5), 'wrong product qty ordered'
-
I release the reservation
-