diff --git a/patches/february_2013/p07_clear_web_cache.py b/patches/february_2013/p07_clear_web_cache.py index 5aca2d6ee6..26329249d0 100644 --- a/patches/february_2013/p07_clear_web_cache.py +++ b/patches/february_2013/p07_clear_web_cache.py @@ -1,6 +1,6 @@ import webnotes def execute(): + webnotes.reload_doc("website", "doctype", "blog_post") from website.utils import clear_cache clear_cache() - \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index bff51a9ae0..7409c0e986 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -18,6 +18,7 @@ from __future__ import unicode_literals patch_list = [ "execute:webnotes.reload_doc('core', 'doctype', 'docfield')", "execute:webnotes.reload_doc('core', 'doctype', 'report')", + "execute:webnotes.reload_doc('core', 'doctype', 'doctype')", "patches.mar_2012.so_rv_mapper_fix", "patches.mar_2012.clean_property_setter", "patches.april_2012.naming_series_patch", diff --git a/stock/doctype/stock_entry/test_stock_entry.py b/stock/doctype/stock_entry/test_stock_entry.py index 39ec58ac3a..21d15f7e23 100644 --- a/stock/doctype/stock_entry/test_stock_entry.py +++ b/stock/doctype/stock_entry/test_stock_entry.py @@ -21,6 +21,77 @@ class TestStockEntry(unittest.TestCase): where item_code='_Test Item'""") self.assertTrue(mr_name) + + def test_material_receipt_gl_entry(self): + webnotes.conn.sql("delete from `tabStock Ledger Entry`") + webnotes.defaults.set_global_default("auto_inventory_accounting", 1) + + mr = webnotes.bean(copy=test_records[0]) + mr.insert() + mr.submit() + + stock_in_hand_account = webnotes.conn.get_value("Company", "_Test Company", + "stock_in_hand_account") + + self.check_stock_ledger_entries("Stock Entry", mr.doc.name, + [["_Test Item", "_Test Warehouse", 50.0]]) + + self.check_gl_entries("Stock Entry", mr.doc.name, + sorted([ + [stock_in_hand_account, 5000.0, 0.0], + ["Stock Adjustment - _TC", 0.0, 5000.0] + ]) + ) + + webnotes.defaults.set_global_default("auto_inventory_accounting", 0) + + def test_material_issue_gl_entry(self): + webnotes.conn.sql("delete from `tabStock Ledger Entry`") + webnotes.defaults.set_global_default("auto_inventory_accounting", 1) + + mr = webnotes.bean(copy=test_records[0]) + mr.insert() + mr.submit() + + stock_in_hand_account = webnotes.conn.get_value("Company", "_Test Company", + "stock_in_hand_account") + + self.check_stock_ledger_entries("Stock Entry", mr.doc.name, + [["_Test Item", "_Test Warehouse", 50.0]]) + + self.check_gl_entries("Stock Entry", mr.doc.name, + sorted([ + [stock_in_hand_account, 5000.0, 0.0], + ["Stock Adjustment - _TC", 0.0, 5000.0] + ]) + ) + + webnotes.defaults.set_global_default("auto_inventory_accounting", 0) + + def check_stock_ledger_entries(self, voucher_type, voucher_no, expected_sle): + # check stock ledger entries + sle = webnotes.conn.sql("""select * from `tabStock Ledger Entry` + where voucher_type = %s and voucher_no = %s order by item_code, warehouse""", + (voucher_type, voucher_no), as_dict=1) + self.assertTrue(sle) + + for i, sle in enumerate(sle): + self.assertEquals(expected_sle[i][0], sle.item_code) + self.assertEquals(expected_sle[i][1], sle.warehouse) + self.assertEquals(expected_sle[i][2], sle.actual_qty) + + def check_gl_entries(self, voucher_type, voucher_no, expected_gl_entries): + # check gl entries + + gl_entries = webnotes.conn.sql("""select account, debit, credit + from `tabGL Entry` where voucher_type=%s and voucher_no=%s + order by account asc, debit asc""", (voucher_type, voucher_no), as_dict=1) + self.assertTrue(gl_entries) + + for i, gle in enumerate(gl_entries): + self.assertEquals(expected_gl_entries[i][0], gle.account) + self.assertEquals(expected_gl_entries[i][1], gle.debit) + self.assertEquals(expected_gl_entries[i][2], gle.credit) test_records = [ [ diff --git a/stock/doctype/warehouse/warehouse.txt b/stock/doctype/warehouse/warehouse.txt index d0dd73c086..d08b3ccff3 100644 --- a/stock/doctype/warehouse/warehouse.txt +++ b/stock/doctype/warehouse/warehouse.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-01-10 16:34:30", + "creation": "2013-03-07 18:50:32", "docstatus": 0, - "modified": "2013-02-04 11:35:53", + "modified": "2013-03-11 17:58:45", "modified_by": "Administrator", "owner": "Administrator" }, @@ -21,7 +21,8 @@ "name": "__common__", "parent": "Warehouse", "parentfield": "fields", - "parenttype": "DocType" + "parenttype": "DocType", + "read_only": 0 }, { "doctype": "DocPerm", @@ -190,7 +191,7 @@ "permlevel": 0 }, { - "description": "This feature is for merging duplicate warehouses. It will replace all the links of this warehouse by \"Merge With\" warehouse. After merging you can delete this warehouse, as stock level for this warehouse will be zero.", + "description": "This feature is for merging duplicate warehouses. It will replace all the links of this warehouse by \"Merge Into\" warehouse. After merging you can delete this warehouse, as stock level for this warehouse will be zero.", "doctype": "DocField", "fieldname": "merge_warehouses_section", "fieldtype": "Section Break", @@ -201,7 +202,7 @@ "doctype": "DocField", "fieldname": "merge_with", "fieldtype": "Link", - "label": "Merge With", + "label": "Merge Into", "options": "Warehouse", "permlevel": 2 }, @@ -221,24 +222,6 @@ "role": "Material Master Manager", "write": 1 }, - { - "amend": 0, - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "permlevel": 0, - "role": "Material User", - "write": 0 - }, - { - "amend": 0, - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "permlevel": 2, - "role": "Material User", - "write": 0 - }, { "cancel": 1, "create": 1, @@ -248,6 +231,26 @@ "write": 1 }, { + "amend": 0, + "cancel": 0, + "create": 0, + "doctype": "DocPerm", + "permlevel": 0, + "role": "Material Manager", + "write": 0 + }, + { + "amend": 0, + "cancel": 0, + "create": 0, + "doctype": "DocPerm", + "permlevel": 0, + "role": "Material User", + "write": 0 + }, + { + "amend": 0, + "cancel": 0, "create": 0, "doctype": "DocPerm", "permlevel": 2,