diff --git a/erpnext/__version__.py b/erpnext/__version__.py index f3915b42074..99604dc06c1 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/accounts/doctype/journal_entry_account/journal_entry_account.json b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json index d09171434d5..77a04570562 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", diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index f41d19dddd6..51c79160c7a 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): diff --git a/erpnext/hooks.py b/erpnext/hooks.py index deecfb8e5ff..1609b87cab5 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/erpnext/patches.txt b/erpnext/patches.txt index b8389aa8182..d5ba353191e 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 diff --git a/erpnext/patches/v5_0/capacity_planning.py b/erpnext/patches/v5_0/capacity_planning.py deleted file mode 100644 index f12f1f72416..00000000000 --- 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 96d6b3ddef4..325d6cf4a4e 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")) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index f263f34d1d4..59a68b7f19a 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) @@ -273,7 +277,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": diff --git a/setup.py b/setup.py index c10b407237f..c624e0e4442 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()