mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-06 21:59:13 +00:00
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:
@@ -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], [])
|
||||||
|
|||||||
@@ -195,6 +195,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",
|
||||||
@@ -229,7 +231,7 @@
|
|||||||
"is_virtual": 1,
|
"is_virtual": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-12-14 13:38:16.264013",
|
"modified": "2024-04-23 12:38:29.557315",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Payment Reconciliation",
|
"name": "Payment Reconciliation",
|
||||||
|
|||||||
@@ -707,6 +707,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",
|
||||||
@@ -715,6 +717,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",
|
||||||
@@ -782,7 +786,7 @@
|
|||||||
"image_field": "company_logo",
|
"image_field": "company_logo",
|
||||||
"is_tree": 1,
|
"is_tree": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-09-10 21:53:13.860791",
|
"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