Merge pull request #41149 from frappe/mergify/bp/version-15-hotfix/pr-41147

refactor: better description and pop up on Advance accounts (backport #41147)
This commit is contained in:
ruthra kumar
2024-04-24 07:19:19 +05:30
committed by GitHub
4 changed files with 25 additions and 4 deletions

View File

@@ -6,7 +6,7 @@ import json
import frappe
from frappe import _, msgprint, scrub
from frappe.utils import cstr, flt, fmt_money, formatdate, get_link_to_form, nowdate
from frappe.utils import comma_and, cstr, flt, fmt_money, formatdate, get_link_to_form, nowdate
import erpnext
from erpnext.accounts.deferred_revenue import get_deferred_booking_accounts
@@ -146,6 +146,7 @@ class JournalEntry(AccountsController):
self.validate_empty_accounts_table()
self.validate_inter_company_accounts()
self.validate_depr_entry_voucher_type()
self.validate_advance_accounts()
if self.docstatus == 0:
self.apply_tax_withholding()
@@ -153,6 +154,20 @@ class JournalEntry(AccountsController):
if not self.title:
self.title = self.get_title()
def validate_advance_accounts(self):
journal_accounts = set([x.account for x in self.accounts])
advance_accounts = set()
advance_accounts.add(
frappe.get_cached_value("Company", self.company, "default_advance_received_account")
)
advance_accounts.add(frappe.get_cached_value("Company", self.company, "default_advance_paid_account"))
if advance_accounts_used := journal_accounts & advance_accounts:
frappe.msgprint(
_(
"Making Journal Entries against advance accounts: {0} is not recommended. These Journals won't be available for Reconciliation."
).format(frappe.bold(comma_and(advance_accounts_used)))
)
def validate_for_repost(self):
validate_docs_for_voucher_types(["Journal Entry"])
validate_docs_for_deferred_accounting([self.name], [])

View File

@@ -195,6 +195,8 @@
},
{
"depends_on": "eval:doc.party",
"description": "Only 'Payment Entries' made against this advance account are supported.",
"documentation_url": "https://docs.erpnext.com/docs/user/manual/en/advance-in-separate-party-account",
"fieldname": "default_advance_account",
"fieldtype": "Link",
"label": "Default Advance Account",
@@ -229,7 +231,7 @@
"is_virtual": 1,
"issingle": 1,
"links": [],
"modified": "2023-12-14 13:38:16.264013",
"modified": "2024-04-23 12:38:29.557315",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Reconciliation",

View File

@@ -707,6 +707,8 @@
},
{
"depends_on": "eval:doc.book_advance_payments_in_separate_party_account",
"description": "Only 'Payment Entries' made against this advance account are supported.",
"documentation_url": "https://docs.erpnext.com/docs/user/manual/en/advance-in-separate-party-account",
"fieldname": "default_advance_received_account",
"fieldtype": "Link",
"label": "Default Advance Received Account",
@@ -715,6 +717,8 @@
},
{
"depends_on": "eval:doc.book_advance_payments_in_separate_party_account",
"description": "Only 'Payment Entries' made against this advance account are supported.",
"documentation_url": "https://docs.erpnext.com/docs/user/manual/en/advance-in-separate-party-account",
"fieldname": "default_advance_paid_account",
"fieldtype": "Link",
"label": "Default Advance Paid Account",
@@ -782,7 +786,7 @@
"image_field": "company_logo",
"is_tree": 1,
"links": [],
"modified": "2023-09-10 21:53:13.860791",
"modified": "2024-04-23 12:38:33.173938",
"modified_by": "Administrator",
"module": "Setup",
"name": "Company",

View File

@@ -35,7 +35,7 @@ class Company(NestedSet):
auto_exchange_rate_revaluation: DF.Check
book_advance_payments_in_separate_party_account: DF.Check
capital_work_in_progress_account: DF.Link | None
chart_of_accounts: DF.Literal
chart_of_accounts: DF.Literal[None]
company_description: DF.TextEditor | None
company_logo: DF.AttachImage | None
company_name: DF.Data