[DN][usability] copy cost center in each row

This commit is contained in:
Nabin Hait 2013-04-26 16:27:51 +05:30
parent 205f7ce620
commit 04c1f94b4e
2 changed files with 12 additions and 1 deletions

View File

@ -47,7 +47,7 @@ class BuyingController(StockController):
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)

View File

@ -326,6 +326,17 @@ if (sys_defaults.auto_inventory_accounting) {
}
// 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",