Ejemplo n.º 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
Ejemplo n.º 2
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'
                    ]
Ejemplo n.º 3
0
Archivo: adminx.py Proyecto: 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']       
Ejemplo n.º 4
0
Archivo: adminx.py Proyecto: 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