diff --git a/buying/doctype/purchase_order/test_purchase_order.py b/buying/doctype/purchase_order/test_purchase_order.py index e9a9c348a62..bd5f410f6e1 100644 --- a/buying/doctype/purchase_order/test_purchase_order.py +++ b/buying/doctype/purchase_order/test_purchase_order.py @@ -103,7 +103,7 @@ class TestPurchaseOrder(unittest.TestCase): po.doc.company = "_Test Company 1" po.doc.conversion_rate = 0.0167 self.assertRaises(InvalidWarehouseCompany, po.insert) - + def test_uom_integer_validation(self): from utilities.transaction_base import UOMMustBeIntegerError po = webnotes.bean(copy=test_records[0]) diff --git a/stock/doctype/purchase_receipt/purchase_receipt.py b/stock/doctype/purchase_receipt/purchase_receipt.py index 537d75d339e..13794067c50 100644 --- a/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/stock/doctype/purchase_receipt/purchase_receipt.py @@ -7,7 +7,7 @@ import webnotes from webnotes.utils import cstr, flt, cint from webnotes.model.bean import getlist from webnotes.model.code import get_obj -from webnotes import msgprint +from webnotes import msgprint, _ import webnotes.defaults from stock.utils import update_bin diff --git a/stock/doctype/serial_no/serial_no.py b/stock/doctype/serial_no/serial_no.py index b8287df971b..22a16b56482 100644 --- a/stock/doctype/serial_no/serial_no.py +++ b/stock/doctype/serial_no/serial_no.py @@ -177,6 +177,12 @@ class DocType(StockController): webnotes.conn.sql("""update `tab%s` set serial_no = %s where name=%s""" % (dt[0], '%s', '%s'), ('\n'.join(serial_nos), item[0])) + + def on_stock_ledger_entry(self): + if self.via_stock_ledger and not self.doc.fields.get("__islocal"): + self.set_status() + self.set_purchase_details() + self.set_sales_details() def on_stock_ledger_entry(self): if self.via_stock_ledger and not self.doc.fields.get("__islocal"): @@ -240,9 +246,8 @@ def update_serial_nos(sle, item_det): serial_nos = [] for i in xrange(cint(sle.actual_qty)): serial_nos.append(make_autoname(item_det.serial_no_series)) - webnotes.conn.set(sle, "serial_no", "\n".join(serial_nos)) - + if sle.serial_no: serial_nos = get_serial_nos(sle.serial_no) for serial_no in serial_nos: @@ -280,7 +285,7 @@ def update_serial_nos_after_submit(controller, parentfield): (controller.doc.doctype, controller.doc.name), as_dict=True) if not stock_ledger_entries: return - + for d in controller.doclist.get({"parentfield": parentfield}): serial_no = None for sle in stock_ledger_entries: diff --git a/stock/doctype/stock_entry/test_stock_entry.py b/stock/doctype/stock_entry/test_stock_entry.py index 4b36e5828c2..b37f32c5c4b 100644 --- a/stock/doctype/stock_entry/test_stock_entry.py +++ b/stock/doctype/stock_entry/test_stock_entry.py @@ -43,7 +43,6 @@ class TestStockEntry(unittest.TestCase): self._clear_stock_account_balance() webnotes.bean("Profile", "test2@example.com").get_controller()\ .add_roles("Sales User", "Sales Manager", "Material User", "Material Manager") - webnotes.session.user = "test2@example.com" from stock.utils import InvalidWarehouseCompany @@ -62,7 +61,6 @@ class TestStockEntry(unittest.TestCase): webnotes.bean("Profile", "test2@example.com").get_controller()\ .add_roles("Sales User", "Sales Manager", "Material User", "Material Manager") - webnotes.session.user = "test@example.com" st1 = webnotes.bean(copy=test_records[0]) st1.doc.company = "_Test Company 1" @@ -70,7 +68,6 @@ class TestStockEntry(unittest.TestCase): st1.insert() self.assertRaises(UserNotAllowedForWarehouse, st1.submit) - webnotes.session.user = "test2@example.com" st1 = webnotes.bean(copy=test_records[0]) st1.doc.company = "_Test Company 1" st1.doclist[1].t_warehouse="_Test Warehouse 2 - _TC1"