Subversion Repositories SmartDukaan

Rev

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

Rev 6164 Rev 6232
Line 159... Line 159...
159
 
159
 
160
def __send_mail_for_missing_key(item_key, quantity, warehouse_id):
160
def __send_mail_for_missing_key(item_key, quantity, warehouse_id):
161
    missedInventoryUpdate = MissedInventoryUpdate.get_by(itemKey = item_key, warehouseId = warehouse_id)
161
    missedInventoryUpdate = MissedInventoryUpdate.get_by(itemKey = item_key, warehouseId = warehouse_id)
162
    # One email per product key mismatch
162
    # One email per product key mismatch
163
    if not missedInventoryUpdate:
163
    if not missedInventoryUpdate:
164
        EmailAttachmentSender.mail(mail_user, mail_password, ['chaitnaya.vats@shop2020.in', 'asghar.bilgrami@shop2020.in', 'amar.kumar@shop2020.in'], 'Skipped inventory update for ' + item_key + ' quantity ' + str(quantity) + ' warehouse id: ' + str(warehouse_id), None)
-
 
165
        missedInventoryUpdate = MissedInventoryUpdate()
164
        missedInventoryUpdate = MissedInventoryUpdate()
166
        missedInventoryUpdate.itemKey = item_key
165
        missedInventoryUpdate.itemKey = item_key
167
        missedInventoryUpdate.quantity = quantity
166
        missedInventoryUpdate.quantity = quantity
168
        missedInventoryUpdate.isIgnored = 1
167
        missedInventoryUpdate.isIgnored = 1
169
        missedInventoryUpdate.timestamp = datetime.datetime.now()
168
        missedInventoryUpdate.timestamp = datetime.datetime.now()
170
        missedInventoryUpdate.warehouseId = warehouse_id
169
        missedInventoryUpdate.warehouseId = warehouse_id
171
        session.commit()
170
        session.commit()
-
 
171
        try:
-
 
172
            EmailAttachmentSender.mail(mail_user, mail_password, ['chaitnaya.vats@shop2020.in', 'asghar.bilgrami@shop2020.in', 'amar.kumar@shop2020.in'], 'Skipped inventory update for ' + item_key + ' quantity ' + str(quantity) + ' warehouse id: ' + str(warehouse_id), None)
-
 
173
        except:
-
 
174
            print "Not able to send email. No issues, we can continue with updates."
172
    else:
175
    else:
173
        missedInventoryUpdate.quantity += quantity
176
        missedInventoryUpdate.quantity += quantity
174
        session.commit()
177
        session.commit()
175
 
178
 
176
def add_inventory(itemId, warehouseId, quantity):
179
def add_inventory(itemId, warehouseId, quantity):