Subversion Repositories SmartDukaan

Rev

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

Rev 4317 Rev 4318
Line 23... Line 23...
23
from string import Template
23
from string import Template
24
from shop2020.clients.HelperClient import HelperClient
24
from shop2020.clients.HelperClient import HelperClient
25
import urllib2
25
import urllib2
26
from urllib2 import HTTPBasicAuthHandler
26
from urllib2 import HTTPBasicAuthHandler
27
from shop2020.config.client.ConfigClient import ConfigClient
27
from shop2020.config.client.ConfigClient import ConfigClient
-
 
28
from shop2020.utils.EmailAttachmentSender import mail
28
 
29
 
29
def initialize():
30
def initialize():
30
    DataService.initialize()
31
    DataService.initialize()
31
 
32
 
32
def get_all_items_by_status(status, offset=0, limit=None):
33
def get_all_items_by_status(status, offset=0, limit=None):
Line 484... Line 485...
484
        return
485
        return
485
    availability = __get_item_availability(item)
486
    availability = __get_item_availability(item)
486
    if availability <= 0:
487
    if availability <= 0:
487
        if item.status == status.ACTIVE:
488
        if item.status == status.ACTIVE:
488
            change_item_status(item.id, status.PAUSED_BY_RISK)
489
            change_item_status(item.id, status.PAUSED_BY_RISK)
-
 
490
            try:
-
 
491
                mail("cnc.center@shop2020.in", "5h0p2o2o", "rajveer.singh@shop2020.in", "Item is out of stock. " + item.brand +  " " + item.model_name + " " + item.model_number, "", [])
-
 
492
            except:
-
 
493
                print "Unable to send the report"
489
    else:
494
    else:
490
        if item.status == status.PAUSED_BY_RISK:
495
        if item.status == status.PAUSED_BY_RISK:
491
            change_item_status(item.id, status.ACTIVE)
496
            change_item_status(item.id, status.ACTIVE)
492
    session.commit()
497
    session.commit()
493
 
498
 
Line 531... Line 536...
531
        
536
        
532
    query = CurrentInventorySnapshot.query.filter_by(warehouse_id = warehouse_id, item_id = item_id)
537
    query = CurrentInventorySnapshot.query.filter_by(warehouse_id = warehouse_id, item_id = item_id)
533
    try:
538
    try:
534
        current_inventory_snapshot = query.one()
539
        current_inventory_snapshot = query.one()
535
        current_inventory_snapshot.reserved = current_inventory_snapshot.reserved - quantity
540
        current_inventory_snapshot.reserved = current_inventory_snapshot.reserved - quantity
-
 
541
        ##FIXME In case of our own warehouse reduce availability also
-
 
542
        if warehouse_id == 7:
-
 
543
            current_inventory_snapshot.availability = current_inventory_snapshot.availability - quantity
536
        session.commit()
544
        session.commit()
537
        check_risky_item(item)
545
        check_risky_item(item)
538
        return True
546
        return True
539
    except:
547
    except:
540
        print "Unexpected error:", sys.exc_info()[0]
548
        print "Unexpected error:", sys.exc_info()[0]