mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 07:29:22 +00:00
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
This commit is contained in:
@@ -137,8 +137,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(
|
||||||
|
|||||||
@@ -64,6 +64,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",
|
||||||
@@ -577,6 +578,14 @@
|
|||||||
"fieldname": "get_balance_for_periodic_accounting",
|
"fieldname": "get_balance_for_periodic_accounting",
|
||||||
"fieldtype": "Button",
|
"fieldtype": "Button",
|
||||||
"label": "Get Balance"
|
"label": "Get Balance"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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",
|
||||||
@@ -591,7 +600,7 @@
|
|||||||
"table_fieldname": "payment_entries"
|
"table_fieldname": "payment_entries"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2025-07-06 15:22:58.465131",
|
"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):
|
|||||||
mode_of_payment: DF.Link | None
|
mode_of_payment: DF.Link | None
|
||||||
multi_currency: DF.Check
|
multi_currency: DF.Check
|
||||||
naming_series: DF.Literal["ACC-JV-.YYYY.-"]
|
naming_series: DF.Literal["ACC-JV-.YYYY.-"]
|
||||||
|
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
|
||||||
periodic_entry_difference_account: DF.Link | None
|
periodic_entry_difference_account: DF.Link | None
|
||||||
@@ -645,10 +646,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}"
|
||||||
@@ -1240,6 +1241,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,
|
||||||
@@ -1267,6 +1273,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))
|
||||||
|
|
||||||
|
|||||||
@@ -285,7 +285,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