[IMP]stock:add message when a lot quantity is more than available quantity
authorMayur Maheshwari (OpenERP) <mma@tinyerp.com>
Fri, 6 Jan 2012 10:21:31 +0000 (15:51 +0530)
committerMayur Maheshwari (OpenERP) <mma@tinyerp.com>
Fri, 6 Jan 2012 10:21:31 +0000 (15:51 +0530)
bzr revid: mma@tinyerp.com-20120106102131-bhr1lkxa0acvw958

addons/stock/wizard/stock_move.py

index e7cd5a4..7d1f837 100644 (file)
@@ -205,8 +205,13 @@ class split_in_production_lot(osv.osv_memory):
                     lines = [l for l in data.line_exist_ids if l]
                 else:
                     lines = [l for l in data.line_ids if l]
+                total_move_qty = 0.0
                 for line in lines:
                     quantity = line.quantity
+                    total_move_qty += quantity
+                    if total_move_qty > move_qty:
+                        raise osv.except_osv(_('Processing Error'), _('Processing quantity %d for %s is larger than the available quantity %d!')\
+                                     %(total_move_qty, move.product_id.name, move_qty))
                     if quantity <= 0 or move_qty == 0:
                         continue
                     quantity_rest -= quantity