Subversion Repositories SmartDukaan

Rev

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

Rev 18904 Rev 18909
Line 2369... Line 2369...
2369
                    process_credit_transaction(order.transaction.id, order.customer_id, 1, creditTxns, order.invoice_number)
2369
                    process_credit_transaction(order.transaction.id, order.customer_id, 1, creditTxns, order.invoice_number)
2370
                except:
2370
                except:
2371
                    traceback.print_exc()
2371
                    traceback.print_exc()
2372
                    session.rollback()
2372
                    session.rollback()
2373
                    return
2373
                    return
2374
            session.commit()
-
 
2375
        else :
2374
        else :
2376
            session.rollback()              
2375
            session.rollback()
-
 
2376
    session.commit()              
2377
    
2377
    
2378
 
2378
 
2379
def update_insurance_details(order):
2379
def update_insurance_details(order):
2380
    order.insuranceDetails[0].startDate = order.delivery_timestamp
2380
    order.insuranceDetails[0].startDate = order.delivery_timestamp
2381
    order.insuranceDetails[0].expiryDate = order.delivery_timestamp + timedelta(days = 365)
2381
    order.insuranceDetails[0].expiryDate = order.delivery_timestamp + timedelta(days = 365)
Line 9219... Line 9219...
9219
                    due_days = creditorDueDateMap.get(creditorId)
9219
                    due_days = creditorDueDateMap.get(creditorId)
9220
                    loanHistoryRec.due_date = datetime.datetime.now()+timedelta(days=due_days)
9220
                    loanHistoryRec.due_date = datetime.datetime.now()+timedelta(days=due_days)
9221
        else:
9221
        else:
9222
            logging.info("Error: Entry already existed for "+str(paymentId) + " Shipping Id:- "+str(creditTxns[0].shipping_id) +" Credit Txn Type:- "+CreditTxnType._VALUES_TO_NAMES[creditTxn.credit_type]+ " in Credit History ")
9222
            logging.info("Error: Entry already existed for "+str(paymentId) + " Shipping Id:- "+str(creditTxns[0].shipping_id) +" Credit Txn Type:- "+CreditTxnType._VALUES_TO_NAMES[creditTxn.credit_type]+ " in Credit History ")
9223
            raise TransactionServiceException(227, "Error: Entry already existed for "+str(paymentId) + " Shipping Id:- "+str(creditTxns[0].shipping_id) +" Credit Txn Type:- "+CreditTxnType._VALUES_TO_NAMES[creditTxn.credit_type]+ " in Credit History ")
9223
            raise TransactionServiceException(227, "Error: Entry already existed for "+str(paymentId) + " Shipping Id:- "+str(creditTxns[0].shipping_id) +" Credit Txn Type:- "+CreditTxnType._VALUES_TO_NAMES[creditTxn.credit_type]+ " in Credit History ")
9224
    session.commit()   
-
 
9225
    return True
9224
    return True
9226
            
9225
            
9227
def get_loan_payable_for_user_to_creditor(userId, creditorId, dueDate):
9226
def get_loan_payable_for_user_to_creditor(userId, creditorId, dueDate):
9228
    loanhistoryRecords = LoanHistory.query.filter(and_(LoanHistory.user_id==userId, LoanHistory.creditor_id==creditorId, LoanHistory.due_date<to_py_date(dueDate), LoanHistory.updated is None)).all()
9227
    loanhistoryRecords = LoanHistory.query.filter(and_(LoanHistory.user_id==userId, LoanHistory.creditor_id==creditorId, LoanHistory.due_date<to_py_date(dueDate), LoanHistory.updated is None)).all()
9229
    loanAmount = 0
9228
    loanAmount = 0