Example #1
0
 def get(self, pid=0):
     if pid:
         return self.succ(Purchase.get(pid))
     g_dict = {}
     for g in set(PURCHASE.FLOW).difference([PURCHASE.FLOW_ONE]):
         g_dict[g] = [user.uid for user in Group.get_users(g)]
     unfinished = Purchase.unfinished(g_dict)
     return self.succ(unfinished)
Example #2
0
 def get(self):
     submit = request.args
     resp = excel.make_response_from_records(Purchase.export(submit),
                                             "xlsx")
     resp.headers[
         "Content-Disposition"] = "attachment; filename=purchase.xlsx"
     return resp
Example #3
0
 def _to_dict(contract):
     _dict = contract.to_dict()
     from bmp.models.purchase import Purchase
     purchase = contract.purchase
     if purchase:
         purchase = Purchase._to_dict(purchase)
         purchase.pop("imgs")
         purchase.pop("contract")
         _dict["purchase"] = purchase
     return _dict
Example #4
0
 def _to_dict(contract):
     _dict = contract.to_dict()
     from bmp.models.purchase import Purchase
     purchase = contract.purchase
     if purchase:
         purchase = Purchase._to_dict(purchase)
         purchase.pop("imgs")
         purchase.pop("contract")
         _dict["purchase"] = purchase
     return _dict
Example #5
0
 def search(self, page=None, pre_page=None):
     submit = self.request()
     return self.succ(Purchase.search(submit, page, pre_page))
Example #6
0
 def delete(self, pid):
     Purchase.delete(pid)
     return self.succ()
Example #7
0
 def post(self):
     submit = self.__submit()
     purchase = Purchase.add(submit)
     return self.succ()
Example #8
0
 def save(self):
     submit = self.__submit()
     Purchase.edit(submit)
     return self.succ()
Example #9
0
 def passed(self, page=0, pre_page=None):
     return self.succ(Purchase.passed(page, pre_page))
Example #10
0
 def finished(self, page=0, pre_page=None):
     return self.succ(Purchase.finished(page, pre_page))
Example #11
0
 def saved(self, page=0, pre_page=None, pid=0):
     if pid:
         return self.succ(Purchase.get(pid))
     page = Purchase.drafts(page, pre_page)
     return self.succ(page)
Example #12
0
 def approval(self, pid):
     Purchase.approval(pid)
     Mail().to(Purchase.query.filter(Purchase.id == pid).one())
     return self.succ()
Example #13
0
 def get(self):
     submit = request.args
     resp = excel.make_response_from_records(Purchase.export(submit), "xlsx")
     resp.headers["Content-Disposition"] = "attachment; filename=purchase.xlsx"
     return resp