[MERGE]merge packing.yml jpr's branch manually
bzr revid: sgo@tinyerp.com-20130830060900-zwsnsrbuvtsev5wi
This commit is contained in:
parent
9378897d41
commit
5f03ac0ad3
|
@ -89,10 +89,11 @@ Dashboard / Reports for Warehouse Management will include:
|
|||
'res_config_view.xml',
|
||||
],
|
||||
'test': [
|
||||
'test/inventory.yml',
|
||||
# 'test/inventory.yml',
|
||||
'test/move.yml',
|
||||
'test/procrule.yml',
|
||||
'test/shipment.yml',
|
||||
'test/shipment.yml',
|
||||
'test/packing.yml',
|
||||
],
|
||||
'installable': True,
|
||||
'application': True,
|
||||
|
|
|
@ -1,68 +1,171 @@
|
|||
-
|
||||
-
|
||||
Create a new stockable product
|
||||
-
|
||||
!record {model: product.product, id: packingtest}:
|
||||
name: nice product
|
||||
!record {model: product.product, id: product1}:
|
||||
name: Nice product
|
||||
type: product
|
||||
categ_id: product.product_category_1
|
||||
list_price: 100.0
|
||||
standard_price: 70.0
|
||||
seller_ids:
|
||||
- delay: 1
|
||||
name: base.res_partner_2
|
||||
min_qty: 2.0
|
||||
qty: 5.0
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
-
|
||||
Create an incoming picking for this product of 300 PCE from suppliers to stock
|
||||
-
|
||||
!record{model: stock.picking}: |
|
||||
!record {model: stock.picking, id: pick1}:
|
||||
name: Incoming picking
|
||||
partner_id: base.res_partner_2
|
||||
picking_type_id: picking_type_in
|
||||
move_lines:
|
||||
- product_id: product1
|
||||
product_uom_qty: 300.00
|
||||
location_id: stock_location_suppliers
|
||||
location_dest_id: stock_location_stock
|
||||
-
|
||||
Confirm and assign picking and prepare partial
|
||||
-
|
||||
!python {model: stock.picking, id:}: |
|
||||
self.action_confirm(cr, uid, ref())
|
||||
!python {model: stock.picking}: |
|
||||
self.action_confirm(cr, uid, [ref('pick1')], context=context)
|
||||
self.do_prepare_partial(cr, uid, [ref('pick1')], context=context)
|
||||
-
|
||||
Put 120 pieces on Pallet 1 (package), 120 pieces on Pallet 2 with lot A and 60 pieces on Pallet 3
|
||||
-
|
||||
!python {model: stock.picking, id:} |
|
||||
!python {model: stock.picking}: |
|
||||
#Change quantity of first to 120 and create 2 others quant operations
|
||||
record = self.browse(cr, uid, ref('pick1'), context=context)
|
||||
stock_pack = self.pool.get('stock.pack.operation')
|
||||
stock_quant_pack = self.pool.get('stock.quant.package')
|
||||
#create lot A
|
||||
lot_a = self.pool.get('stock.production.lot').create(cr, uid, {'name': 'Lot A', 'product_id': ref('product1')}, context=context)
|
||||
#create package
|
||||
package1 = stock_quant_pack.create(cr, uid, {'name': 'Pallet 1'}, context=context)
|
||||
package2 = stock_quant_pack.create(cr, uid, {'name': 'Pallet 2'}, context=context)
|
||||
package3 = stock_quant_pack.create(cr, uid, {'name': 'Pallet 3'}, context=context)
|
||||
#Create package for each line and assign it as result_package_id
|
||||
#create pack operation
|
||||
stock_pack.write(cr, uid, record.pack_operation_ids[0].id, {'package_id': package1, 'result_package_id': package1, 'product_qty': 120})
|
||||
new_pack1 = stock_pack.create(cr, uid, {'product_id': ref('product1'), 'product_uom_id': ref('product.product_uom_unit'), 'picking_id': ref('pick1'), 'lot_id': lot_a, 'package_id': package2, 'result_package_id': package2, 'product_qty': 120}, context=context)
|
||||
new_pack2 = stock_pack.create(cr, uid, {'product_id': ref('product1'), 'product_uom_id': ref('product.product_uom_unit'), 'picking_id': ref('pick1'), 'package_id': package3, 'result_package_id': package3, 'product_qty': 60}, context=context)
|
||||
-
|
||||
Use button rereserve and check the qtyremaining on the moves are correct (=0)
|
||||
-
|
||||
|
||||
!python {model: stock.picking}: |
|
||||
self.rereserve(cr, uid, [ref('pick1')], context=context)
|
||||
picking = self.browse(cr, uid, ref('pick1'), context=context)
|
||||
move_reco = self.pool.get('stock.move').browse(cr, uid, picking.move_lines[0].id, context=context)
|
||||
assert move_reco.remaining_qty == 0.0, ""
|
||||
-
|
||||
Transfer the reception
|
||||
-
|
||||
|
||||
!python {model: stock.picking}: |
|
||||
self.do_partial(cr, uid, [ref('pick1')], context=context)
|
||||
-
|
||||
Check the system created 3 quants one with 120 pieces on pallet 1, one with 120 pieces on pallet 2 with lot A and 60 pieces on pallet 3
|
||||
-
|
||||
|
||||
!python {model: stock.quant}: |
|
||||
reco_id = self.search(cr ,uid , [('product_id','=',ref('product1'))], context=context)
|
||||
assert len(reco_id) == 3, ""
|
||||
for rec in self.browse(cr, uid, reco_id, context=context):
|
||||
if rec.package_id.name == 'Pallet 1':
|
||||
assert rec.qty == 120, ""
|
||||
elif rec.package_id.name == 'Pallet 2':
|
||||
assert rec.qty == 120, ""
|
||||
elif rec.package_id.name == 'Pallet 3':
|
||||
assert rec.qty == 60, ""
|
||||
-
|
||||
Check there is no backorder or extra moves created
|
||||
-
|
||||
|
||||
!python {model: stock.picking}: |
|
||||
picking = self.browse(cr, uid, ref('pick1'), context=context)
|
||||
backorder = self.search(cr, uid, [('backorder_id', '=', ref('pick1'))])
|
||||
assert not backorder, ""
|
||||
#Check extra moves created
|
||||
assert len(picking.move_lines) == 1, ""
|
||||
-
|
||||
Make a delivery order of 300 pieces to the customer
|
||||
-
|
||||
|
||||
!record {model: stock.picking, id: delivery_order1}:
|
||||
name: outgoing picking
|
||||
partner_id: base.res_partner_4
|
||||
picking_type_id: stock.picking_type_out
|
||||
move_lines:
|
||||
- product_id: product1
|
||||
product_uom_qty: 300.00
|
||||
location_id: stock_location_stock
|
||||
location_dest_id: stock_location_customers
|
||||
-
|
||||
Assign and confirm
|
||||
-
|
||||
|
||||
!python {model: stock.picking}: |
|
||||
self.action_confirm(cr, uid, [ref('delivery_order1')], context=context)
|
||||
self.action_assign(cr, uid, [ref('delivery_order1')])
|
||||
self.force_assign(cr, uid, [ref('delivery_order1')], context=context)
|
||||
-
|
||||
Instead of doing the 300 pieces, you decide to take pallet 1 (do not mention product in operation here) and 20 pieces from lot A and 10 pieces from pallet 3
|
||||
-
|
||||
|
||||
!python {model: stock.picking}: |
|
||||
stock_pack = self.pool.get('stock.pack.operation')
|
||||
self.do_prepare_partial(cr, uid, [ref('delivery_order1')], context=context)
|
||||
delivery_id = self.browse(cr, uid, ref('delivery_order1'), context=context)
|
||||
for rec in delivery_id.pack_operation_ids:
|
||||
if rec.package_id.name == 'Pallet 1' or rec.product_qty == 120:
|
||||
stock_pack.write(cr, uid, rec.id, {'product_qty': 120}, context=context)
|
||||
if rec.package_id.name == 'Pallet 2' or rec.lot_id.name == 'Lot A' :
|
||||
stock_pack.write(cr, uid, rec.id, {'product_qty': 20}, context=context)
|
||||
if rec.package_id.name == 'Pallet 3' or rec.product_qty == 60:
|
||||
stock_pack.write(cr, uid, rec.id, {'product_qty': 10}, context=context)
|
||||
-
|
||||
Process this picking
|
||||
-
|
||||
|
||||
!python {model: stock.picking}: |
|
||||
self.rereserve(cr, uid, [ref('delivery_order1')], context=context)
|
||||
self.do_partial(cr, uid, [ref('delivery_order1')], context=context)
|
||||
-
|
||||
Check the quants that you have 120 pieces pallet 1 in customers, 100 pieces pallet 2 in stock and 20 with customers and 50 in stock, 10 in customers from pallet 3
|
||||
-
|
||||
|
||||
!python {model: stock.quant}: |
|
||||
reco_id = self.search(cr ,uid , [('product_id','=',ref('product1'))], context=context)
|
||||
for rec in self.browse(cr, uid, reco_id, context=context):
|
||||
if rec.package_id.name == 'Pallet 1' and rec.location_id.id == ref('stock_location_customers'):
|
||||
assert rec.qty == 120, ""
|
||||
if rec.package_id.name == 'Pallet 2' and rec.location_id.id == ref('stock_location_customers'):
|
||||
assert rec.qty == 20, ""
|
||||
if rec.package_id.name == 'Pallet 3' and rec.location_id.id == ref('stock_location_customers'):
|
||||
assert rec.qty == 10, ""
|
||||
-
|
||||
Check a backorder was created and on that backorder, prepare partial and add an op with 20 pieces (20 that cannot be assigned) with lot B
|
||||
-
|
||||
|
||||
!python {model: stock.picking}: |
|
||||
picking = self.browse(cr, uid, ref('delivery_order1'), context=context)
|
||||
backorder = self.search(cr, uid, [('backorder_id.id', '=', picking.id)], context=context)
|
||||
assert backorder, ""
|
||||
backorder_id = self.browse(cr, uid, backorder, context=context)
|
||||
self.action_confirm(cr, uid, backorder, context=context)
|
||||
self.action_assign(cr, uid, backorder)
|
||||
self.force_assign(cr, uid, backorder, context=context)
|
||||
self.do_prepare_partial(cr, uid, backorder, context=context)
|
||||
#create lot B
|
||||
lot_b = self.pool.get('stock.production.lot').create(cr, uid, {'name': 'Lot B', 'product_id': ref('product1')}, context=context)
|
||||
stock_pack = self.pool.get('stock.pack.operation').create(cr, uid, {'picking_id': backorder_id[0].id, 'lot_id': lot_b, 'product_qty': 20})
|
||||
-
|
||||
Process this backorder
|
||||
-
|
||||
|
||||
!python {model: stock.picking}: |
|
||||
picking = self.browse(cr, uid, ref('delivery_order1'), context=context)
|
||||
backorder = self.search(cr, uid, [('backorder_id.id', '=', picking.id)], context=context)
|
||||
backorder_id = self.browse(cr, uid, backorder, context=context)
|
||||
self.rereserve(cr, uid, [backorder_id[0].id], context=context)
|
||||
self.do_partial(cr, uid, [backorder_id[0].id], context=context)
|
||||
-
|
||||
Check you have a negative quant because there were 20 too many that were transferred with lot B
|
||||
-
|
||||
|
||||
!python {model: stock.quant}: |
|
||||
reco_id = self.search(cr ,uid , [('product_id','=',ref('product1'))], context=context)
|
||||
for rec in self.browse(cr, uid, reco_id, context=context):
|
||||
if rec.lot_id.name == 'Lot B':
|
||||
assert rec.qty != -20, ""
|
||||
|
|
Loading…
Reference in New Issue