Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Nabin Hait
2013-10-15 16:55:54 +05:30
6 changed files with 73 additions and 55 deletions

View File

@@ -349,7 +349,7 @@ if (sys_defaults.auto_accounting_for_stock) {
// warehouse in detail table
//----------------------------
cur_frm.fields_dict['entries'].grid.get_field('warehouse').get_query= function(doc, cdt, cdn) {
cur_frm.fields_dict['entries'].grid.get_field('warehouse').get_query = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
return{
filters:[
@@ -370,34 +370,16 @@ cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = functio
}
}
cur_frm.cscript.income_account = function(doc, cdt, cdn){
cur_frm.cscript.income_account = function(doc, cdt, cdn) {
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "income_account");
}
cur_frm.cscript.expense_account = function(doc, cdt, cdn){
cur_frm.cscript.expense_account = function(doc, cdt, cdn) {
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "expense_account");
}
cur_frm.cscript.copy_account_in_all_row = function(doc, cdt, cdn, fieldname) {
var d = locals[cdt][cdn];
if(d[fieldname]){
var cl = getchildren('Sales Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
for(var i = 0; i < cl.length; i++){
if(!cl[i][fieldname]) cl[i][fieldname] = d[fieldname];
}
}
refresh_field(cur_frm.cscript.fname);
}
cur_frm.cscript.cost_center = function(doc, cdt, cdn){
var d = locals[cdt][cdn];
if(d.cost_center){
var cl = getchildren('Sales Invoice 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.cscript.cost_center = function(doc, cdt, cdn) {
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "cost_center");
}
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {