Skip to content

Commit

Permalink
refactor: for non-repost fields, don't validate
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthra-kumar committed Oct 11, 2023
1 parent cea0d65 commit c1782c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,9 @@ def on_update_after_submit(self):
]
child_tables = {"items": ("expense_account",), "taxes": ("account_head",)}
self.needs_repost = self.check_if_fields_updated(fields_to_check, child_tables)
self.validate_for_repost()
self.db_set("repost_required", self.needs_repost)
if self.needs_repost:
self.validate_for_repost()
self.db_set("repost_required", self.needs_repost)

def make_gl_entries(self, gl_entries=None, from_repost=False):
if not gl_entries:
Expand Down
5 changes: 3 additions & 2 deletions erpnext/accounts/doctype/sales_invoice/sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,9 @@ def on_update_after_submit(self):
"taxes": ("account_head",),
}
self.needs_repost = self.check_if_fields_updated(fields_to_check, child_tables)
self.validate_for_repost()
self.db_set("repost_required", self.needs_repost)
if self.needs_repost:
self.validate_for_repost()
self.db_set("repost_required", self.needs_repost)

def set_paid_amount(self):
paid_amount = 0.0
Expand Down

0 comments on commit c1782c5

Please sign in to comment.