From 017d30f46563a1ae6231ca30b911c25c1ca6d366 Mon Sep 17 00:00:00 2001 From: Kanchan Chauhan Date: Wed, 6 Apr 2016 19:28:50 +0530 Subject: [PATCH] [Minor Fixes] Findings in setting up erpnext --- .../doctype/purchase_order/purchase_order.js | 2 +- .../doctype/purchase_order/purchase_order.py | 5 +---- .../production_planning_tool.js | 4 ++++ erpnext/projects/doctype/project/project.py | 3 +-- erpnext/templates/pages/projects.js | 18 ------------------ 5 files changed, 7 insertions(+), 25 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index 78924e9233..b6026fd196 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -61,7 +61,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( } } - if(doc.docstatus == 1 && doc.status != "Closed") { + if(doc.docstatus == 1 && !in_list(["Closed", "Completed"], doc.status)) { if(flt(doc.per_received, 2) < 100 && allow_receipt) { cur_frm.add_custom_button(__('Receive'), this.make_purchase_receipt, __("Make")); diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index 5dd59e8ffc..924a7bd6f0 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -103,10 +103,7 @@ class PurchaseOrder(BuyingController): d.price_list_rate = d.base_price_list_rate / conversion_rate d.rate = d.base_rate / conversion_rate else: - # if no last purchase found, reset all values to 0 - for field in ("base_price_list_rate", "base_rate", - "price_list_rate", "rate", "discount_percentage"): - d.set(field, 0) + msgprint(_("Last purchase rate not found")) item_last_purchase_rate = frappe.db.get_value("Item", d.item_code, "last_purchase_rate") if item_last_purchase_rate: diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js index 6824013d68..5b97397a3c 100644 --- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js +++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js @@ -18,6 +18,10 @@ cur_frm.add_fetch("sales_order", "customer", "customer"); cur_frm.add_fetch("sales_order", "base_grand_total", "grand_total"); frappe.ui.form.on("Production Planning Tool", { + onload_post_render: function(frm) { + frm.get_field("items").grid.set_multiple_add("item_code", "planned_qty"); + }, + get_sales_orders: function(frm) { frappe.call({ doc: frm.doc, diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py index 90a2cb289c..6e1dafe26d 100644 --- a/erpnext/projects/doctype/project/project.py +++ b/erpnext/projects/doctype/project/project.py @@ -126,7 +126,7 @@ class Project(Document): self.total_purchase_cost = total_purchase_cost and total_purchase_cost[0][0] or 0 def send_welcome_email(self): - url = get_url("/project/{0}".format(self.name)) + url = get_url("/project/?name={0}".format(self.name)) messages = ( _("You have been invited to collaborate on the project: {0}".format(self.name)), url, @@ -140,7 +140,6 @@ class Project(Document): for user in self.users: if user.welcome_email_sent==0: - print user.welcome_email_sent frappe.sendmail(user.user, subject=_("Project Collaboration Invitation"), content=content.format(*messages), bulk=True) user.welcome_email_sent=1 diff --git a/erpnext/templates/pages/projects.js b/erpnext/templates/pages/projects.js index de9cb76bf4..ecacc34fb8 100644 --- a/erpnext/templates/pages/projects.js +++ b/erpnext/templates/pages/projects.js @@ -19,23 +19,6 @@ frappe.ready(function() { } }) - // - // $('.btn-closed-tasks').click(function() { - // reload_items('closed','tasks'); - // }); - // - // $('.btn-open-tasks').click(function() { - // reload_items('open','tasks'); - // }); - // - // $('.btn-closed-issues').click(function() { - // reload_items('closed','issues'); - // }); - // - // $('.btn-open-issues').click(function() { - // reload_items('open','issues'); - // }); - var start = 10; $(".more-tasks").click(function() { more_items('task', true); @@ -66,7 +49,6 @@ frappe.ready(function() { }, dataType: "json", success: function(data) { - console.log(data.message); if(typeof data.message == 'undefined') { $('.project-'+ item).html("No "+ item_status +" "+ item); $(".more-"+ item).toggle(false);