From ac07b1cc078a1dc420608bc398447ef72164bd05 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 17 Aug 2015 10:50:23 +0530 Subject: [PATCH 1/7] [fix] Get stock and rate function restored --- erpnext/stock/doctype/stock_entry/stock_entry.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index f263f34d1d..7583306898 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -231,6 +231,10 @@ class StockEntry(StockController): frappe.throw(_("""Row {0}: Qty not avalable in warehouse {1} on {2} {3}. Available Qty: {4}, Transfer Qty: {5}""").format(d.idx, d.s_warehouse, self.posting_date, self.posting_time, d.actual_qty, d.transfer_qty), NegativeStockError) + + def get_stock_and_rate(self): + self.set_actual_qty() + self.calculate_rate_and_amount() def calculate_rate_and_amount(self, force=False): self.set_basic_rate(force) From cbfd387c0b6651b928ecca7978bbf32e6ac0eade Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 17 Aug 2015 11:42:48 +0530 Subject: [PATCH 2/7] Included Party and reference name in Journal Entry Account grid view --- .../journal_entry_account/journal_entry_account.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json index d09171434d..77a0457056 100644 --- a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json +++ b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json @@ -39,7 +39,7 @@ "hidden": 0, "ignore_user_permissions": 0, "in_filter": 0, - "in_list_view": 1, + "in_list_view": 0, "label": "Account Balance", "no_copy": 1, "oldfieldname": "balance", @@ -63,7 +63,7 @@ "hidden": 0, "ignore_user_permissions": 0, "in_filter": 1, - "in_list_view": 1, + "in_list_view": 0, "label": "Cost Center", "no_copy": 0, "oldfieldname": "cost_center", @@ -125,7 +125,7 @@ "hidden": 0, "ignore_user_permissions": 0, "in_filter": 0, - "in_list_view": 0, + "in_list_view": 1, "label": "Party", "no_copy": 0, "options": "party_type", @@ -287,7 +287,7 @@ "hidden": 0, "ignore_user_permissions": 0, "in_filter": 0, - "in_list_view": 0, + "in_list_view": 1, "label": "Reference Name", "no_copy": 0, "options": "reference_type", @@ -371,7 +371,7 @@ "is_submittable": 0, "issingle": 0, "istable": 1, - "modified": "2015-08-11 10:44:11.432623", + "modified": "2015-08-17 02:11:33.991361", "modified_by": "Administrator", "module": "Accounts", "name": "Journal Entry Account", From f763c1af259646388c2e75ea08a582f07d6389ce Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 17 Aug 2015 12:06:53 +0530 Subject: [PATCH 3/7] [fix] Additional Costs patch fixed for version 4 to 5 migration --- erpnext/patches/v5_0/capacity_planning.py | 9 --------- .../v5_4/stock_entry_additional_costs.py | 17 +++++++++++++---- 2 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 erpnext/patches/v5_0/capacity_planning.py diff --git a/erpnext/patches/v5_0/capacity_planning.py b/erpnext/patches/v5_0/capacity_planning.py deleted file mode 100644 index f12f1f7241..0000000000 --- a/erpnext/patches/v5_0/capacity_planning.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -# License: GNU General Public License v3. See license.txt - -import frappe - -def execute(): - frappe.reload_doc("stock", "doctype", "stock_entry") - if "total_fixed_cost" in frappe.db.get_table_columns("Stock Entry"): - frappe.db.sql("update `tabStock Entry` set additional_operating_cost = total_fixed_cost") diff --git a/erpnext/patches/v5_4/stock_entry_additional_costs.py b/erpnext/patches/v5_4/stock_entry_additional_costs.py index 96d6b3ddef..325d6cf4a4 100644 --- a/erpnext/patches/v5_4/stock_entry_additional_costs.py +++ b/erpnext/patches/v5_4/stock_entry_additional_costs.py @@ -16,15 +16,24 @@ def execute(): and (se.purpose not in ('Manufacture', 'Repack') or ifnull(additional_operating_cost, 0)=0) """) + stock_entry_db_columns = frappe.db.get_table_columns("Stock Entry") + if "additional_operating_cost" in stock_entry_db_columns: + operating_cost_fieldname = "additional_operating_cost" + elif "total_fixed_cost" in stock_entry_db_columns: + operating_cost_fieldname = "total_fixed_cost" + else: + return + + stock_entries = frappe.db.sql_list("""select name from `tabStock Entry` - where purpose in ('Manufacture', 'Repack') and ifnull(additional_operating_cost, 0)!=0 - and docstatus < 2""") + where purpose in ('Manufacture', 'Repack') and ifnull({0}, 0)!=0 + and docstatus < 2""".format(operating_cost_fieldname)) for d in stock_entries: stock_entry = frappe.get_doc("Stock Entry", d) stock_entry.append("additional_costs", { "description": "Additional Operating Cost", - "amount": stock_entry.additional_operating_cost + "amount": stock_entry.get(operating_cost_fieldname) }) number_of_fg_items = len([t.t_warehouse for t in stock_entry.get("items") if t.t_warehouse]) @@ -33,7 +42,7 @@ def execute(): d.valuation_rate = d.incoming_rate if d.bom_no or (d.t_warehouse and number_of_fg_items == 1): - d.additional_cost = stock_entry.additional_operating_cost + d.additional_cost = stock_entry.get(operating_cost_fieldname) d.basic_rate = flt(d.valuation_rate) - flt(d.additional_cost) d.basic_amount = flt(flt(d.basic_rate) *flt(d.transfer_qty), d.precision("basic_amount")) From c01342190cbed2fb6925f02f727f4497dd79b4e7 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 17 Aug 2015 14:18:44 +0530 Subject: [PATCH 4/7] [fix] precision issue in stock entry --- erpnext/stock/doctype/stock_entry/stock_entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index f263f34d1d..265b1eb193 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -273,7 +273,7 @@ class StockEntry(StockController): for d in self.get("items"): if d.bom_no or (d.t_warehouse and number_of_fg_items == 1): d.basic_rate = flt(raw_material_cost / flt(d.transfer_qty), d.precision("basic_rate")) - d.basic_amount = flt(flt(d.basic_rate) * flt(d.transfer_qty), d.precision("basic_amount")) + d.basic_amount = flt(raw_material_cost, d.precision("basic_amount")) def distribute_additional_costs(self): if self.purpose == "Material Issue": From dc76823a8131fd5191c11f3230fbb74967863cb6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 17 Aug 2015 11:27:00 +0530 Subject: [PATCH 5/7] [fix] Get Balance only if account or party mentioned --- erpnext/accounts/utils.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index f41d19dddd..51c79160c7 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -100,14 +100,15 @@ def get_balance_on(account=None, date=None, party_type=None, party=None): if party_type and party: cond.append("""gle.party_type = "%s" and gle.party = "%s" """ % (party_type.replace('"', '\\"'), party.replace('"', '\\"'))) + + if account or (party_type and party): + bal = frappe.db.sql(""" + SELECT sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) + FROM `tabGL Entry` gle + WHERE %s""" % " and ".join(cond))[0][0] - bal = frappe.db.sql(""" - SELECT sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) - FROM `tabGL Entry` gle - WHERE %s""" % " and ".join(cond))[0][0] - - # if bal is None, return 0 - return flt(bal) + # if bal is None, return 0 + return flt(bal) @frappe.whitelist() def add_ac(args=None): From 99bf6c0927a4e4fcbf58a799df093cc8a53adf58 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 17 Aug 2015 14:31:29 +0530 Subject: [PATCH 6/7] Update patches.txt --- erpnext/patches.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index b8389aa818..d5ba353191 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -99,7 +99,6 @@ execute:frappe.db.sql("update `tabMaterial Request` set material_request_type = execute:frappe.reload_doc('stock', 'doctype', 'item') execute:frappe.db.sql("update `tabItem` i set apply_warehouse_wise_reorder_level=1, re_order_level=0, re_order_qty=0 where exists(select name from `tabItem Reorder` where parent=i.name)") erpnext.patches.v5_0.set_default_company_in_bom -erpnext.patches.v5_0.capacity_planning execute:frappe.reload_doc('crm', 'doctype', 'lead') execute:frappe.reload_doc('crm', 'doctype', 'opportunity') erpnext.patches.v5_0.rename_taxes_and_charges_master From b23049a55ecaca3444f8829e71388774d55673ed Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 17 Aug 2015 15:06:48 +0600 Subject: [PATCH 7/7] bumped to version 5.6.4 --- 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 f3915b4207..99604dc06c 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1,2 +1,2 @@ from __future__ import unicode_literals -__version__ = '5.6.3' +__version__ = '5.6.4' diff --git a/erpnext/hooks.py b/erpnext/hooks.py index deecfb8e5f..1609b87cab 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -27,7 +27,7 @@ blogs. """ app_icon = "icon-th" app_color = "#e74c3c" -app_version = "5.6.3" +app_version = "5.6.4" github_link = "https://github.com/frappe/erpnext" error_report_email = "support@erpnext.com" diff --git a/setup.py b/setup.py index c10b407237..c624e0e444 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -version = "5.6.3" +version = "5.6.4" with open("requirements.txt", "r") as f: install_requires = f.readlines()