[RMV,IMP]procurement:

Remove the all_schedular.yml because code include in procurement.yml
Improve the test cases.

bzr revid: dbr@tinyerp.com-20111216061645-guas8ryvkqvpy58u
This commit is contained in:
DBR (OpenERP) 2011-12-16 11:46:45 +05:30
parent 26ee9109d5
commit dab1295e7b
4 changed files with 11 additions and 84 deletions

View File

@ -59,9 +59,7 @@ depending on the product's configuration.
'board_mrp_procurement_view.xml',
],
'demo_xml': ['stock_orderpoint.xml'],
'test': ['test/procurement.yml',
#'test/all_schedular.yml'
],
'test': ['test/procurement.yml'],
'installable': True,
'active': False,
'certificate': '00954248826881074509',

View File

@ -457,21 +457,6 @@ class procurement_order(osv.osv):
return res
procurement_order()
# Dead Code
# =========
#class StockPicking(osv.osv):
# _inherit = 'stock.picking'
# def test_finished(self, cursor, user, ids):
# wf_service = netsvc.LocalService("workflow")
# res = super(StockPicking, self).test_finished(cursor, user, ids)
# for picking in self.browse(cursor, user, ids):
# for move in picking.move_lines:
# if move.state == 'done':
# for procurement in move.procurements:
# wf_service.trg_validate(user, 'procurement.order',
# procurement.id, 'button_check', cursor)
# return res
#StockPicking()
class stock_warehouse_orderpoint(osv.osv):
"""

View File

@ -1,53 +0,0 @@
-
For test the procurement module, First I have to update quantity.
-
!python {model: product.product}: |
product = self.browse(cr, uid, ref('product.product_product_pc2'))
assert product.virtual_available >= 0.0,'Virtual stock have more quantities than zero.'
-
I create minimum stock rule for product PC2.
-
!record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op0}:
company_id: base.main_company
location_id: stock.stock_location_stock
logic: max
name: OP/000008
product_id: product.product_product_pc2
product_max_qty: 15.0
product_min_qty: 1.0
product_uom: product.product_uom_kgm
qty_multiple: 1
warehouse_id: stock.warehouse0
-
I run the scheduler.
-
!python {model: product.product}: |
mk_procure = self.pool.get('make.procurement')
procur_order = self.pool.get('procurement.order')
product = self.browse(cr, uid, ref('product.product_product_pc2'))
context.update({'active_model': 'product.product','active_id':ref('product.product_product_pc2')})
values = mk_procure.default_get(cr, uid, ['qty','product_id','uom_id','warehouse_id','date_planned'], context)
values.update({'warehouse_id': ref('base.main_company'),'uom_id': ref('product.product_uom_unit'),'qty': 1})
ids = mk_procure.create(cr, uid, values, context)
procurement = mk_procure.make_procurement(cr, uid, [ids], context)
assert product.virtual_available >= 1.0,'Virtual stock should be updated'
proc_id = procurement.get('res_id')
procurements = procur_order.browse(cr, uid, [proc_id])[0]
assert procurements.product_id.id == ref('product.product_product_pc2'),"Product is not correspond."
assert procurements.product_qty >= 1,"Product Quantity is not correspond."
assert procurements.state == 'confirmed',"Procurement state should be 'Confirmed'."
assert procurements.product_uom.id == ref('product.product_uom_unit'),"Product's UOM is not correspond."
context.update({'proc': proc_id})
-
I Compute Minimum Stock.
-
!python {model: procurement.orderpoint.compute}: |
proc_id = context.get('proc')
context.update({'active_model':'procurement.order','active_id':proc_id})
values = self.default_get(cr, uid, ['automatic'], context)
values.update({'automatic':True})
ids = self.create(cr, uid, values, context)
self.procure_calculation(cr, uid, [ids], context)

View File

@ -1,11 +1,7 @@
-
For test the procurement module, First I have to check current product quantity.
For test the procurement process, First I have to apply a minimum stock rule on product
-
!python {model: product.product}: |
product = self.browse(cr, uid, ref('product.product_product_cpu2'))
assert product.virtual_available <= 0.0,'Virtual stock have more quantities. so, not possible to check minimum stock rule process'
-
I create minimum stock rule for product CPU2.
I create minimum stock rule for product.
-
!record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op0}:
company_id: base.main_company
@ -19,21 +15,23 @@
qty_multiple: 1
warehouse_id: stock.warehouse0
-
I update product quantity and check the stock moves are properly done or not.
Check product quantity and update it, if needed for apply a minimum stock rule.
-
!python {model: product.product}: |
change_qty = self.pool.get('stock.change.product.qty')
product = self.browse(cr, uid, ref('product.product_product_cpu2'))
ids = change_qty.create(cr, uid, {'location_id' : ref('stock.stock_location_stock'), 'new_quantity': 4, 'product_id': product.id})
change_qty.change_product_qty(cr, uid, [ids], {'active_model':'product.product', 'active_id': product.id, 'active_ids':[product.id]})
if product.virtual_available < 5.0:
change_qty = self.pool.get('stock.change.product.qty')
ids = change_qty.create(cr, uid, {'location_id' : ref('stock.stock_location_stock'), 'new_quantity': 4, 'product_id': product.id})
change_qty.change_product_qty(cr, uid, [ids], {'active_model':'product.product', 'active_id': product.id, 'active_ids':[product.id]})
assert product.qty_available == 4,"Product quantity is not updated."
assert product.virtual_available < 5.0,'Virtual stock have more quantities.'
-
I run the scheduler.
-
!python {model: procurement.order}: |
self.run_scheduler(cr, uid)
-
I check that procurement order created.
I check that procurement order is based on minimum stock rule.
-
!python {model: procurement.order}: |
proc_ids = self.search(cr, uid, [('product_id','=', ref('product.product_product_cpu2'))])
@ -83,7 +81,7 @@
proc = self.browse(cr, uid, [proc_id])[0]
assert proc.state == 'ready' or 'exception',"Procurement should be in Ready or Exception state"
-
I compute minimum stock .
I compute minimum stock.
-
!python {model: procurement.orderpoint.compute}: |
proc_id = context.get('proc')
@ -91,4 +89,3 @@
values = self.default_get(cr, uid, ['automatic'], context)
ids = self.create(cr, uid, values, context)
self.procure_calculation(cr, uid, [ids], context)