mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 11:19:09 +00:00
refactor: remove paid_to_account_balance
This commit is contained in:
@@ -523,7 +523,6 @@ frappe.ui.form.on("Payment Entry", {
|
|||||||
"paid_to_account_currency",
|
"paid_to_account_currency",
|
||||||
r.message.party_account_currency
|
r.message.party_account_currency
|
||||||
);
|
);
|
||||||
frm.set_value("paid_to_account_balance", r.message.account_balance);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
() => frm.set_value("party_name", r.message.party_name),
|
() => frm.set_value("party_name", r.message.party_name),
|
||||||
@@ -592,7 +591,6 @@ frappe.ui.form.on("Payment Entry", {
|
|||||||
frm,
|
frm,
|
||||||
frm.doc.paid_to,
|
frm.doc.paid_to,
|
||||||
"paid_to_account_currency",
|
"paid_to_account_currency",
|
||||||
"paid_to_account_balance",
|
|
||||||
function (frm) {
|
function (frm) {
|
||||||
if (frm.doc.payment_type == "Receive") {
|
if (frm.doc.payment_type == "Receive") {
|
||||||
if (frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency) {
|
if (frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency) {
|
||||||
@@ -1647,32 +1645,6 @@ frappe.ui.form.on("Payment Entry", {
|
|||||||
return current_tax_amount;
|
return current_tax_amount;
|
||||||
},
|
},
|
||||||
|
|
||||||
cost_center: function (frm) {
|
|
||||||
if (frm.doc.posting_date && (frm.doc.paid_from || frm.doc.paid_to)) {
|
|
||||||
return frappe.call({
|
|
||||||
method: "erpnext.accounts.doctype.payment_entry.payment_entry.get_party_and_account_balance",
|
|
||||||
args: {
|
|
||||||
company: frm.doc.company,
|
|
||||||
date: frm.doc.posting_date,
|
|
||||||
paid_from: frm.doc.paid_from,
|
|
||||||
paid_to: frm.doc.paid_to,
|
|
||||||
ptype: frm.doc.party_type,
|
|
||||||
pty: frm.doc.party,
|
|
||||||
cost_center: frm.doc.cost_center,
|
|
||||||
},
|
|
||||||
callback: function (r, rt) {
|
|
||||||
if (r.message) {
|
|
||||||
frappe.run_serially([
|
|
||||||
() => {
|
|
||||||
frm.set_value("paid_to_account_balance", r.message.paid_to_account_balance);
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
after_save: function (frm) {
|
after_save: function (frm) {
|
||||||
const { matched_payment_requests } = frappe.last_response;
|
const { matched_payment_requests } = frappe.last_response;
|
||||||
if (!matched_payment_requests) return;
|
if (!matched_payment_requests) return;
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
"paid_to",
|
"paid_to",
|
||||||
"paid_to_account_type",
|
"paid_to_account_type",
|
||||||
"paid_to_account_currency",
|
"paid_to_account_currency",
|
||||||
"paid_to_account_balance",
|
|
||||||
"payment_amounts_section",
|
"payment_amounts_section",
|
||||||
"paid_amount",
|
"paid_amount",
|
||||||
"paid_amount_after_tax",
|
"paid_amount_after_tax",
|
||||||
@@ -266,16 +265,6 @@
|
|||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"allow_on_submit": 1,
|
|
||||||
"depends_on": "paid_to",
|
|
||||||
"fieldname": "paid_to_account_balance",
|
|
||||||
"fieldtype": "Currency",
|
|
||||||
"label": "Account Balance (To)",
|
|
||||||
"options": "paid_to_account_currency",
|
|
||||||
"print_hide": 1,
|
|
||||||
"read_only": 1
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"depends_on": "eval:(doc.paid_to && doc.paid_from)",
|
"depends_on": "eval:(doc.paid_to && doc.paid_from)",
|
||||||
"fieldname": "payment_amounts_section",
|
"fieldname": "payment_amounts_section",
|
||||||
@@ -788,7 +777,7 @@
|
|||||||
"table_fieldname": "payment_entries"
|
"table_fieldname": "payment_entries"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2025-01-31 11:17:52.292641",
|
"modified": "2025-01-31 11:24:58.076393",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Payment Entry",
|
"name": "Payment Entry",
|
||||||
|
|||||||
@@ -111,7 +111,6 @@ class PaymentEntry(AccountsController):
|
|||||||
paid_from_account_currency: DF.Link
|
paid_from_account_currency: DF.Link
|
||||||
paid_from_account_type: DF.Data | None
|
paid_from_account_type: DF.Data | None
|
||||||
paid_to: DF.Link
|
paid_to: DF.Link
|
||||||
paid_to_account_balance: DF.Currency
|
|
||||||
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
|
||||||
@@ -541,10 +540,9 @@ class PaymentEntry(AccountsController):
|
|||||||
acc = get_account_details(self.paid_from, self.posting_date, self.cost_center)
|
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_currency = acc.account_currency
|
||||||
|
|
||||||
if self.paid_to and not self.paid_to_account_currency and not self.paid_to_account_balance:
|
if self.paid_to and not self.paid_to_account_currency:
|
||||||
acc = get_account_details(self.paid_to, self.posting_date, self.cost_center)
|
acc = get_account_details(self.paid_to, self.posting_date, self.cost_center)
|
||||||
self.paid_to_account_currency = acc.account_currency
|
self.paid_to_account_currency = acc.account_currency
|
||||||
self.paid_to_account_balance = acc.account_balance
|
|
||||||
|
|
||||||
self.party_account_currency = (
|
self.party_account_currency = (
|
||||||
self.paid_from_account_currency
|
self.paid_from_account_currency
|
||||||
@@ -3547,17 +3545,6 @@ def get_paid_amount(dt, dn, party_type, party, account, due_date):
|
|||||||
return paid_amount[0][0] if paid_amount else 0
|
return paid_amount[0][0] if paid_amount else 0
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
|
||||||
def get_party_and_account_balance(
|
|
||||||
company, date, paid_from=None, paid_to=None, ptype=None, pty=None, cost_center=None
|
|
||||||
):
|
|
||||||
return frappe._dict(
|
|
||||||
{
|
|
||||||
"paid_to_account_balance": get_balance_on(paid_to, date=date, cost_center=cost_center),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_payment_order(source_name, target_doc=None):
|
def make_payment_order(source_name, target_doc=None):
|
||||||
from frappe.model.mapper import get_mapped_doc
|
from frappe.model.mapper import get_mapped_doc
|
||||||
|
|||||||
Reference in New Issue
Block a user