[IMP] Added a yaml test for partial picking. It emphasizes a bug to fix

bzr revid: fp@tinyerp.com-20111109161310-pdkn6jetk7q5ft5b
This commit is contained in:
Fabien Pinckaers 2011-11-09 17:13:10 +01:00
parent ca05a8dbc6
commit 15375b9835
1 changed files with 25 additions and 10 deletions

View File

@ -3,13 +3,13 @@
-
I confirm and force the availability of all products on the picking OUT001
-
!python {model: stock.picking}:
self.draft_force_assign(cr, uid, ref('stock.stock_picking_1'), {})
self.force_assign(cr, uid, ref('stock.stock_picking_1'), {})
!python {model: stock.picking}: |
self.draft_force_assign(cr, uid, [ref('stock.stock_picking_1')], {})
self.force_assign(cr, uid, [ref('stock.stock_picking_1')], {})
-
After having confirmed the picking and its two lines, I add a new move line in draft state with 7 FAN2
-
!record {model: stock.move, id: stock_move_2}:
!record {model: stock.move, id: stock_move_3}:
product_id: product.product_product_fan2
product_uom: product.product_uom_unit
product_uos_qty: 7.0
@ -20,10 +20,10 @@
picking_id: stock_picking_1
- |
I click on 'Process Now' to process the delivery order and I change quantities to:
5 CPU1, 0 CPU3, 3 FAN2 and a new product of 4 PC1
7 CPU1, 0 CPU3, 3 FAN2 and a new product of 4 PC1
-
!python {model: stock.picking}:
result = self.action_process(cr, uid, ref('stock.stock_picking_1'), {})['res_id']
!python {model: stock.picking}: |
result = self.action_process(cr, uid, [ref('stock.stock_picking_1')], {})['res_id']
pick = self.pool.get('stock.partial.picking').browse(cr, uid, result, {})
lobj = self.pool.get('stock.partial.picking.line')
for line in pick.move_ids:
@ -31,12 +31,16 @@
lobj.write(cr, uid, [line.id], {
'quantity': 0.0
}, {})
elif line.product_id.id == ref('product.product_product_cpu1'):
lobj.write(cr, uid, [line.id], {
'quantity': 7.0
}, {})
elif line.product_id.id == ref('product.product_product_fan2'):
lobj.write(cr, uid, [line.id], {
'quantity': 3.0
}, {})
lobj.create(cr, uid, {
'product_id':
'product_id': ref('product.product_product_pc1'),
'quantity': 2.0,
'product_uom': ref('product.product_uom_unit'),
'location_id': ref('stock.stock_location_stock'),
@ -45,6 +49,17 @@
}, {})
self.pool.get('stock.partial.picking').do_partial(cr, uid, [result], {})
-
I test that the back order contains
I test that the back order contains 5 CPU3, 4 FAN2 and nothing else
-
!python {model: stock.picking}: |
pick = self.browse(cr, uid, ref('stock.stock_picking_1'), {})
for line in pick.move_lines:
if line.product_id.id == ref('product.product_product_cpu3'):
assert line.product_qty == 5.0, "Wrong quantity for CPU3 back order"
elif line.product_id.id == ref('product.product_product_fan2'):
assert line.product_qty == 4.0, "Wrong quantity for FAN2 back order"
elif line.product_id.id == ref('product.product_product_pc1'):
assert line.product_qty == 0.0, "Wrong quantity for PC1 back order"
else:
assert line.product_qty == 0.0, "Wrong quantity for %s back order" % (line.product_id.code,)