[FIX] stock: yml tests (procrule.yml and move.yml) + [IMP] set mrp_jit as auto_install
bzr revid: qdp-launchpad@openerp.com-20130903101116-ruess6702g1xqgsb
This commit is contained in:
parent
23dfd3bbbc
commit
010a830a32
|
@ -44,6 +44,6 @@ In that case, you can not use priorities any more on the different picking.
|
|||
'demo': [],
|
||||
'test': ['test/mrp_jit.yml'],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
'auto_install': True,
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -27,7 +27,6 @@ class procurement_order(osv.osv):
|
|||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
procurement_id = super(procurement_order, self).create(cr, uid, vals, context=context)
|
||||
# TODO: maybe this is not necessary anymore as we do this already
|
||||
self.run(cr, uid, [procurement_id], context=context)
|
||||
self.check(cr, uid, [procurement_id], context=context)
|
||||
return procurement_id
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
-
|
||||
I create a move of 5 products from stock to customer
|
||||
I first create a new product
|
||||
-
|
||||
!record {model: product.product, id: move_product}:
|
||||
name: move prod
|
||||
type: product
|
||||
-
|
||||
In order to test the negative quants, I create a move of 5 products from stock to customer
|
||||
-
|
||||
!record {model: stock.move, id: move_test0}:
|
||||
name: Move Products
|
||||
product_id: product.product_product_3
|
||||
product_id: move_product
|
||||
product_uom_qty: 5
|
||||
product_uom: product.product_uom_unit
|
||||
product_uos_qty: 5
|
||||
|
@ -16,63 +22,38 @@
|
|||
!python {model: stock.move}: |
|
||||
self.action_confirm(cr, uid, [ref('move_test0')], context=context)
|
||||
-
|
||||
I check that the quantity on hand is 18 and virtual is 13
|
||||
I check that the quantity on hand is 0 and virtual is -5
|
||||
-
|
||||
!python {model: product.product}: |
|
||||
context['location'] = False
|
||||
product = self.browse(cr, uid, ref('product.product_product_3'), context=context)
|
||||
assert product.qty_available==18, 'Expecting 18 products in stock, got %.2f!' % (product.qty_available,)
|
||||
assert product.virtual_available==13.0, 'Expecting 13 products in virtual stock, got %.2f!' % (product.virtual_available,)
|
||||
product = self.browse(cr, uid, ref('move_product'), context=context)
|
||||
assert product.qty_available == 0, 'Expecting 0 products in stock, got %.2f!' % (product.qty_available,)
|
||||
assert product.virtual_available == -5.0, 'Expecting -5 products in virtual stock, got %.2f!' % (product.virtual_available,)
|
||||
-
|
||||
I validate the move
|
||||
-
|
||||
!python {model: stock.move}: |
|
||||
self.action_done(cr, uid, [ref('move_test0')], context=context)
|
||||
-
|
||||
I check that the quantity on hand is 13 and 5 products are at customer location
|
||||
I check that the quantity on hand is -5 and 5 products are at customer location
|
||||
-
|
||||
!python {model: product.product}: |
|
||||
context['location'] = False
|
||||
product = self.browse(cr, uid, ref('product.product_product_3'), context=context)
|
||||
assert product.qty_available==13, 'Expecting 13 products in stock, got %.2f!' % (product.qty_available,)
|
||||
product = self.browse(cr, uid, ref('move_product'), context=context)
|
||||
assert product.qty_available == -5, 'Expecting -5 products in stock, got %.2f!' % (product.qty_available,)
|
||||
|
||||
context['location'] = ref('stock.stock_location_customers')
|
||||
product = self.browse(cr, uid, ref('product.product_product_3'), context=context)
|
||||
assert product.qty_available==5, 'Expecting 5 products in customer location, got %.2f!' % (product.qty_available,)
|
||||
product = self.browse(cr, uid, ref('move_product'), context=context)
|
||||
assert product.qty_available == 5, 'Expecting 5 products in customer location, got %.2f!' % (product.qty_available,)
|
||||
-
|
||||
In order to test negative quants, I will deliver 14 products to the customer
|
||||
-
|
||||
!record {model: stock.move, id: move_test1}:
|
||||
name: Move 14 Products
|
||||
product_id: product.product_product_3
|
||||
product_uom_qty: 14
|
||||
product_uom: product.product_uom_unit
|
||||
product_uos_qty: 14
|
||||
product_uos: product.product_uom_unit
|
||||
location_id: stock.stock_location_stock
|
||||
location_dest_id: stock.stock_location_customers
|
||||
-
|
||||
I confirm and validate the move
|
||||
-
|
||||
!python {model: stock.move}: |
|
||||
self.action_confirm(cr, uid, [ref('move_test1')], context=context)
|
||||
self.action_done(cr, uid, [ref('move_test1')], context=context)
|
||||
-
|
||||
I check that the quantity on hand is -2
|
||||
-
|
||||
!python {model: product.product}: |
|
||||
context['location'] = False
|
||||
product = self.browse(cr, uid, ref('product.product_product_3'), context=context)
|
||||
assert product.qty_available == -1, 'Expecting -1 products in stock, got %.2f!' % (product.qty_available,)
|
||||
-
|
||||
To compensate negative quants, I will receive 5 products from the supplier
|
||||
To compensate negative quants, I will receive 15 products from the supplier
|
||||
-
|
||||
!record {model: stock.move, id: move_test2}:
|
||||
name: Move 15 Products
|
||||
product_id: product.product_product_3
|
||||
product_uom_qty: 5
|
||||
product_id: move_product
|
||||
product_uom_qty: 15
|
||||
product_uom: product.product_uom_unit
|
||||
product_uos_qty: 5
|
||||
product_uos_qty: 15
|
||||
product_uos: product.product_uom_unit
|
||||
location_id: stock.stock_location_suppliers
|
||||
location_dest_id: stock.stock_location_stock
|
||||
|
@ -83,9 +64,51 @@
|
|||
self.action_confirm(cr, uid, [ref('move_test2')], context=context)
|
||||
self.action_done(cr, uid, [ref('move_test2')], context=context)
|
||||
-
|
||||
I check that the quantity on hand is 4
|
||||
I check that the quantity on hand is 10
|
||||
-
|
||||
!python {model: product.product}: |
|
||||
context['location'] = False
|
||||
product = self.browse(cr, uid, ref('product.product_product_3'), context=context)
|
||||
assert product.qty_available == 4, 'Expecting 4 products in stock, got %.2f!' % (product.qty_available,)
|
||||
product = self.browse(cr, uid, ref('move_product'), context=context)
|
||||
assert product.qty_available == 10, 'Expecting 10 products in stock, got %.2f!' % (product.qty_available,)
|
||||
assert product.virtual_available == 10.0, 'Expecting 10 products in virtual stock, got %.2f!' % (product.virtual_available,)
|
||||
-
|
||||
I create a move of 2 products from stock to customer
|
||||
-
|
||||
!record {model: stock.move, id: move_test1}:
|
||||
name: Move Products
|
||||
product_id: move_product
|
||||
product_uom_qty: 2
|
||||
product_uom: product.product_uom_unit
|
||||
product_uos_qty: 2
|
||||
product_uos: product.product_uom_unit
|
||||
location_id: stock.stock_location_stock
|
||||
location_dest_id: stock.stock_location_customers
|
||||
-
|
||||
I confirm the move to be processed in the future
|
||||
-
|
||||
!python {model: stock.move}: |
|
||||
self.action_confirm(cr, uid, [ref('move_test1')], context=context)
|
||||
-
|
||||
I check that the quantity on hand is 10 and virtual is 8
|
||||
-
|
||||
!python {model: product.product}: |
|
||||
context['location'] = False
|
||||
product = self.browse(cr, uid, ref('move_product'), context=context)
|
||||
assert product.qty_available == 10, 'Expecting 10 products in stock, got %.2f!' % (product.qty_available,)
|
||||
assert product.virtual_available == 8.0, 'Expecting 8 products in virtual stock, got %.2f!' % (product.virtual_available,)
|
||||
-
|
||||
I validate the move
|
||||
-
|
||||
!python {model: stock.move}: |
|
||||
self.action_done(cr, uid, [ref('move_test1')], context=context)
|
||||
-
|
||||
I check that the quantity on hand is 8 and 7 products are at customer location
|
||||
-
|
||||
!python {model: product.product}: |
|
||||
context['location'] = False
|
||||
product = self.browse(cr, uid, ref('move_product'), context=context)
|
||||
assert product.qty_available == 8, 'Expecting 10 products in stock, got %.2f!' % (product.qty_available,)
|
||||
|
||||
context['location'] = ref('stock.stock_location_customers')
|
||||
product = self.browse(cr, uid, ref('move_product'), context=context)
|
||||
assert product.qty_available == 7, 'Expecting 7 products in customer location, got %.2f!' % (product.qty_available,)
|
||||
|
|
|
@ -25,11 +25,16 @@
|
|||
-
|
||||
!python {model: stock.picking}: |
|
||||
self.action_confirm(cr, uid, [ref('pick_output')])
|
||||
-
|
||||
I run the scheduler.
|
||||
-
|
||||
!python {model: procurement.order}: |
|
||||
self.run_scheduler(cr, uid)
|
||||
-
|
||||
Check a picking was created from stock to output.
|
||||
-
|
||||
!python {model: stock.move }: |
|
||||
picking = self.pool.get("stock.picking").browse(cr, uid, ref("pick_output"))
|
||||
move_id = self.search(cr, uid, [('product_id', '=', ref('product.product_product_3')),('location_id', '=', ref('stock.stock_location_stock')),
|
||||
('location_dest_id', '=', ref('stock.stock_location_output'), ('move_dest_id', '=', picking.move_lines[0].id))])
|
||||
('location_dest_id', '=', ref('stock.stock_location_output')), ('move_dest_id', '=', picking.move_lines[0].id)])
|
||||
assert len(move_id) == 1, "It should have created a picking from Stock to Output with the original picking as destination"
|
Loading…
Reference in New Issue