[ADD,IMP,MOVE,REMOVE]stock:

added:
  stock/test/cancel_stock.yml
  stock/test/delete_stock.yml
moved:
  stock/test/process/scrap_move.yml => stock/test/stock_scrap_move.yml
  stock/test/process/stock_chain_location.yml => stock/test/stock_chain_location.yml
  stock/test/process/stock_demo_backorder.yml => stock/test/stock_demo_backorder.yml
  stock/test/process/stock_new_pack.yml => stock/test/stock_new_pack.yml
  stock/test/process/update_stock.yml => stock/test/stock_update.yml
  stock/test/ui/physical_inventory.yml => stock/test/stock_physical_inventory.yml
  stock/test/ui/stock_report.yml => stock/test/stock_report.yml
removed:
  stock/test/process/
  stock/test/ui/
improve:
  stock/__openerp__.py

bzr revid: dbr@tinyerp.com-20111130084732-lt26y2ypgnb3k476
This commit is contained in:
DBR (OpenERP) 2011-11-30 14:17:32 +05:30
parent 8d24067e75
commit 311f456205
10 changed files with 82 additions and 7 deletions

View File

@ -82,13 +82,15 @@ Thanks to the double entry management, the inventory controlling is powerful and
"board_warehouse_view.xml",
],
'test': [
'test/ui/physical_inventory.yml',
'test/process/update_stock.yml',
'test/process/stock_chain_location.yml',
'test/process/stock_demo_backorder.yml',
'test/process/scrap_move.yml',
'test/process/stock_new_pack.yml',
'test/ui/stock_report.yml',
'test/stock_physical_inventory.yml',
'test/stock_update.yml',
'test/stock_chain_location.yml',
'test/stock_demo_backorder.yml',
'test/stock_scrap_move.yml',
'test/stock_new_pack.yml',
'test/stock_report.yml',
'test/delete_stock.yml',
'test/cancel_stock.yml',
],
'installable': True,
'active': False,

View File

@ -0,0 +1,47 @@
-
In order to test the cancel stock. I start from cancelling the incoming shipment.
-
First, I create copies of incoming shipment.
-
!python {model: stock.picking}: |
stock = self.pool.get('stock.move')
context.update({'active_id':ref('stock.stock_picking_1')})
id1 = self.copy(cr, uid, ref('stock.stock_picking_1'), context)
id2 = self.copy(cr, uid, ref('stock.stock_picking_1'), context)
id3 = self.copy(cr, uid, ref('stock.stock_picking_1'), context)
context.update({'id1':id1,'id2':id2,'id3':id3})
-
Now, I cancel all related moves of picking so automatically picking goes to cancelled state..
-
!python {model: stock.picking}: |
import netsvc
wf_service = netsvc.LocalService("workflow")
stock = self.pool.get('stock.move')
pick = self.browse(cr, uid, context.get('id1'))
move_ids = stock.search(cr, uid, [('picking_id','=',pick.name)])
for move in move_ids:
wf_service.trg_validate(uid, 'stock.move', move, 'action_confirm', cr)
stock.force_assign(cr, uid, move)
wf_service.trg_validate(uid, 'stock.move', move, 'action_cancel', cr)
-
Now, directlly cancel the picking.
-
!python {model: stock.picking}: |
import netsvc
wf_service = netsvc.LocalService("workflow")
pick_id = context.get('id2')
wf_service.trg_validate(uid, 'stock.picking', pick_id, 'button_cancel', cr)
-
I return the picking.
-
!python {model: stock.picking}: |
copy_id = context.get('id3')
self.draft_force_assign(cr, uid, [copy_id])
self.force_assign(cr, uid, [copy_id])
stock_partial_picking = self.pool.get('stock.partial.picking')
context.update({'active_model': 'stock.picking','active_ids': [copy_id],'active_id': copy_id})
partial_id = stock_partial_picking.create(cr, uid, {}, context=context)
stock_partial_picking.do_partial(cr, uid, [partial_id], context)
return_pick_id = self.pool.get('stock.return.picking').create(cr, uid,{}, context)
self.pool.get('stock.return.picking').create_returns(cr, uid, [return_pick_id], context)

View File

@ -0,0 +1,26 @@
-
In order to test the delete stock, create a copy of picking.
-
First, I create copy of picking.
-
!python {model: stock.picking}: |
context.update({'active_id':ref('stock.stock_picking_1')})
pick = self.browse(cr, uid, ref('stock.stock_picking_1'))
stock = self.pool.get('stock.move')
move_ids = stock.search(cr, uid, [('picking_id','=',pick.name)])
id1 = self.copy(cr, uid, ref('stock.stock_picking_1'), context)
move_id = stock.copy(cr, uid, move_ids[0],context)
context.update({'id1':id1,'move':move_id})
-
Now, I delete a related moves of picking.
-
!python {model: stock.move}: |
move = context.get('move')
self.unlink(cr, uid, [move])
-
Now, directlly delete the picking.
-
!python {model: stock.picking}: |
id = context.get('id1')
self.unlink(cr, uid, [id])