[fix] [minor] [bug] int docstatus before to_docstatus check
This commit is contained in:
parent
f13da67341
commit
0fa631944c
@ -1,6 +1,7 @@
|
|||||||
import webnotes
|
import webnotes
|
||||||
import unittest, json
|
import unittest, json
|
||||||
from webnotes.utils import flt, cint
|
from webnotes.utils import flt, cint
|
||||||
|
from webnotes.model.bean import DocstatusTransitionError, TimestampMismatchError
|
||||||
|
|
||||||
class TestSalesInvoice(unittest.TestCase):
|
class TestSalesInvoice(unittest.TestCase):
|
||||||
def make(self):
|
def make(self):
|
||||||
@ -9,6 +10,32 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
w.submit()
|
w.submit()
|
||||||
return w
|
return w
|
||||||
|
|
||||||
|
def test_double_submission(self):
|
||||||
|
w = webnotes.bean(copy=test_records[0])
|
||||||
|
w.doc.docstatus = '0'
|
||||||
|
w.insert()
|
||||||
|
|
||||||
|
w2 = [d for d in w.doclist]
|
||||||
|
w.submit()
|
||||||
|
|
||||||
|
w = webnotes.bean(w2)
|
||||||
|
self.assertRaises(DocstatusTransitionError, w.submit)
|
||||||
|
|
||||||
|
def test_timestamp_change(self):
|
||||||
|
w = webnotes.bean(copy=test_records[0])
|
||||||
|
w.doc.docstatus = '0'
|
||||||
|
w.insert()
|
||||||
|
|
||||||
|
w2 = webnotes.bean([d.fields.copy() for d in w.doclist])
|
||||||
|
|
||||||
|
import time
|
||||||
|
time.sleep(1)
|
||||||
|
w.save()
|
||||||
|
|
||||||
|
import time
|
||||||
|
time.sleep(1)
|
||||||
|
self.assertRaises(TimestampMismatchError, w2.save)
|
||||||
|
|
||||||
def test_sales_invoice_calculation_base_currency(self):
|
def test_sales_invoice_calculation_base_currency(self):
|
||||||
si = webnotes.bean(copy=test_records[2])
|
si = webnotes.bean(copy=test_records[2])
|
||||||
si.run_method("calculate_taxes_and_totals")
|
si.run_method("calculate_taxes_and_totals")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user