Beispiel #1
0
    def actions(self):
        actions = []
        #闭合的采购单不能再被修改
        if "close" in self.request.GET:
            order_id = self.request.GET['close']
            if is_closed(order_id):
                return actions

        if "_rel_document__id__exact" in self.request.GET:
            document_id = self.request.GET['_rel_document__id__exact']
            item = getItem(document_id)
            if item is not None:
                document = Document.objects.get(id=document_id)
                if (item.status == ITEM_REJECTED) and isGroup(
                        self, PROJECT_GROUP):
                    actions.append(BatchChangeAction)

                if (item.status == ITEM_APPROVED) and isGroup(
                        self, PURCHASE_GROUP) and (
                            document and not isPurchCompleted(document)):
                    actions.append(PurchaseOrderSelectedAction)
            else:
                if isGroup(self, PROJECT_GROUP):
                    actions.append(BatchChangeAction)
        return actions
Beispiel #2
0
 def get_list_display_links(self):
     list_display_links = super(ReceivingLineAdmin, self).get_list_display_links()
     if "_q_" in self.request.GET:
         order_id = self.request.GET['_q_']
         if is_closed(order_id):
             list_display_links = ('none')
     
     if is_closed_by_order_line_id(self):
             list_display_links = ('none')
     return list_display_links
Beispiel #3
0
 def actions(self):
     #闭合的采购单不能再被修改
     actions = [DeleteSelectedAction, BatchChangeAction]
     if "_q_" in self.request.GET:
         order_id = self.request.GET['_q_']
         if is_closed(order_id):
             actions = None
     if is_closed_by_order_line_id(self):
         actions = None
     
     return  actions
Beispiel #4
0
    def actions(self):
        #闭合的采购单不能再被修改
        actions = [DeleteSelectedAction, BatchChangeAction]
        if "_q_" in self.request.GET:
            order_id = self.request.GET['_q_']
            if is_closed(order_id):
                actions = None
        if is_closed_by_order_line_id(self):
            actions = None

        return actions
Beispiel #5
0
    def get_list_display_links(self):
        list_display_links = super(ReceivingLineAdmin,
                                   self).get_list_display_links()
        if "_q_" in self.request.GET:
            order_id = self.request.GET['_q_']
            if is_closed(order_id):
                list_display_links = ('none')

        if is_closed_by_order_line_id(self):
            list_display_links = ('none')
        return list_display_links
Beispiel #6
0
 def actions(self):
     actions=[]
     #闭合的采购单不能再被修改
     if "close" in self.request.GET:
         order_id = self.request.GET['close']
         if is_closed(order_id):
             return actions
     
     if "_rel_document__id__exact" in self.request.GET:
         document_id = self.request.GET['_rel_document__id__exact']
         item = getItem(document_id)
         if item is not None:
             document = Document.objects.get(id = document_id)
             if (item.status == ITEM_REJECTED) and isGroup(self, PROJECT_GROUP):
                 actions.append(BatchChangeAction)
                 
             if (item.status == ITEM_APPROVED) and isGroup(self, PURCHASE_GROUP) and (document and not isPurchCompleted(document)):
                 actions.append(PurchaseOrderSelectedAction)      
         else:
             if isGroup(self, PROJECT_GROUP):
                 actions.append(BatchChangeAction)
     return actions