示例#1
0
    def get_list_display(self):
        list_display = super(DocumentLineItemAdmin, self).get_list_display()

        #工程人员不能看到预算量
        isProjectGroup = isGroup(self, PROJECT_GROUP)
        if isProjectGroup:
            if 'getQuantity' in list_display:
                list_display.remove('getQuantity')

        isApproved = False
        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:
                if (item.status == ITEM_APPROVED):
                    isApproved = True

            #已修改审批结束或是采购部门才可以修改实际采购材料
            if not (isApproved or isGroup(self, PURCHASE_GROUP)):
                if 'material' in list_display:
                    list_display.remove('material')

            #审批结束没有结束 不用显示 已采购量, 已到货数量
            if not isApproved:
                if 'getTotalPurchasedQuantity' in list_display:
                    list_display.remove('getTotalPurchasedQuantity')
                if 'posted_quantity' in list_display:
                    list_display.remove('posted_quantity')
                if isProjectGroup:
                    if 'audit_quantity' in list_display:
                        list_display.remove('audit_quantity')
                    if 'approval_comments' in list_display:
                        list_display.remove('approval_comments')

        return list_display
示例#2
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
示例#3
0
    def list_editable(self):
        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 hasApprovedBySelf(self, item):
                    return []

                #采购部门可以修改实际采购名称
                if (item.status == ITEM_APPROVED):
                    if isGroup(self, PURCHASE_GROUP) and (
                            document and not isPurchCompleted(document)):
                        return ['material']
                    else:
                        return []
                if (item.status == ITEM_REJECTED) and isGroup(
                        self, PROJECT_GROUP):
                    return [
                        'expected_date', 'expected_quantity', 'brand',
                        'comments'
                    ]

                if canEditAuditQty(self):
                    return [
                        'expected_date', 'audit_quantity', 'approval_comments'
                    ]
            else:
                if isGroup(self, PROJECT_GROUP):
                    return [
                        'expected_date', 'expected_quantity', 'brand',
                        'comments'
                    ]
示例#4
0
文件: adminx.py 项目: mgrai/mmcp
 def list_editable(self):
     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 hasApprovedBySelf(self, item):
                 return []
             
             #采购部门可以修改实际采购名称
             if (item.status == ITEM_APPROVED):
                 if isGroup(self, PURCHASE_GROUP) and (document and not isPurchCompleted(document)):
                     return ['material']
                 else:
                     return []
             if (item.status == ITEM_REJECTED) and isGroup(self, PROJECT_GROUP):
                 return ['expected_date', 'expected_quantity', 'brand','comments']
                 
             if canEditAuditQty(self):
                 return ['expected_date', 'audit_quantity', 'approval_comments']
         else:
             if isGroup(self, PROJECT_GROUP):
                 return ['expected_date', 'expected_quantity', 'brand', 'comments']       
示例#5
0
文件: adminx.py 项目: mgrai/mmcp
 def get_list_display_links(self):
     list_display_links = super(DocumentLineItemAdmin, self).get_list_display_links()
     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:
             if (item.status != ITEM_REJECTED):
                 list_display_links = ('none')
     else:
         list_display_links = ('none')
     return list_display_links
示例#6
0
 def get_list_display_links(self):
     list_display_links = super(DocumentLineItemAdmin,
                                self).get_list_display_links()
     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:
             if (item.status != ITEM_REJECTED):
                 list_display_links = ('none')
     else:
         list_display_links = ('none')
     return list_display_links
示例#7
0
文件: adminx.py 项目: mgrai/mmcp
 def get_actions(self):
     actions = super(DocumentLineItemAdmin, self).get_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:
             if (item.status == ITEM_REJECTED) and isGroup(self, PROJECT_GROUP):
                 actions.append(BatchChangeAction)
                   
         else:
             if isGroup(self, PROJECT_GROUP):
                 actions.append(BatchChangeAction)
     return actions   
示例#8
0
文件: adminx.py 项目: mgrai/mmcp
 def batch_fields(self):
     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:
             if (item.status == ITEM_APPROVED):
                 return []
             if (item.status == ITEM_REJECTED) and isGroup(self, PROJECT_GROUP):
                 return ['expected_date', ]
                 
         else:
             if isGroup(self, PROJECT_GROUP):
                 return ['expected_date', ] 
示例#9
0
    def get_actions(self):
        actions = super(DocumentLineItemAdmin, self).get_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:
                if (item.status == ITEM_REJECTED) and isGroup(
                        self, PROJECT_GROUP):
                    actions.append(BatchChangeAction)

            else:
                if isGroup(self, PROJECT_GROUP):
                    actions.append(BatchChangeAction)
        return actions
示例#10
0
    def batch_fields(self):
        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:
                if (item.status == ITEM_APPROVED):
                    return []
                if (item.status == ITEM_REJECTED) and isGroup(
                        self, PROJECT_GROUP):
                    return [
                        'expected_date',
                    ]

            else:
                if isGroup(self, PROJECT_GROUP):
                    return [
                        'expected_date',
                    ]
示例#11
0
文件: adminx.py 项目: mgrai/mmcp
 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
示例#12
0
文件: adminx.py 项目: mgrai/mmcp
 def get_list_display(self):
     list_display = super(DocumentLineItemAdmin, self).get_list_display()
     
         
     #工程人员不能看到预算量
     isProjectGroup = isGroup(self, PROJECT_GROUP)
     if isProjectGroup:
         if 'getQuantity' in list_display:
             list_display.remove('getQuantity')
     
     isApproved = False
     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:
             if (item.status == ITEM_APPROVED):
                 isApproved = True
         
         #已修改审批结束或是采购部门才可以修改实际采购材料
         if not (isApproved or isGroup(self, PURCHASE_GROUP)):
             if 'material' in list_display:
                 list_display.remove('material')
         
         #审批结束没有结束 不用显示 已采购量, 已到货数量
         if not isApproved:
             if 'getTotalPurchasedQuantity' in list_display:
                 list_display.remove('getTotalPurchasedQuantity')
             if 'posted_quantity' in list_display:
                 list_display.remove('posted_quantity')
             if isProjectGroup:
                 if 'audit_quantity' in list_display:
                     list_display.remove('audit_quantity')
                 if 'approval_comments' in list_display:
                     list_display.remove('approval_comments')
                     
     return list_display