[IMP]procurement: Removed active field conditon from product search query, Added sorting by order of read query, removed unnecessary len used

bzr revid: ron@tinyerp.com-20110916130150-zd0x5fvhpy6808ws
This commit is contained in:
ron@tinyerp.com 2011-09-16 18:31:50 +05:30
parent 70e83c0d9c
commit 191952b5b8
2 changed files with 4 additions and 5 deletions

View File

@ -372,10 +372,9 @@ class procurement_order(osv.osv):
if not (procurement.move_id.state in ('done','assigned','cancel')):
ok = ok and self.pool.get('stock.move').action_assign(cr, uid, [id])
order_point_id = self.pool.get('stock.warehouse.orderpoint').search(cr, uid, [('product_id', '=', procurement.product_id.id)])
res = len(order_point_id)
if not res and not ok:
if not order_point_id and not ok:
message = _("Not enough stock and no minimum orderpoint rule defined.")
elif not res:
elif not order_point_id:
message = _("No minimum orderpoint rule defined.")
elif not ok:
message = _("Not enough stock.")

View File

@ -155,7 +155,7 @@ class procurement_order(osv.osv):
wf_service = netsvc.LocalService("workflow")
warehouse_ids = warehouse_obj.search(cr, uid, [], context=context)
products_id = product_obj.search(cr, uid, [('active', '=', True), ('purchase_ok', '=', True)], order='id', context=context)
products_id = product_obj.search(cr, uid, [('purchase_ok', '=', True)], order='id', context=context)
for warehouse in warehouse_obj.browse(cr, uid, warehouse_ids, context=context):
context['warehouse'] = warehouse
@ -237,7 +237,7 @@ class procurement_order(osv.osv):
if op.procurement_draft_ids:
# Check draft procurement related to this order point
pro_ids = [x.id for x in op.procurement_draft_ids]
procure_datas = procurement_obj.read(cr, uid, pro_ids, ['id','product_qty'], context=context)
procure_datas = procurement_obj.read(cr, uid, pro_ids, ['id','product_qty'], context=context, order='product_qty desc')
to_generate = qty
for proc_data in procure_datas:
if to_generate >= proc_data['product_qty']: