def doAction(self, instance): if not instance.is_applied or paymentAuditStatus(instance, ITEM_REJECTED): return "<button type='submit' class='default btn btn-primary col-xs-9' name='_submit' value='%s'/>提交申请 </button>" % instance.payment_id elif paymentAuditStatus(instance, ITEM_APPROVED): return "<a href='/payment/exportExcel/?id=%s'><i class='fa fa-cloud-download'></i></a>" % instance.id else: return ''
def readonly_fields(self): result = ('owed_amount', 'owed_amount_after_payment', 'applied_amount') #在审批完成 if hasattr(self, 'org_obj') and paymentAuditStatus( self.org_obj, ITEM_APPROVED): result = ('company', 'vendor', 'content', 'owed_amount', 'payment_amount', 'owed_amount_after_payment', 'paymentProperty', 'purchase_amount', 'applied_amount', 'purchase_user', 'paymentType', 'payment_user', 'comments') #在审批中 并且是采购部门 elif hasattr( self, 'org_obj' ) and self.org_obj and self.org_obj.is_applied and not paymentAuditStatus( self.org_obj, ITEM_REJECTED) and isGroup(self, PURCHASE_GROUP): result = ('company', 'vendor', 'content', 'owed_amount', 'payment_amount', 'owed_amount_after_payment', 'paymentProperty', 'purchase_amount', 'applied_amount', 'purchase_user', 'paymentType', 'payment_user', 'comments') #在审批中 并且不是采购部门 elif hasattr( self, 'org_obj' ) and self.org_obj and self.org_obj.is_applied and not paymentAuditStatus( self.org_obj, ITEM_REJECTED) and not isGroup( self, PURCHASE_GROUP): result = ('company', 'vendor', 'content', 'owed_amount', 'payment_amount', 'owed_amount_after_payment', 'paymentProperty', 'purchase_amount', 'purchase_user', 'paymentType', 'payment_user', 'comments') return result
def doAction(self, instance): if not instance.is_applied or paymentAuditStatus( instance, ITEM_REJECTED): return "<button type='submit' class='default btn btn-primary col-xs-9' name='_submit' value='%s'/>提交申请 </button>" % instance.payment_id elif paymentAuditStatus(instance, ITEM_APPROVED): return "<a href='/payment/exportExcel/?id=%s'><i class='fa fa-cloud-download'></i></a>" % instance.id else: return ''
def get_context(self): context = super(PaymentAdmin,self).get_context() #已提交申请的付款单不能被修改和删除 if (hasattr(self, 'obj') and self.obj.is_applied): context.update({ 'show_delete_link': False, 'has_delete_permission': False, 'has_change_permission': False, 'has_view_permission': True, }) else: #已被拒绝的申请可以修改 if (hasattr(self, 'org_obj') and paymentAuditStatus(self.org_obj, ITEM_REJECTED)): context['has_change_permission'] = True context['has_delete_permission'] = False context['show_delete_link'] = False path = self.request.get_full_path() if 'action=reapply' in path: context.update({ "show_save": True, "show_save_as_new": False, "show_save_and_add_another": False, "show_save_and_continue": False, 'show_delete_link': False, }) return context
def get_context(self): context = super(PaymentAdmin, self).get_context() #已提交申请的付款单不能被修改和删除 if (hasattr(self, 'obj') and self.obj.is_applied): context.update({ 'show_delete_link': False, 'has_delete_permission': False, 'has_change_permission': False, 'has_view_permission': True, }) else: #已被拒绝的申请可以修改 if (hasattr(self, 'org_obj') and paymentAuditStatus(self.org_obj, ITEM_REJECTED)): context['has_change_permission'] = True context['has_delete_permission'] = False context['show_delete_link'] = False path = self.request.get_full_path() if 'action=reapply' in path: context.update({ "show_save": True, "show_save_as_new": False, "show_save_and_add_another": False, "show_save_and_continue": False, 'show_delete_link': False, }) return context
def readonly_fields(self): result = ('owed_amount', 'owed_amount_after_payment', 'applied_amount') #在审批完成 if hasattr(self, 'org_obj') and paymentAuditStatus(self.org_obj, ITEM_APPROVED): result = ('company', 'vendor', 'content', 'owed_amount', 'payment_amount', 'owed_amount_after_payment', 'paymentProperty', 'purchase_amount', 'applied_amount', 'purchase_user', 'paymentType', 'payment_user', 'comments') #在审批中 并且是采购部门 elif hasattr(self, 'org_obj') and self.org_obj and self.org_obj.is_applied and not paymentAuditStatus(self.org_obj, ITEM_REJECTED) and isGroup(self, PURCHASE_GROUP): result = ('company', 'vendor', 'content', 'owed_amount', 'payment_amount', 'owed_amount_after_payment', 'paymentProperty', 'purchase_amount', 'applied_amount', 'purchase_user', 'paymentType', 'payment_user', 'comments') #在审批中 并且不是采购部门 elif hasattr(self, 'org_obj') and self.org_obj and self.org_obj.is_applied and not paymentAuditStatus(self.org_obj, ITEM_REJECTED) and not isGroup(self, PURCHASE_GROUP): result = ('company', 'vendor', 'content', 'owed_amount', 'payment_amount', 'owed_amount_after_payment', 'paymentProperty', 'purchase_amount', 'purchase_user', 'paymentType', 'payment_user', 'comments') return result
def getAppliedAmount(self, instance): result = '' if paymentAuditStatus(instance, ITEM_APPROVING) or paymentAuditStatus(instance, ITEM_APPROVED): result = instance.applied_amount if instance.applied_amount else instance.payment_amount return result
def getAppliedAmount(self, instance): result = '' if paymentAuditStatus(instance, ITEM_APPROVING) or paymentAuditStatus( instance, ITEM_APPROVED): result = instance.applied_amount if instance.applied_amount else instance.payment_amount return result