refactor: exclude balance while setting acc details
This commit is contained in:
@@ -397,11 +397,11 @@ frappe.ui.form.on("Journal Entry Account", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
cost_center: function(frm, dt, dn) {
|
cost_center: function(frm, dt, dn) {
|
||||||
erpnext.journal_entry.set_account_balance(frm, dt, dn);
|
erpnext.journal_entry.set_account_details(frm, dt, dn);
|
||||||
},
|
},
|
||||||
|
|
||||||
account: function(frm, dt, dn) {
|
account: function(frm, dt, dn) {
|
||||||
erpnext.journal_entry.set_account_balance(frm, dt, dn);
|
erpnext.journal_entry.set_account_details(frm, dt, dn);
|
||||||
},
|
},
|
||||||
|
|
||||||
debit_in_account_currency: function(frm, cdt, cdn) {
|
debit_in_account_currency: function(frm, cdt, cdn) {
|
||||||
@@ -585,14 +585,14 @@ $.extend(erpnext.journal_entry, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$.extend(erpnext.journal_entry, {
|
$.extend(erpnext.journal_entry, {
|
||||||
set_account_balance: function(frm, dt, dn) {
|
set_account_details: function(frm, dt, dn) {
|
||||||
var d = locals[dt][dn];
|
var d = locals[dt][dn];
|
||||||
if(d.account) {
|
if(d.account) {
|
||||||
if(!frm.doc.company) frappe.throw(__("Please select Company first"));
|
if(!frm.doc.company) frappe.throw(__("Please select Company first"));
|
||||||
if(!frm.doc.posting_date) frappe.throw(__("Please select Posting Date first"));
|
if(!frm.doc.posting_date) frappe.throw(__("Please select Posting Date first"));
|
||||||
|
|
||||||
return frappe.call({
|
return frappe.call({
|
||||||
method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_account_balance_and_party_type",
|
method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_account_details_and_party_type",
|
||||||
args: {
|
args: {
|
||||||
account: d.account,
|
account: d.account,
|
||||||
date: frm.doc.posting_date,
|
date: frm.doc.posting_date,
|
||||||
@@ -600,7 +600,6 @@ $.extend(erpnext.journal_entry, {
|
|||||||
debit: flt(d.debit_in_account_currency),
|
debit: flt(d.debit_in_account_currency),
|
||||||
credit: flt(d.credit_in_account_currency),
|
credit: flt(d.credit_in_account_currency),
|
||||||
exchange_rate: d.exchange_rate,
|
exchange_rate: d.exchange_rate,
|
||||||
cost_center: d.cost_center
|
|
||||||
},
|
},
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if(r.message) {
|
if(r.message) {
|
||||||
|
|||||||
@@ -1425,8 +1425,8 @@ def get_party_account_and_balance(company, party_type, party, cost_center=None):
|
|||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_account_balance_and_party_type(
|
def get_account_details_and_party_type(
|
||||||
account, date, company, debit=None, credit=None, exchange_rate=None, cost_center=None
|
account, date, company, debit=None, credit=None, exchange_rate=None
|
||||||
):
|
):
|
||||||
"""Returns dict of account balance and party type to be set in Journal Entry on selection of account."""
|
"""Returns dict of account balance and party type to be set in Journal Entry on selection of account."""
|
||||||
if not frappe.has_permission("Account"):
|
if not frappe.has_permission("Account"):
|
||||||
@@ -1448,7 +1448,6 @@ def get_account_balance_and_party_type(
|
|||||||
party_type = ""
|
party_type = ""
|
||||||
|
|
||||||
grid_values = {
|
grid_values = {
|
||||||
"balance": get_balance_on(account, date, cost_center=cost_center),
|
|
||||||
"party_type": party_type,
|
"party_type": party_type,
|
||||||
"account_type": account_details.account_type,
|
"account_type": account_details.account_type,
|
||||||
"account_currency": account_details.account_currency or company_currency,
|
"account_currency": account_details.account_currency or company_currency,
|
||||||
|
|||||||
Reference in New Issue
Block a user