diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 8944bca1db9fa73a7da3b456fa1533fb92ddaa05..bd1dc0f353081bf28378a7998fb6715fa6b1ee0e 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -209,6 +209,7 @@ class JournalEntry(AccountsController): if self.needs_repost: self.validate_for_repost() self.db_set("repost_required", self.needs_repost) + self.repost_accounting_entries() def on_cancel(self): # References for this Journal are removed on the `on_cancel` event in accounts_controller diff --git a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py index 1bf50b76b0d8f8d8b427a7b3c1d4b15d3725af51..82db481e4583e6ea001177a7d4e6f461451b4d0e 100644 --- a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py @@ -455,12 +455,9 @@ class TestJournalEntry(unittest.TestCase): # Change cost center for bank account - _Test Cost Center for BS Account create_cost_center(cost_center_name="_Test Cost Center for BS Account", company="_Test Company") jv.accounts[1].cost_center = "_Test Cost Center for BS Account - _TC" + # Ledger reposted implicitly upon 'Update After Submit' jv.save() - # Check if repost flag gets set on update after submit - self.assertTrue(jv.repost_required) - jv.repost_accounting_entries() - # Check GL entries after reposting jv.load_from_db() self.expected_gle[0]["cost_center"] = "_Test Cost Center for BS Account - _TC" diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 16e6505608bddc4c1de5a5e358404d7b13d4fb68..c88a5025ff57a01a16f5cf805994bffcad71d00b 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -842,6 +842,7 @@ class PurchaseInvoice(BuyingController): if self.needs_repost: self.validate_for_repost() self.db_set("repost_required", self.needs_repost) + self.repost_accounting_entries() def make_gl_entries(self, gl_entries=None, from_repost=False): update_outstanding = "No" if (cint(self.is_paid) or self.write_off_account) else "Yes" diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index fd9d798038918e33c5551a6ae70f84935e36bfb0..ac72812cce872047fbc7c668c4f545ce56edbfba 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -2029,10 +2029,9 @@ class TestPurchaseInvoice(FrappeTestCase, StockTestMixin): check_gl_entries(self, pi.name, expected_gle, nowdate()) pi.items[0].expense_account = "Service - _TC" + # Ledger reposted implicitly upon 'Update After Submit' pi.save() pi.load_from_db() - self.assertTrue(pi.repost_required) - pi.repost_accounting_entries() expected_gle = [ ["Creditors - _TC", 0.0, 1000, nowdate()], diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 2ae4d9e05d000598a4d29f9eee8bbc22dd5c62ed..42c9cdc1cad5efafe67c735aca9d8ca26932bece 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -760,6 +760,7 @@ class SalesInvoice(SellingController): if self.needs_repost: self.validate_for_repost() self.db_set("repost_required", self.needs_repost) + self.repost_accounting_entries() def set_paid_amount(self): paid_amount = 0.0 diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 4f17855f41fcd80927c0a68f7b6ff38113eeb54d..9a015c73f49a2bd13610d76f3a247b0688974768 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -2962,13 +2962,9 @@ class TestSalesInvoice(FrappeTestCase): si.items[0].income_account = "Service - _TC" si.additional_discount_account = "_Test Account Sales - _TC" si.taxes[0].account_head = "TDS Payable - _TC" + # Ledger reposted implicitly upon 'Update After Submit' si.save() - si.load_from_db() - self.assertTrue(si.repost_required) - - si.repost_accounting_entries() - expected_gle = [ ["_Test Account Sales - _TC", 22.0, 0.0, nowdate()], ["Debtors - _TC", 88, 0.0, nowdate()],