Fixes in Production Planning Tool
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 3bb9aa0..5b2f348 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -369,15 +369,15 @@
}
cur_frm.cscript.income_account = function(doc, cdt, cdn) {
- cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "income_account");
+ erpnext.utils.copy_value_in_all_row(doc, cdt, cdn, "items", "income_account");
}
cur_frm.cscript.expense_account = function(doc, cdt, cdn) {
- cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "expense_account");
+ erpnext.utils.copy_value_in_all_row(doc, cdt, cdn, "items", "expense_account");
}
cur_frm.cscript.cost_center = function(doc, cdt, cdn) {
- cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "cost_center");
+ erpnext.utils.copy_value_in_all_row(doc, cdt, cdn, "items", "cost_center");
}
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index 7c338cd..250286c 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -83,9 +83,8 @@
"contact_designation": None,
"contact_department": None
})
- return
-
- out.update(get_contact_details(out.contact_person))
+ else:
+ out.update(get_contact_details(out.contact_person))
def set_other_values(out, party, party_type):
# copy
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index c4c28e4..20edbca 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -249,7 +249,7 @@
cur_frm.cscript.schedule_date = function(doc, cdt, cdn) {
- cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "schedule_date");
+ erpnext.utils.copy_value_in_all_row(doc, cdt, cdn, "items", "schedule_date");
}
frappe.provide("erpnext.buying");
diff --git a/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.json b/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.json
index 2acdbb7..2c56569 100644
--- a/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.json
+++ b/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.json
@@ -43,12 +43,13 @@
"width": "100px"
},
{
- "default": "now",
+ "default": "",
"fieldname": "planned_start_date",
"fieldtype": "Datetime",
"label": "Planned Start Date",
"permlevel": 0,
- "precision": ""
+ "precision": "",
+ "reqd": 1
},
{
"fieldname": "sales_order",
@@ -112,7 +113,7 @@
],
"idx": 1,
"istable": 1,
- "modified": "2015-07-07 07:52:40.883761",
+ "modified": "2015-07-08 07:12:11.211808",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Plan Item",
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 4f77132..f3b918d 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js
@@ -1,6 +1,8 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
+frappe.require("assets/erpnext/js/utils.js");
+
cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.set_value("company", frappe.defaults.get_user_default("company"))
cur_frm.set_value("use_multi_level_bom", 1)
@@ -72,3 +74,7 @@
cur_frm.fields_dict.sales_orders.grid.get_field("customer").get_query =
cur_frm.fields_dict.customer.get_query;
+
+cur_frm.cscript.planned_start_date = function(doc, cdt, cdn) {
+ erpnext.utils.copy_value_in_all_row(doc, cdt, cdn, "items", "planned_start_date");
+}
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
index df5a0e1..86a14d8 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -3,7 +3,7 @@
from __future__ import unicode_literals
import frappe
-from frappe.utils import cstr, flt, cint, nowdate, now, add_days, comma_and
+from frappe.utils import cstr, flt, cint, nowdate, add_days, comma_and
from frappe import msgprint, _
@@ -153,7 +153,6 @@
pi.bom_no = item_details and item_details[0][2] or ''
pi.so_pending_qty = flt(p['pending_qty'])
pi.planned_qty = flt(p['pending_qty'])
- pi.planned_start_date = now()
def validate_data(self):
self.validate_company()
diff --git a/erpnext/public/js/controllers/stock_controller.js b/erpnext/public/js/controllers/stock_controller.js
index 1d62b3a..c5cad95 100644
--- a/erpnext/public/js/controllers/stock_controller.js
+++ b/erpnext/public/js/controllers/stock_controller.js
@@ -70,16 +70,5 @@
frappe.set_route("query-report", "General Ledger");
}, "icon-table");
}
- },
-
- copy_account_in_all_row: function(doc, dt, dn, fieldname) {
- var d = locals[dt][dn];
- if(d[fieldname]){
- var cl = doc["items"] || [];
- for(var i = 0; i < cl.length; i++) {
- if(!cl[i][fieldname]) cl[i][fieldname] = d[fieldname];
- }
- }
- refresh_field("items");
}
});
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index dc74a3a..5b38559 100644
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -131,6 +131,17 @@
}
);
}
+ },
+
+ copy_value_in_all_row: function(doc, dt, dn, table_fieldname, fieldname) {
+ var d = locals[dt][dn];
+ if(d[fieldname]){
+ var cl = doc[table_fieldname] || [];
+ for(var i = 0; i < cl.length; i++) {
+ if(!cl[i][fieldname]) cl[i][fieldname] = d[fieldname];
+ }
+ }
+ refresh_field(table_fieldname);
}
});
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 465b641..1c9dbe4 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -519,11 +519,11 @@
}
cur_frm.cscript.expense_account = function(doc, cdt, cdn) {
- cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "expense_account");
+ erpnext.utils.copy_value_in_all_row(doc, cdt, cdn, "expense_account");
}
cur_frm.cscript.cost_center = function(doc, cdt, cdn) {
- cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "cost_center");
+ erpnext.utils.copy_value_in_all_row(doc, cdt, cdn, "cost_center");
}
cur_frm.fields_dict.customer.get_query = function(doc, cdt, cdn) {