refactor: remove party_balance

This commit is contained in:
ruthra kumar
2025-01-31 11:06:17 +05:30
parent e2b586d5a3
commit 1bb6cd33a3
3 changed files with 4 additions and 37 deletions

View File

@@ -374,7 +374,6 @@ frappe.ui.form.on("Payment Entry", {
frm.set_df_property("total_allocated_amount", "options", currency_field); frm.set_df_property("total_allocated_amount", "options", currency_field);
frm.set_df_property("unallocated_amount", "options", currency_field); frm.set_df_property("unallocated_amount", "options", currency_field);
frm.set_df_property("total_taxes_and_charges", "options", currency_field); frm.set_df_property("total_taxes_and_charges", "options", currency_field);
frm.set_df_property("party_balance", "options", currency_field);
frm.set_currency_labels( frm.set_currency_labels(
["total_amount", "outstanding_amount", "allocated_amount"], ["total_amount", "outstanding_amount", "allocated_amount"],
@@ -422,15 +421,7 @@ frappe.ui.form.on("Payment Entry", {
if (frm.doc.payment_type == "Internal Transfer") { if (frm.doc.payment_type == "Internal Transfer") {
$.each( $.each(
[ ["party", "party_type", "paid_from", "paid_to", "references", "total_allocated_amount"],
"party",
"party_type",
"party_balance",
"paid_from",
"paid_to",
"references",
"total_allocated_amount",
],
function (i, field) { function (i, field) {
frm.set_value(field, null); frm.set_value(field, null);
} }
@@ -478,7 +469,6 @@ frappe.ui.form.on("Payment Entry", {
$.each( $.each(
[ [
"party", "party",
"party_balance",
"paid_from", "paid_from",
"paid_to", "paid_to",
"paid_from_account_currency", "paid_from_account_currency",
@@ -539,7 +529,6 @@ frappe.ui.form.on("Payment Entry", {
frm.set_value("paid_to_account_balance", r.message.account_balance); frm.set_value("paid_to_account_balance", r.message.account_balance);
} }
}, },
() => frm.set_value("party_balance", r.message.party_balance),
() => frm.set_value("party_name", r.message.party_name), () => frm.set_value("party_name", r.message.party_name),
() => frm.clear_table("references"), () => frm.clear_table("references"),
() => frm.events.hide_unhide_fields(frm), () => frm.events.hide_unhide_fields(frm),
@@ -1692,7 +1681,6 @@ frappe.ui.form.on("Payment Entry", {
r.message.paid_from_account_balance r.message.paid_from_account_balance
); );
frm.set_value("paid_to_account_balance", r.message.paid_to_account_balance); frm.set_value("paid_to_account_balance", r.message.paid_to_account_balance);
frm.set_value("party_balance", r.message.party_balance);
}, },
]); ]);
} }

View File

@@ -28,7 +28,6 @@
"contact_person", "contact_person",
"contact_email", "contact_email",
"payment_accounts_section", "payment_accounts_section",
"party_balance",
"paid_from", "paid_from",
"paid_from_account_type", "paid_from_account_type",
"paid_from_account_currency", "paid_from_account_currency",
@@ -223,16 +222,6 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Accounts" "label": "Accounts"
}, },
{
"allow_on_submit": 1,
"depends_on": "party",
"fieldname": "party_balance",
"fieldtype": "Currency",
"label": "Party Balance",
"no_copy": 1,
"print_hide": 1,
"read_only": 1
},
{ {
"bold": 1, "bold": 1,
"depends_on": "eval:(in_list([\"Internal Transfer\", \"Pay\"], doc.payment_type) || doc.party)", "depends_on": "eval:(in_list([\"Internal Transfer\", \"Pay\"], doc.payment_type) || doc.party)",
@@ -810,7 +799,7 @@
"table_fieldname": "payment_entries" "table_fieldname": "payment_entries"
} }
], ],
"modified": "2025-01-31 17:27:28.555246", "modified": "2025-01-31 11:05:51.703592",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Payment Entry", "name": "Payment Entry",
@@ -856,4 +845,4 @@
"states": [], "states": [],
"title_field": "title", "title_field": "title",
"track_changes": 1 "track_changes": 1
} }

View File

@@ -116,7 +116,6 @@ class PaymentEntry(AccountsController):
paid_to_account_currency: DF.Link paid_to_account_currency: DF.Link
paid_to_account_type: DF.Data | None paid_to_account_type: DF.Data | None
party: DF.DynamicLink | None party: DF.DynamicLink | None
party_balance: DF.Currency
party_bank_account: DF.Link | None party_bank_account: DF.Link | None
party_name: DF.Data | None party_name: DF.Data | None
party_type: DF.Link | None party_type: DF.Link | None
@@ -506,7 +505,6 @@ class PaymentEntry(AccountsController):
if self.payment_type == "Internal Transfer": if self.payment_type == "Internal Transfer":
for field in ( for field in (
"party", "party",
"party_balance",
"total_allocated_amount", "total_allocated_amount",
"base_total_allocated_amount", "base_total_allocated_amount",
"unallocated_amount", "unallocated_amount",
@@ -534,10 +532,6 @@ class PaymentEntry(AccountsController):
) )
else: else:
complete_contact_details(self) complete_contact_details(self)
if not self.party_balance:
self.party_balance = get_balance_on(
party_type=self.party_type, party=self.party, date=self.posting_date, company=self.company
)
if not self.party_account: if not self.party_account:
party_account = get_party_account(self.party_type, self.party, self.company) party_account = get_party_account(self.party_type, self.party, self.company)
@@ -2721,9 +2715,7 @@ def get_party_details(company, party_type, party, date, cost_center=None):
account_balance = get_balance_on(party_account, date, cost_center=cost_center) account_balance = get_balance_on(party_account, date, cost_center=cost_center)
_party_name = "title" if party_type == "Shareholder" else party_type.lower() + "_name" _party_name = "title" if party_type == "Shareholder" else party_type.lower() + "_name"
party_name = frappe.db.get_value(party_type, party, _party_name) party_name = frappe.db.get_value(party_type, party, _party_name)
party_balance = get_balance_on(
party_type=party_type, party=party, company=company, cost_center=cost_center
)
if party_type in ["Customer", "Supplier"]: if party_type in ["Customer", "Supplier"]:
party_bank_account = get_party_bank_account(party_type, party) party_bank_account = get_party_bank_account(party_type, party)
bank_account = get_default_company_bank_account(company, party_type, party) bank_account = get_default_company_bank_account(company, party_type, party)
@@ -2732,7 +2724,6 @@ def get_party_details(company, party_type, party, date, cost_center=None):
"party_account": party_account, "party_account": party_account,
"party_name": party_name, "party_name": party_name,
"party_account_currency": account_currency, "party_account_currency": account_currency,
"party_balance": party_balance,
"account_balance": account_balance, "account_balance": account_balance,
"party_bank_account": party_bank_account, "party_bank_account": party_bank_account,
"bank_account": bank_account, "bank_account": bank_account,
@@ -3564,7 +3555,6 @@ def get_party_and_account_balance(
): ):
return frappe._dict( return frappe._dict(
{ {
"party_balance": get_balance_on(party_type=ptype, party=pty, cost_center=cost_center),
"paid_from_account_balance": get_balance_on(paid_from, date, cost_center=cost_center), "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), "paid_to_account_balance": get_balance_on(paid_to, date=date, cost_center=cost_center),
} }