resolved merge conflicts
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index a6b5b72..8ba4eef 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
from __future__ import unicode_literals
import frappe
-__version__ = '8.0.50'
+__version__ = '8.0.51'
def get_default_company(user=None):
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 8068ea6..1f2966d 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -403,4 +403,5 @@
erpnext.patches.v8_0.delete_bin_indexes
erpnext.patches.v8_0.move_account_head_from_account_to_warehouse_for_inventory
erpnext.patches.v8_0.change_in_words_varchar_length
-erpnext.patches.v8_0.create_domain_docs #16-05-2017
\ No newline at end of file
+erpnext.patches.v8_0.create_domain_docs #16-05-2017
+erpnext.patches.v8_0.update_sales_cost_in_project
\ No newline at end of file
diff --git a/erpnext/patches/v8_0/update_sales_cost_in_project.py b/erpnext/patches/v8_0/update_sales_cost_in_project.py
new file mode 100644
index 0000000..cc3798e
--- /dev/null
+++ b/erpnext/patches/v8_0/update_sales_cost_in_project.py
@@ -0,0 +1,12 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ frappe.db.sql("""
+ update `tabProject` p
+ set total_sales_cost = (select sum(base_grand_total)
+ from `tabSales Order` where project=p.name and docstatus=1)
+ """)
\ No newline at end of file
diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py
index 66df901..10d4f22 100644
--- a/erpnext/projects/doctype/project/project.py
+++ b/erpnext/projects/doctype/project/project.py
@@ -181,7 +181,7 @@
self.total_purchase_cost = total_purchase_cost and total_purchase_cost[0][0] or 0
def update_sales_costing(self):
- total_sales_cost = frappe.db.sql("""select sum(grand_total)
+ total_sales_cost = frappe.db.sql("""select sum(base_grand_total)
from `tabSales Order` where project = %s and docstatus=1""", self.name)
self.total_sales_cost = total_sales_cost and total_sales_cost[0][0] or 0
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 6e21e67d..f5f3493 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -37,7 +37,8 @@
if frappe.db.get_default("item_naming_by")=="Naming Series":
if self.variant_of:
if not self.item_code:
- self.item_code = make_variant_item_code(self.variant_of, self.item_name, self)
+ template_item_name = frappe.db.get_value("Item", self.variant_of, "item_name")
+ self.item_code = make_variant_item_code(self.variant_of, template_item_name, self)
else:
from frappe.model.naming import make_autoname
self.item_code = make_autoname(self.naming_series+'.#####')
diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py
index fd1ece2..2b9def3 100644
--- a/erpnext/stock/utils.py
+++ b/erpnext/stock/utils.py
@@ -65,7 +65,7 @@
if with_valuation_rate:
return (last_entry.qty_after_transaction, last_entry.valuation_rate) if last_entry else (0.0, 0.0)
else:
- return last_entry.qty_after_transaction or 0.0
+ return last_entry.qty_after_transaction if last_entry else 0.0
def get_latest_stock_balance():
bin_map = {}