fix: take parent cost center for child if no cost center at child (#22496)
This commit is contained in:
parent
73edba0e10
commit
ba5f571b0d
@ -300,6 +300,11 @@ frappe.ui.form.on("Expense Claim", {
|
||||
cost_center: function(frm) {
|
||||
frm.events.set_child_cost_center(frm);
|
||||
},
|
||||
|
||||
validate: 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){
|
||||
@ -349,9 +354,6 @@ frappe.ui.form.on("Expense Claim", {
|
||||
});
|
||||
|
||||
frappe.ui.form.on("Expense Claim Detail", {
|
||||
expenses_add: function(frm, cdt, cdn) {
|
||||
frm.events.set_child_cost_center(frm);
|
||||
},
|
||||
amount: function(frm, cdt, cdn) {
|
||||
var child = locals[cdt][cdn];
|
||||
frappe.model.set_value(cdt, cdn, 'sanctioned_amount', child.amount);
|
||||
|
@ -129,7 +129,7 @@ class ExpenseClaim(AccountsController):
|
||||
"debit": data.sanctioned_amount,
|
||||
"debit_in_account_currency": data.sanctioned_amount,
|
||||
"against": self.employee,
|
||||
"cost_center": data.cost_center
|
||||
"cost_center": data.cost_center or self.cost_center
|
||||
}, item=data)
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user