Skip to content

Commit

Permalink
feat: update after submit in JV
Browse files Browse the repository at this point in the history
  • Loading branch information
GursheenK committed Mar 3, 2024
1 parent 6c3b5bb commit cdab3fa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
12 changes: 11 additions & 1 deletion erpnext/accounts/doctype/journal_entry/journal_entry.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
"stock_entry",
"subscription_section",
"auto_repeat",
"amended_from"
"amended_from",
"repost_required"
],
"fields": [
{
Expand Down Expand Up @@ -543,6 +544,15 @@
"label": "Is System Generated",
"no_copy": 1,
"read_only": 1
},
{
"default": "0",
"fieldname": "repost_required",
"fieldtype": "Check",
"hidden": 1,
"label": "Repost Required",
"print_hide": 1,
"read_only": 1
}
],
"icon": "fa fa-file-text",
Expand Down
6 changes: 6 additions & 0 deletions erpnext/accounts/doctype/journal_entry/journal_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ def on_submit(self):
self.update_inter_company_jv()
self.update_invoice_discounting()

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.db_set("repost_required", self.needs_repost)

def on_cancel(self):
# References for this Journal are removed on the `on_cancel` event in accounts_controller
super(JournalEntry, self).on_cancel()
Expand Down

0 comments on commit cdab3fa

Please sign in to comment.