copy expense account to all row if entered in one
This commit is contained in:
parent
e28efd8dc8
commit
495db08104
@ -421,17 +421,24 @@ cur_frm.fields_dict.delivery_note_main.get_query = function(doc) {
|
|||||||
|
|
||||||
|
|
||||||
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.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];
|
var d = locals[cdt][cdn];
|
||||||
if(d.income_account){
|
if(d[fieldname]){
|
||||||
var cl = getchildren('Sales Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
|
var cl = getchildren('Sales Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
|
||||||
for(var i = 0; i < cl.length; i++){
|
for(var i = 0; i < cl.length; i++){
|
||||||
if(!cl[i].income_account) cl[i].income_account = d.income_account;
|
if(!cl[i][fieldname]) cl[i][fieldname] = d[fieldname];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
refresh_field(cur_frm.cscript.fname);
|
refresh_field(cur_frm.cscript.fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cur_frm.cscript.cost_center = function(doc, cdt, cdn){
|
cur_frm.cscript.cost_center = function(doc, cdt, cdn){
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if(d.cost_center){
|
if(d.cost_center){
|
||||||
@ -443,10 +450,6 @@ cur_frm.cscript.cost_center = function(doc, cdt, cdn){
|
|||||||
refresh_field(cur_frm.cscript.fname);
|
refresh_field(cur_frm.cscript.fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* **************************************** Utility Functions *************************************** */
|
|
||||||
|
|
||||||
// Details Calculation
|
|
||||||
// --------------------
|
|
||||||
cur_frm.cscript.calc_adjustment_amount = function(doc,cdt,cdn) {
|
cur_frm.cscript.calc_adjustment_amount = function(doc,cdt,cdn) {
|
||||||
var doc = locals[doc.doctype][doc.name];
|
var doc = locals[doc.doctype][doc.name];
|
||||||
var el = getchildren('Sales Invoice Advance',doc.name,'advance_adjustment_details');
|
var el = getchildren('Sales Invoice Advance',doc.name,'advance_adjustment_details');
|
||||||
|
|||||||
@ -310,6 +310,17 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.expense_account = function(doc, cdt, cdn){
|
||||||
|
var d = locals[cdt][cdn];
|
||||||
|
if(d.expense_account) {
|
||||||
|
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].expense_account) cl[i].expense_account = d.expense_account;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
refresh_field(cur_frm.cscript.fname);
|
||||||
|
}
|
||||||
|
|
||||||
// expense account
|
// expense account
|
||||||
cur_frm.fields_dict['delivery_note_details'].grid.get_field('expense_account').get_query = function(doc) {
|
cur_frm.fields_dict['delivery_note_details'].grid.get_field('expense_account').get_query = function(doc) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user