[DN][usability] copy cost center in each row
diff --git a/controllers/buying_controller.py b/controllers/buying_controller.py
index 85d8b9d..94e3d56 100644
--- a/controllers/buying_controller.py
+++ b/controllers/buying_controller.py
@@ -47,7 +47,7 @@
items = [d.item_code for d in self.doclist.get({"parentfield": self.fname})]
if self.stock_items and len(items) > len(self.stock_items):
nonstock_items = list(set(items) - set(self.stock_items))
- webnotes.msgprint(_("Stock and non-stock items can not be entered at the same ") +
+ webnotes.msgprint(_("Stock and non-stock items can not be entered in the same ") +
self.doc.doctype + _(""". You should make separate documents for them.
Stock Items: """) + ", ".join(self.stock_items) + _("""
Non-stock Items: """) + ", ".join(nonstock_items), raise_exception=1)
diff --git a/stock/doctype/delivery_note/delivery_note.js b/stock/doctype/delivery_note/delivery_note.js
index 8d09cbd..0a31dfe 100644
--- a/stock/doctype/delivery_note/delivery_note.js
+++ b/stock/doctype/delivery_note/delivery_note.js
@@ -326,6 +326,17 @@
}
// cost center
+ cur_frm.cscript.cost_center = function(doc, cdt, cdn){
+ var d = locals[cdt][cdn];
+ if(d.cost_center) {
+ var cl = getchildren('Delivery Note Item', doc.name, cur_frm.cscript.fname, doc.doctype);
+ for(var i = 0; i < cl.length; i++){
+ if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
+ }
+ }
+ refresh_field(cur_frm.cscript.fname);
+ }
+
cur_frm.fields_dict.delivery_note_details.grid.get_field("cost_center").get_query = function(doc) {
return {
query: "accounts.utils.get_cost_center_list",