ソースを参照

[fix] [minor] [bug] int docstatus before to_docstatus check

version-14
Anand Doshi 12年前
コミット
8319080497
2個のファイルの変更5行の追加3行の削除
  1. +3
    -2
      webnotes/model/bean.py
  2. +2
    -1
      webnotes/model/create_new.py

+ 3
- 2
webnotes/model/bean.py ファイルの表示

@@ -35,6 +35,7 @@ from webnotes.model.doc import Document


class DocstatusTransitionError(webnotes.ValidationError): pass class DocstatusTransitionError(webnotes.ValidationError): pass
class BeanPermissionError(webnotes.ValidationError): pass class BeanPermissionError(webnotes.ValidationError): pass
class TimestampMismatchError(webnotes.ValidationError): pass


class Bean: class Bean:
""" """
@@ -148,7 +149,7 @@ class Bean:
if conflict: if conflict:
webnotes.msgprint(_("Error: Document has been modified after you have opened it") \ webnotes.msgprint(_("Error: Document has been modified after you have opened it") \
+ (" (%s, %s). " % (modified, self.doc.modified)) \ + (" (%s, %s). " % (modified, self.doc.modified)) \
+ _("Please refresh to get the latest document."), raise_exception=True)
+ _("Please refresh to get the latest document."), raise_exception=TimestampMismatchError)
def check_docstatus_transition(self, db_docstatus, method): def check_docstatus_transition(self, db_docstatus, method):
valid = { valid = {
@@ -199,7 +200,7 @@ class Bean:


d.modified_by = user d.modified_by = user
d.modified = ts d.modified = ts
if d.docstatus != 2 and self.to_docstatus >= d.docstatus: # don't update deleted
if d.docstatus != 2 and self.to_docstatus >= int(d.docstatus): # don't update deleted
d.docstatus = self.to_docstatus d.docstatus = self.to_docstatus


def prepare_for_save(self, method): def prepare_for_save(self, method):


+ 2
- 1
webnotes/model/create_new.py ファイルの表示

@@ -11,7 +11,8 @@ def get_new_doc(doctype, parent_doc = None, parentfield = None):
doc = webnotes.doc({ doc = webnotes.doc({
"doctype": doctype, "doctype": doctype,
"__islocal": 1, "__islocal": 1,
"owner": webnotes.session.user
"owner": webnotes.session.user,
"docstatus": 0
}) })
meta = webnotes.get_doctype(doctype) meta = webnotes.get_doctype(doctype)


読み込み中…
キャンセル
保存