Sfoglia il codice sorgente

Merge pull request #991 from pdvyas/api-submit

whitelist document submit and cancel
version-14
Anand Doshi 10 anni fa
parent
commit
517270a65c
1 ha cambiato i file con 8 aggiunte e 5 eliminazioni
  1. +8
    -5
      frappe/model/document.py

+ 8
- 5
frappe/model/document.py Vedi File

@@ -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):


Caricamento…
Annulla
Salva