From 608bbc7850c6bf2785d088246353e83304657885 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 19 Oct 2015 11:25:53 +0530 Subject: [PATCH 1/4] Test case fixed for swtiching valuation method --- .../delivery_note/test_delivery_note.py | 25 +++++++++++-------- .../test_stock_reconciliation.py | 18 +++++++------ 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py index 760d63b7d9..3aaefaf855 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py @@ -16,7 +16,8 @@ from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_invoice from erpnext.stock.doctype.stock_entry.test_stock_entry \ import make_stock_entry, make_serialized_item, get_qty_after_transaction from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos, SerialNoWarehouseError -from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import create_stock_reconciliation +from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation \ + import create_stock_reconciliation, set_valuation_method class TestDeliveryNote(unittest.TestCase): def test_over_billing_against_dn(self): @@ -57,7 +58,7 @@ class TestDeliveryNote(unittest.TestCase): def test_delivery_note_gl_entry(self): set_perpetual_inventory() self.assertEqual(cint(frappe.defaults.get_global_default("auto_accounting_for_stock")), 1) - frappe.db.set_value("Item", "_Test Item", "valuation_method", "FIFO") + set_valuation_method("_Test Item", "FIFO") make_stock_entry(target="_Test Warehouse - _TC", qty=5, basic_rate=100) @@ -326,13 +327,15 @@ class TestDeliveryNote(unittest.TestCase): def test_delivery_of_bundled_items_to_target_warehouse(self): set_perpetual_inventory() - frappe.db.set_value("Item", "_Test Item", "valuation_method", "FIFO") + + set_valuation_method("_Test Item", "FIFO") + set_valuation_method("_Test Item Home Desktop 100", "FIFO") for warehouse in ("_Test Warehouse - _TC", "_Test Warehouse 1 - _TC"): create_stock_reconciliation(item_code="_Test Item", target=warehouse, - qty=50, rate=100) + qty=100, rate=100) create_stock_reconciliation(item_code="_Test Item Home Desktop 100", - target=warehouse, qty=50, rate=100) + target=warehouse, qty=100, rate=100) opening_qty_test_warehouse_1 = get_qty_after_transaction(warehouse="_Test Warehouse 1 - _TC") @@ -343,19 +346,21 @@ class TestDeliveryNote(unittest.TestCase): # qty after delivery actual_qty = get_qty_after_transaction(warehouse="_Test Warehouse - _TC") - self.assertEquals(actual_qty, 25) + self.assertEquals(actual_qty, 75) actual_qty = get_qty_after_transaction(warehouse="_Test Warehouse 1 - _TC") self.assertEquals(actual_qty, opening_qty_test_warehouse_1 + 25) # stock value diff for source warehouse - stock_value_difference = frappe.db.get_value("Stock Ledger Entry", {"voucher_type": "Delivery Note", - "voucher_no": dn.name, "item_code": "_Test Item Home Desktop 100", "warehouse": "_Test Warehouse - _TC"}, + stock_value_difference = frappe.db.get_value("Stock Ledger Entry", + {"voucher_type": "Delivery Note", "voucher_no": dn.name, + "item_code": "_Test Item Home Desktop 100", "warehouse": "_Test Warehouse - _TC"}, "stock_value_difference") # stock value diff for target warehouse - stock_value_difference1 = frappe.db.get_value("Stock Ledger Entry", {"voucher_type": "Delivery Note", - "voucher_no": dn.name, "item_code": "_Test Item Home Desktop 100", "warehouse": "_Test Warehouse 1 - _TC"}, + stock_value_difference1 = frappe.db.get_value("Stock Ledger Entry", + {"voucher_type": "Delivery Note", "voucher_no": dn.name, + "item_code": "_Test Item Home Desktop 100", "warehouse": "_Test Warehouse 1 - _TC"}, "stock_value_difference") self.assertEquals(abs(stock_value_difference), stock_value_difference1) diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py index cfaa499578..1c6be1f3df 100644 --- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py @@ -36,8 +36,8 @@ class TestStockReconciliation(unittest.TestCase): ] for d in input_data: - repost_stock_as_per_valuation_method(valuation_method) - + set_valuation_method("_Test Item", valuation_method) + last_sle = get_previous_sle({ "item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC", @@ -114,11 +114,13 @@ def create_stock_reconciliation(**args): pass return sr -def repost_stock_as_per_valuation_method(valuation_method): - frappe.db.set_value("Item", "_Test Item", "valuation_method", valuation_method) - update_entries_after({ - "item_code": "_Test Item", - "warehouse": "_Test Warehouse - _TC", - }, allow_negative_stock=1) +def set_valuation_method(item_code, valuation_method): + frappe.db.set_value("Item", item_code, "valuation_method", valuation_method) + + for warehouse in frappe.get_all("Warehouse", filters={"company": "_Test Company"}): + update_entries_after({ + "item_code": item_code, + "warehouse": warehouse + }, allow_negative_stock=1) test_dependencies = ["Item", "Warehouse"] From 6f64a78ecfd927d142d7059c53c98fc4f4f2815c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 19 Oct 2015 14:46:36 +0530 Subject: [PATCH 2/4] Test case fixed for swtiching valuation method --- .../doctype/delivery_note/test_delivery_note.py | 17 ++++++++++++++++- .../test_stock_reconciliation.py | 4 ++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py index 3aaefaf855..07308e6c30 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py @@ -336,7 +336,7 @@ class TestDeliveryNote(unittest.TestCase): qty=100, rate=100) create_stock_reconciliation(item_code="_Test Item Home Desktop 100", target=warehouse, qty=100, rate=100) - + opening_qty_test_warehouse_1 = get_qty_after_transaction(warehouse="_Test Warehouse 1 - _TC") dn = create_delivery_note(item_code="_Test Product Bundle Item", @@ -352,6 +352,21 @@ class TestDeliveryNote(unittest.TestCase): self.assertEquals(actual_qty, opening_qty_test_warehouse_1 + 25) # stock value diff for source warehouse + # for "_Test Item" + stock_value_difference = frappe.db.get_value("Stock Ledger Entry", + {"voucher_type": "Delivery Note", "voucher_no": dn.name, + "item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC"}, + "stock_value_difference") + + # stock value diff for target warehouse + stock_value_difference1 = frappe.db.get_value("Stock Ledger Entry", + {"voucher_type": "Delivery Note", "voucher_no": dn.name, + "item_code": "_Test Item", "warehouse": "_Test Warehouse 1 - _TC"}, + "stock_value_difference") + + self.assertEquals(abs(stock_value_difference), stock_value_difference1) + + # for "_Test Item Home Desktop 100" stock_value_difference = frappe.db.get_value("Stock Ledger Entry", {"voucher_type": "Delivery Note", "voucher_no": dn.name, "item_code": "_Test Item Home Desktop 100", "warehouse": "_Test Warehouse - _TC"}, diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py index 1c6be1f3df..947a0935aa 100644 --- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py @@ -119,8 +119,8 @@ def set_valuation_method(item_code, valuation_method): for warehouse in frappe.get_all("Warehouse", filters={"company": "_Test Company"}): update_entries_after({ - "item_code": item_code, - "warehouse": warehouse + "item_code": item_code, + "warehouse": warehouse.name }, allow_negative_stock=1) test_dependencies = ["Item", "Warehouse"] From 7a869b0dca015db8fd6ecf6c8d7e9d5acead5f31 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 19 Oct 2015 17:33:16 +0530 Subject: [PATCH 3/4] [hotfix] print in patch --- erpnext/patches/v6_4/make_image_thumbnail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/patches/v6_4/make_image_thumbnail.py b/erpnext/patches/v6_4/make_image_thumbnail.py index 1daaede0c3..36bdcfc6d4 100644 --- a/erpnext/patches/v6_4/make_image_thumbnail.py +++ b/erpnext/patches/v6_4/make_image_thumbnail.py @@ -11,4 +11,4 @@ def execute(): if item_doc.thumbnail: item_doc.db_set("thumbnail", item_doc.thumbnail, update_modified=False) except Exception: - print "Unable to make thumbnail for {0}".format(item.website_image) + print "Unable to make thumbnail for {0}".format(item.website_image.encode("utf-8")) From 414660313ab3e301c7ffb458c150acd8da4746ec Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 19 Oct 2015 19:40:58 +0600 Subject: [PATCH 4/4] bumped to version 6.5.1 --- erpnext/__version__.py | 2 +- erpnext/hooks.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/__version__.py b/erpnext/__version__.py index e366e5b768..f4a63fa44e 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1,2 +1,2 @@ from __future__ import unicode_literals -__version__ = '6.5.0' +__version__ = '6.5.1' diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 8280154c03..fed054cac6 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -29,7 +29,7 @@ blogs. """ app_icon = "icon-th" app_color = "#e74c3c" -app_version = "6.5.0" +app_version = "6.5.1" github_link = "https://github.com/frappe/erpnext" error_report_email = "support@erpnext.com" diff --git a/setup.py b/setup.py index d3f128168b..0241b700bd 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -version = "6.5.0" +version = "6.5.1" with open("requirements.txt", "r") as f: install_requires = f.readlines()