mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-18 17:55:40 +00:00
fix: skip party validation for payroll & it's journal & GL entry submission (backport #49638) (#49826)
* fix: skip party validation for payroll & it's journal & GL entry submission (#49638)
* fix: skip validation for manual je & gl submission linked with payroll entry
* refactor: change condition
* fix: add checkbox in jouranl entry account and passed it true from payroll to skip party validation
* refactor: add checkbox to skip party validation in journal entry
(cherry picked from commit 35474d997d)
# Conflicts:
# erpnext/accounts/doctype/journal_entry/journal_entry.json
# erpnext/accounts/doctype/journal_entry/journal_entry.py
* fix: conflicts raised because of cherry pick while backporting
* fix: conflicts
---------
Co-authored-by: Raheel Khan <raheel@frappe.io>
This commit is contained in:
@@ -131,8 +131,8 @@ class GLEntry(Document):
|
|||||||
|
|
||||||
if not self.is_cancelled and not (self.party_type and self.party):
|
if not self.is_cancelled and not (self.party_type and self.party):
|
||||||
account_type = frappe.get_cached_value("Account", self.account, "account_type")
|
account_type = frappe.get_cached_value("Account", self.account, "account_type")
|
||||||
# skipping validation for payroll entry creation in case party is not required
|
|
||||||
if not frappe.flags.party_not_required_for_receivable_payable:
|
if not frappe.flags.party_not_required: # skipping validation if party is not required
|
||||||
if account_type == "Receivable":
|
if account_type == "Receivable":
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_("{0} {1}: Customer is required against Receivable account {2}").format(
|
_("{0} {1}: Customer is required against Receivable account {2}").format(
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
"addtional_info",
|
"addtional_info",
|
||||||
"mode_of_payment",
|
"mode_of_payment",
|
||||||
"payment_order",
|
"payment_order",
|
||||||
|
"party_not_required",
|
||||||
"column_break3",
|
"column_break3",
|
||||||
"is_opening",
|
"is_opening",
|
||||||
"stock_entry",
|
"stock_entry",
|
||||||
@@ -543,6 +544,14 @@
|
|||||||
"label": "Is System Generated",
|
"label": "Is System Generated",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "party_not_required",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"hidden": 1,
|
||||||
|
"label": "Party Not Required",
|
||||||
|
"no_copy": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-file-text",
|
"icon": "fa fa-file-text",
|
||||||
@@ -557,7 +566,7 @@
|
|||||||
"table_fieldname": "payment_entries"
|
"table_fieldname": "payment_entries"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2024-07-18 15:32:29.413598",
|
"modified": "2025-09-29 13:05:46.982277",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Journal Entry",
|
"name": "Journal Entry",
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ class JournalEntry(AccountsController):
|
|||||||
multi_currency: DF.Check
|
multi_currency: DF.Check
|
||||||
naming_series: DF.Literal["ACC-JV-.YYYY.-"]
|
naming_series: DF.Literal["ACC-JV-.YYYY.-"]
|
||||||
paid_loan: DF.Data | None
|
paid_loan: DF.Data | None
|
||||||
|
party_not_required: DF.Check
|
||||||
pay_to_recd_from: DF.Data | None
|
pay_to_recd_from: DF.Data | None
|
||||||
payment_order: DF.Link | None
|
payment_order: DF.Link | None
|
||||||
posting_date: DF.Date
|
posting_date: DF.Date
|
||||||
@@ -543,10 +544,10 @@ class JournalEntry(AccountsController):
|
|||||||
for d in self.get("accounts"):
|
for d in self.get("accounts"):
|
||||||
account_type = frappe.get_cached_value("Account", d.account, "account_type")
|
account_type = frappe.get_cached_value("Account", d.account, "account_type")
|
||||||
|
|
||||||
# skipping validation for payroll entry creation
|
|
||||||
skip_validation = frappe.flags.party_not_required_for_receivable_payable
|
|
||||||
if account_type in ["Receivable", "Payable"]:
|
if account_type in ["Receivable", "Payable"]:
|
||||||
if not (d.party_type and d.party) and not skip_validation:
|
if (
|
||||||
|
not (d.party_type and d.party) and not self.party_not_required
|
||||||
|
): # skipping validation if party_not_required is passed via payroll entry
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_(
|
_(
|
||||||
"Row {0}: Party Type and Party is required for Receivable / Payable account {1}"
|
"Row {0}: Party Type and Party is required for Receivable / Payable account {1}"
|
||||||
@@ -1139,6 +1140,11 @@ class JournalEntry(AccountsController):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# set flag to skip party validation
|
||||||
|
account_type = frappe.get_cached_value("Account", d.account, "account_type")
|
||||||
|
if account_type in ["Receivable", "Payable"] and self.party_not_required:
|
||||||
|
frappe.flags.party_not_required = True
|
||||||
|
|
||||||
gl_map.append(
|
gl_map.append(
|
||||||
self.get_gl_dict(
|
self.get_gl_dict(
|
||||||
row,
|
row,
|
||||||
@@ -1166,6 +1172,7 @@ class JournalEntry(AccountsController):
|
|||||||
merge_entries=merge_entries,
|
merge_entries=merge_entries,
|
||||||
update_outstanding=update_outstanding,
|
update_outstanding=update_outstanding,
|
||||||
)
|
)
|
||||||
|
frappe.flags.party_not_required = False
|
||||||
if cancel:
|
if cancel:
|
||||||
cancel_exchange_gain_loss_journal(frappe._dict(doctype=self.doctype, name=self.name))
|
cancel_exchange_gain_loss_journal(frappe._dict(doctype=self.doctype, name=self.name))
|
||||||
|
|
||||||
|
|||||||
@@ -286,7 +286,7 @@
|
|||||||
"idx": 1,
|
"idx": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-07-25 04:45:28.117715",
|
"modified": "2025-09-29 13:01:48.916517",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Journal Entry Account",
|
"name": "Journal Entry Account",
|
||||||
|
|||||||
Reference in New Issue
Block a user