Subversion Repositories SmartDukaan

Rev

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

Rev 5944 Rev 6385
Line 149... Line 149...
149
                purchases = Purchase.query.filter_by(purchaseOrder_id = purchaseOrderId).filter(Purchase.receivedOn != None).all()
149
                purchases = Purchase.query.filter_by(purchaseOrder_id = purchaseOrderId).filter(Purchase.receivedOn != None).all()
150
            
150
            
151
            return [purchase.to_thrift_object() for purchase in purchases]
151
            return [purchase.to_thrift_object() for purchase in purchases]
152
        finally:
152
        finally:
153
            self.close_session()
153
            self.close_session()
-
 
154
    
-
 
155
    def getPurchasesForPO(self, purchaseOrderId):
-
 
156
        """
-
 
157
        Returns all purchases for the given purchase order. Throws an exception if no such purchase order exists
-
 
158
        
-
 
159
        Parameters:
-
 
160
         - purchaseOrderId
-
 
161
         - open
-
 
162
        """
-
 
163
        try:
-
 
164
            purchases = Purchase.query.filter_by(purchaseOrder_id = purchaseOrderId).all()
-
 
165
            return [purchase.to_thrift_object() for purchase in purchases]
-
 
166
        finally:
-
 
167
            self.close_session()
-
 
168
 
154
 
169
 
155
    def getPurchaseOrderForPurchase(self, purchaseId):
170
    def getPurchaseOrderForPurchase(self, purchaseId):
156
        """
171
        """
157
        Returns the purchase order for a given purchase
172
        Returns the purchase order for a given purchase
158
 
173
 
Line 478... Line 493...
478
            supplierObj.tin = supplier.tin
493
            supplierObj.tin = supplier.tin
479
            session.commit()
494
            session.commit()
480
        finally:
495
        finally:
481
            self.close_session()
496
            self.close_session()
482
 
497
 
-
 
498
    def getInvoicesForPO(self, poNumber):
-
 
499
        '''
-
 
500
        For getting invoiceNumbers for a Purchase Order
-
 
501
        '''
-
 
502
        try:
-
 
503
            
-
 
504
            purchases = Purchase.query.filter_by(purchaseOrder = poNumber)
-
 
505
            for purchase in purchases:
-
 
506
                invoice = purchase.invoiceNumber
-
 
507
        except:
-
 
508
            return None
-
 
509
        finally:
-
 
510
            self.close_session()
-
 
511
 
483
    def isAlive(self, ):
512
    def isAlive(self, ):
484
        """
513
        """
485
        For checking weather service is active alive or not. It also checks connectivity with database
514
        For checking weather service is active alive or not. It also checks connectivity with database
486
        """
515
        """
487
        try:
516
        try: