Subversion Repositories SmartDukaan

Rev

Rev 9762 | Rev 9791 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9762 Rev 9770
Line 369... Line 369...
369
                            holdInventoryDetail = hID
369
                            holdInventoryDetail = hID
370
            if holdInventoryDetail is not None and holdInventoryDetail.held>0:
370
            if holdInventoryDetail is not None and holdInventoryDetail.held>0:
371
                previousHeld = holdInventoryDetail.held
371
                previousHeld = holdInventoryDetail.held
372
                holdInventoryDetail.held = max(0, holdInventoryDetail.held -quantity)
372
                holdInventoryDetail.held = max(0, holdInventoryDetail.held -quantity)
373
                diff = previousHeld-holdInventoryDetail.held 
373
                diff = previousHeld-holdInventoryDetail.held 
374
                current_inventory_snapshot = CurrentInventorySnapshot.get_by(item_id=item_id, warehouse_id=warehouse_id)
374
                current_inventory_snapshot = CurrentInventorySnapshot.get_by(item_id=item_id, warehouse_id=holdInventoryDetail.warehouse_id)
375
                if current_inventory_snapshot is not None:
375
                if current_inventory_snapshot is not None:
376
                    current_inventory_snapshot.held = max(0, current_inventory_snapshot.held - diff)
376
                    current_inventory_snapshot.held = max(0, current_inventory_snapshot.held - diff)
377
                session.commit()
377
                session.commit()
378
    except:
378
    except:
379
        print "Unable to release hold Inventory for item_id " + str(item_id) + " warehouse_id " + str(warehouse_id) + " source " + str(source_id)
379
        print "Unable to release hold Inventory for item_id " + str(item_id) + " warehouse_id " + str(warehouse_id) + " source " + str(source_id)
Line 423... Line 423...
423
                            holdInventoryDetail = hID
423
                            holdInventoryDetail = hID
424
            if holdInventoryDetail is not None and holdInventoryDetail.held>0:
424
            if holdInventoryDetail is not None and holdInventoryDetail.held>0:
425
                previousHeld = holdInventoryDetail.held
425
                previousHeld = holdInventoryDetail.held
426
                holdInventoryDetail.held = max(0, holdInventoryDetail.held -quantity)
426
                holdInventoryDetail.held = max(0, holdInventoryDetail.held -quantity)
427
                diff = previousHeld-holdInventoryDetail.held 
427
                diff = previousHeld-holdInventoryDetail.held 
428
                current_inventory_snapshot = CurrentInventorySnapshot.get_by(item_id=item_id, warehouse_id=warehouse_id)
428
                current_inventory_snapshot = CurrentInventorySnapshot.get_by(item_id=item_id, warehouse_id=holdInventoryDetail.warehouse_id)
429
                if current_inventory_snapshot is not None:
429
                if current_inventory_snapshot is not None:
430
                    current_inventory_snapshot.held = max(0, current_inventory_snapshot.held - diff)
430
                    current_inventory_snapshot.held = max(0, current_inventory_snapshot.held - diff)
431
                session.commit()
431
                session.commit()
432
    except:
432
    except:
433
        print "Unable to release hold Inventory for item_id " + str(item_id) + " warehouse_id " + str(warehouse_id) + " source " + str(source_id)
433
        print "Unable to release hold Inventory for item_id " + str(item_id) + " warehouse_id " + str(warehouse_id) + " source " + str(source_id)