refactor: remove paid_from_account_balance

This commit is contained in:
ruthra kumar
2025-01-31 11:18:44 +05:30
parent 1bb6cd33a3
commit 9b5c4a0144
3 changed files with 3 additions and 33 deletions

View File

@@ -472,9 +472,7 @@ frappe.ui.form.on("Payment Entry", {
"paid_from",
"paid_to",
"paid_from_account_currency",
"paid_from_account_balance",
"paid_to_account_currency",
"paid_to_account_balance",
"references",
"total_allocated_amount",
],
@@ -519,7 +517,6 @@ frappe.ui.form.on("Payment Entry", {
"paid_from_account_currency",
r.message.party_account_currency
);
frm.set_value("paid_from_account_balance", r.message.account_balance);
} else if (frm.doc.payment_type == "Pay") {
frm.set_value("paid_to", r.message.party_account);
frm.set_value(
@@ -580,7 +577,6 @@ frappe.ui.form.on("Payment Entry", {
frm,
frm.doc.paid_from,
"paid_from_account_currency",
"paid_from_account_balance",
function (frm) {
if (frm.doc.payment_type == "Pay") {
frm.events.paid_amount(frm);
@@ -612,13 +608,7 @@ frappe.ui.form.on("Payment Entry", {
);
},
set_account_currency_and_balance: function (
frm,
account,
currency_field,
balance_field,
callback_function
) {
set_account_currency_and_balance: function (frm, account, currency_field, callback_function) {
var company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency;
if (frm.doc.posting_date && account) {
frappe.call({
@@ -633,8 +623,6 @@ frappe.ui.form.on("Payment Entry", {
frappe.run_serially([
() => frm.set_value(currency_field, r.message["account_currency"]),
() => {
frm.set_value(balance_field, r.message["account_balance"]);
if (
frm.doc.payment_type == "Receive" &&
currency_field == "paid_to_account_currency"
@@ -1676,10 +1664,6 @@ frappe.ui.form.on("Payment Entry", {
if (r.message) {
frappe.run_serially([
() => {
frm.set_value(
"paid_from_account_balance",
r.message.paid_from_account_balance
);
frm.set_value("paid_to_account_balance", r.message.paid_to_account_balance);
},
]);

View File

@@ -31,7 +31,6 @@
"paid_from",
"paid_from_account_type",
"paid_from_account_currency",
"paid_from_account_balance",
"column_break_18",
"paid_to",
"paid_to_account_type",
@@ -243,16 +242,6 @@
"read_only": 1,
"reqd": 1
},
{
"allow_on_submit": 1,
"depends_on": "paid_from",
"fieldname": "paid_from_account_balance",
"fieldtype": "Currency",
"label": "Account Balance (From)",
"options": "paid_from_account_currency",
"print_hide": 1,
"read_only": 1
},
{
"fieldname": "column_break_18",
"fieldtype": "Column Break"
@@ -799,7 +788,7 @@
"table_fieldname": "payment_entries"
}
],
"modified": "2025-01-31 11:05:51.703592",
"modified": "2025-01-31 11:17:52.292641",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Entry",

View File

@@ -108,7 +108,6 @@ class PaymentEntry(AccountsController):
paid_amount: DF.Currency
paid_amount_after_tax: DF.Currency
paid_from: DF.Link
paid_from_account_balance: DF.Currency
paid_from_account_currency: DF.Link
paid_from_account_type: DF.Data | None
paid_to: DF.Link
@@ -538,10 +537,9 @@ class PaymentEntry(AccountsController):
self.set(self.party_account_field, party_account)
self.party_account = party_account
if self.paid_from and not self.paid_from_account_currency and not self.paid_from_account_balance:
if self.paid_from and not self.paid_from_account_currency:
acc = get_account_details(self.paid_from, self.posting_date, self.cost_center)
self.paid_from_account_currency = acc.account_currency
self.paid_from_account_balance = acc.account_balance
if self.paid_to and not self.paid_to_account_currency and not self.paid_to_account_balance:
acc = get_account_details(self.paid_to, self.posting_date, self.cost_center)
@@ -3555,7 +3553,6 @@ def get_party_and_account_balance(
):
return frappe._dict(
{
"paid_from_account_balance": get_balance_on(paid_from, date, cost_center=cost_center),
"paid_to_account_balance": get_balance_on(paid_to, date=date, cost_center=cost_center),
}
)