From 84bc5601eba9137bfd559ab50f44947710628579 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 16 Jun 2017 12:13:51 +0530 Subject: [PATCH 1/5] Total sales cost in Project should be updated based on base_grand_total (#9302) * Total sales cost in Project should be updated based on base_grand_total * Patch to update sales cost in Project in base currency --- erpnext/patches.txt | 3 ++- erpnext/patches/v8_0/update_sales_cost_in_project.py | 12 ++++++++++++ erpnext/projects/doctype/project/project.py | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 erpnext/patches/v8_0/update_sales_cost_in_project.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 3796c8293c..1fae69f9da 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -400,4 +400,5 @@ erpnext.patches.v8_0.delete_schools_depricated_doctypes erpnext.patches.v8_0.update_customer_pos_id erpnext.patches.v8_0.rename_items_in_status_field_of_material_request erpnext.patches.v8_0.delete_bin_indexes -erpnext.patches.v8_0.change_in_words_varchar_length \ No newline at end of file +erpnext.patches.v8_0.update_sales_cost_in_project +erpnext.patches.v8_0.change_in_words_varchar_length 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 0000000000..cc3798e056 --- /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 0345f05861..de198a9cdc 100644 --- a/erpnext/projects/doctype/project/project.py +++ b/erpnext/projects/doctype/project/project.py @@ -178,7 +178,7 @@ class Project(Document): 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 From cc699a94fdb9fc211cd8e92d2d846a0dd9aabfaf Mon Sep 17 00:00:00 2001 From: nick9822 Date: Tue, 20 Jun 2017 17:13:29 +0530 Subject: [PATCH 2/5] Bug while fetching new item balance. --- erpnext/stock/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py index fd1ece2151..2b9def35a8 100644 --- a/erpnext/stock/utils.py +++ b/erpnext/stock/utils.py @@ -65,7 +65,7 @@ def get_stock_balance(item_code, warehouse, posting_date=None, posting_time=None 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 = {} From 8d269beb45b69b72efec95bb9578180436da2473 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Tue, 20 Jun 2017 20:13:54 +0530 Subject: [PATCH 3/5] [minor][fix] pass template item name to make_variant_item_code --- erpnext/stock/doctype/item/item.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index f2780bf67c..c6dc4dae56 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -37,7 +37,8 @@ class Item(WebsiteGenerator): 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) + 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+'.#####') From 29ba4143f9d41e0ff9df7c47b82adc19a602c451 Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Wed, 14 Jun 2017 16:13:23 +0530 Subject: [PATCH 4/5] make quotation against lead company name (#9188) --- erpnext/crm/doctype/lead/lead.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py index ccbb5369aa..f38d386be7 100644 --- a/erpnext/crm/doctype/lead/lead.py +++ b/erpnext/crm/doctype/lead/lead.py @@ -150,8 +150,7 @@ def make_quotation(source_name, target_doc=None): {"Lead": { "doctype": "Quotation", "field_map": { - "name": "lead", - "lead_name": "customer_name", + "name": "lead" } }}, target_doc) target_doc.quotation_to = "Lead" From 9b4690995e6a67c4f07312f608e129ac404adee2 Mon Sep 17 00:00:00 2001 From: mbauskar Date: Wed, 21 Jun 2017 13:47:12 +0600 Subject: [PATCH 5/5] bumped to version 8.0.51 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index a6b5b7206b..8ba4eefc95 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):