refactored get_value and added backlink check in 'cancel'

This commit is contained in:
Rushabh Mehta 2013-03-04 15:34:45 +05:30
parent ba0e1ea194
commit f934a240ba
3 changed files with 9 additions and 7 deletions

View File

@ -108,6 +108,8 @@ class DocType(SellingController):
self.update_time_log_batch(self.doc.name)
self.convert_to_recurring()
def before_cancel(self):
self.update_time_log_batch(None)
def on_cancel(self):
if cint(self.doc.is_pos) == 1:
@ -122,8 +124,7 @@ class DocType(SellingController):
sales_com_obj.check_stop_sales_order(self)
self.check_next_docstatus()
sales_com_obj.update_prevdoc_detail(0, self)
self.update_time_log_batch(None)
self.make_gl_entries(is_cancel=1)
def on_update_after_submit(self):

View File

@ -33,10 +33,10 @@ class TestSalesInvoice(unittest.TestCase):
tlb = webnotes.bean("Time Log Batch", "_T-Time Log Batch-00001")
tlb.submit()
w = webnotes.bean(webnotes.copy_doclist(test_records[0]))
w.doclist[1].time_log_batch = "_T-Time Log Batch-00001"
w.insert()
w.submit()
si = webnotes.bean(webnotes.copy_doclist(test_records[0]))
si.doclist[1].time_log_batch = "_T-Time Log Batch-00001"
si.insert()
si.submit()
self.assertEquals(webnotes.conn.get_value("Time Log Batch", "_T-Time Log Batch-00001", "status"),
"Billed")
@ -44,7 +44,7 @@ class TestSalesInvoice(unittest.TestCase):
self.assertEquals(webnotes.conn.get_value("Time Log", "_T-Time Log-00001", "status"),
"Billed")
w.cancel()
si.cancel()
self.assertEquals(webnotes.conn.get_value("Time Log Batch", "_T-Time Log Batch-00001", "status"),
"Submitted")

View File

@ -203,4 +203,5 @@ patch_list = [
"execute:(not webnotes.conn.exists('UOM', 'Hour')) and webnotes.doc({'uom_name': 'Unit', 'doctype': 'UOM', 'name': 'Hour'}).insert()",
"patches.february_2013.p09_remove_cancelled_warehouses",
"patches.march_2013.update_po_prevdoc_doctype",
"patches.february_2013.p09_timesheets",
]