浏览代码

Merge pull request #991 from pdvyas/api-submit

whitelist document submit and cancel
version-14
Anand Doshi 10 年前
父节点
当前提交
517270a65c
共有 1 个文件被更改,包括 8 次插入5 次删除
  1. +8
    -5
      frappe/model/document.py

+ 8
- 5
frappe/model/document.py 查看文件

@@ -411,10 +411,17 @@ class Document(BaseDocument):
fn.__name__ = method.encode("utf-8")
return Document.hook(fn)(self, *args, **kwargs)

@staticmethod
def whitelist(f):
f.whitelisted = True
return f

@whitelist.__func__
def submit(self):
self.docstatus = 1
self.save()

@whitelist.__func__
def cancel(self):
self.docstatus = 2
self.save()
@@ -451,16 +458,12 @@ class Document(BaseDocument):
elif self._action=="update_after_submit":
self.run_method("on_update_after_submit")


def check_no_back_links_exist(self):
from frappe.model.delete_doc import check_if_doc_is_linked
if not self.get("ignore_links"):
check_if_doc_is_linked(self, method="Cancel")

@staticmethod
def whitelist(f):
f.whitelisted = True
return f

@staticmethod
def hook(f):
def add_to_return_value(self, new_return_value):


正在加载...
取消
保存