fix: set cost center in child table
This commit is contained in:
parent
934e30ecac
commit
402c347f83
@ -243,7 +243,6 @@ frappe.ui.form.on("Expense Claim", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
update_employee_advance_claimed_amount: function(frm) {
|
update_employee_advance_claimed_amount: function(frm) {
|
||||||
console.log("update_employee_advance_claimed_amount")
|
|
||||||
let amount_to_be_allocated = frm.doc.grand_total;
|
let amount_to_be_allocated = frm.doc.grand_total;
|
||||||
$.each(frm.doc.advances || [], function(i, advance){
|
$.each(frm.doc.advances || [], function(i, advance){
|
||||||
if (amount_to_be_allocated >= advance.unclaimed_amount){
|
if (amount_to_be_allocated >= advance.unclaimed_amount){
|
||||||
@ -295,6 +294,16 @@ frappe.ui.form.on("Expense Claim", {
|
|||||||
frm.events.get_advances(frm);
|
frm.events.get_advances(frm);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
cost_center: function(frm) {
|
||||||
|
frm.events.set_child_cost_center(frm);
|
||||||
|
},
|
||||||
|
set_child_cost_center: function(frm){
|
||||||
|
(frm.doc.expenses || []).forEach(function(d) {
|
||||||
|
if (!d.cost_center){
|
||||||
|
d.cost_center = frm.doc.cost_center;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
get_taxes: function(frm) {
|
get_taxes: function(frm) {
|
||||||
if(frm.doc.taxes) {
|
if(frm.doc.taxes) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
@ -338,8 +347,7 @@ frappe.ui.form.on("Expense Claim", {
|
|||||||
|
|
||||||
frappe.ui.form.on("Expense Claim Detail", {
|
frappe.ui.form.on("Expense Claim Detail", {
|
||||||
expenses_add: function(frm, cdt, cdn) {
|
expenses_add: function(frm, cdt, cdn) {
|
||||||
var row = frappe.get_doc(cdt, cdn);
|
frm.events.set_child_cost_center(frm);
|
||||||
frm.script_manager.copy_from_first_row("expenses", row, ["cost_center"]);
|
|
||||||
},
|
},
|
||||||
amount: function(frm, cdt, cdn) {
|
amount: function(frm, cdt, cdn) {
|
||||||
var child = locals[cdt][cdn];
|
var child = locals[cdt][cdn];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user