mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 12:49:10 +00:00
Merge pull request #41147 from ruthra-kumar/better_description_and_validation
refactor: better description and pop up on Advance accounts
This commit is contained in:
@@ -6,7 +6,7 @@ import json
|
|||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _, msgprint, scrub
|
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
|
import erpnext
|
||||||
from erpnext.accounts.deferred_revenue import get_deferred_booking_accounts
|
from erpnext.accounts.deferred_revenue import get_deferred_booking_accounts
|
||||||
@@ -146,6 +146,7 @@ class JournalEntry(AccountsController):
|
|||||||
self.validate_empty_accounts_table()
|
self.validate_empty_accounts_table()
|
||||||
self.validate_inter_company_accounts()
|
self.validate_inter_company_accounts()
|
||||||
self.validate_depr_entry_voucher_type()
|
self.validate_depr_entry_voucher_type()
|
||||||
|
self.validate_advance_accounts()
|
||||||
|
|
||||||
if self.docstatus == 0:
|
if self.docstatus == 0:
|
||||||
self.apply_tax_withholding()
|
self.apply_tax_withholding()
|
||||||
@@ -153,6 +154,20 @@ class JournalEntry(AccountsController):
|
|||||||
if not self.title:
|
if not self.title:
|
||||||
self.title = self.get_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):
|
def validate_for_repost(self):
|
||||||
validate_docs_for_voucher_types(["Journal Entry"])
|
validate_docs_for_voucher_types(["Journal Entry"])
|
||||||
validate_docs_for_deferred_accounting([self.name], [])
|
validate_docs_for_deferred_accounting([self.name], [])
|
||||||
|
|||||||
@@ -196,6 +196,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "eval:doc.party",
|
"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",
|
"fieldname": "default_advance_account",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Default Advance Account",
|
"label": "Default Advance Account",
|
||||||
@@ -230,7 +232,7 @@
|
|||||||
"is_virtual": 1,
|
"is_virtual": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2024-03-27 13:10:10.488007",
|
"modified": "2024-04-23 12:38:29.557315",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Payment Reconciliation",
|
"name": "Payment Reconciliation",
|
||||||
|
|||||||
@@ -691,6 +691,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "eval:doc.book_advance_payments_in_separate_party_account",
|
"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",
|
"fieldname": "default_advance_received_account",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Default Advance Received Account",
|
"label": "Default Advance Received Account",
|
||||||
@@ -699,6 +701,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "eval:doc.book_advance_payments_in_separate_party_account",
|
"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",
|
"fieldname": "default_advance_paid_account",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Default Advance Paid Account",
|
"label": "Default Advance Paid Account",
|
||||||
@@ -766,7 +770,7 @@
|
|||||||
"image_field": "company_logo",
|
"image_field": "company_logo",
|
||||||
"is_tree": 1,
|
"is_tree": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2024-03-27 13:06:45.374715",
|
"modified": "2024-04-23 12:38:33.173938",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Setup",
|
"module": "Setup",
|
||||||
"name": "Company",
|
"name": "Company",
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class Company(NestedSet):
|
|||||||
auto_exchange_rate_revaluation: DF.Check
|
auto_exchange_rate_revaluation: DF.Check
|
||||||
book_advance_payments_in_separate_party_account: DF.Check
|
book_advance_payments_in_separate_party_account: DF.Check
|
||||||
capital_work_in_progress_account: DF.Link | None
|
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_description: DF.TextEditor | None
|
||||||
company_logo: DF.AttachImage | None
|
company_logo: DF.AttachImage | None
|
||||||
company_name: DF.Data
|
company_name: DF.Data
|
||||||
|
|||||||
Reference in New Issue
Block a user