Skip to content

Commit

Permalink
feat: validate before allowing repost
Browse files Browse the repository at this point in the history
  • Loading branch information
GursheenK committed Mar 3, 2024
1 parent a512ec7 commit 8585cfc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions erpnext/accounts/doctype/journal_entry/journal_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ def validate(self):
if not self.title:
self.title = self.get_title()

def validate_for_repost(self):
self.validate_party()
self.validate_multi_currency()
if not frappe.flags.is_reverse_depr_entry:
self.validate_against_jv()
self.validate_stock_accounts()

def submit(self):
if len(self.accounts) > 100:
msgprint(_("The task has been enqueued as a background job."), alert=True)
Expand Down Expand Up @@ -176,6 +183,7 @@ def on_update_after_submit(self):
if hasattr(self, "repost_required"):
child_tables = {"accounts": ("account", "account_type", "bank_account")}
self.needs_repost = self.check_if_fields_updated([], child_tables)
self.validate_for_repost()
self.db_set("repost_required", self.needs_repost)

def on_cancel(self):
Expand Down

0 comments on commit 8585cfc

Please sign in to comment.