Merge pull request #3892 from nabinhait/fix1
[fix] Get stock and rate function restored
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 d091714..77a0457 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/patches/v5_0/capacity_planning.py b/erpnext/patches/v5_0/capacity_planning.py
deleted file mode 100644
index f12f1f7..0000000
--- 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 96d6b3d..325d6cf 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 @@
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 @@
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 7583306..59a68b7 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -277,7 +277,7 @@
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":