refactor: remove attribute check on 'repost_required'

(cherry picked from commit 07fc952a43)

# Conflicts:
#	erpnext/accounts/doctype/journal_entry/journal_entry.py
#	erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
#	erpnext/accounts/doctype/sales_invoice/sales_invoice.py
This commit is contained in:
ruthra kumar
2024-07-18 15:38:15 +05:30
committed by Mergify
parent 0284328e2c
commit 149109649d
3 changed files with 44 additions and 1 deletions

View File

@@ -172,6 +172,16 @@ class JournalEntry(AccountsController):
self.update_asset_value()
self.update_inter_company_jv()
self.update_invoice_discounting()
<<<<<<< HEAD
=======
self.update_booked_depreciation()
def on_update_after_submit(self):
self.needs_repost = self.check_if_fields_updated(fields_to_check=[], child_tables={"accounts": []})
if self.needs_repost:
self.validate_for_repost()
self.repost_accounting_entries()
>>>>>>> 07fc952a43 (refactor: remove attribute check on 'repost_required')
def on_cancel(self):
# References for this Journal are removed on the `on_cancel` event in accounts_controller

View File

@@ -760,6 +760,7 @@ class PurchaseInvoice(BuyingController):
self.process_common_party_accounting()
def on_update_after_submit(self):
<<<<<<< HEAD
if hasattr(self, "repost_required"):
fields_to_check = [
"cash_bank_account",
@@ -772,6 +773,19 @@ class PurchaseInvoice(BuyingController):
self.validate_for_repost()
self.db_set("repost_required", self.needs_repost)
self.repost_accounting_entries()
=======
fields_to_check = [
"cash_bank_account",
"write_off_account",
"unrealized_profit_loss_account",
"is_opening",
]
child_tables = {"items": ("expense_account",), "taxes": ("account_head",)}
self.needs_repost = self.check_if_fields_updated(fields_to_check, child_tables)
if self.needs_repost:
self.validate_for_repost()
self.repost_accounting_entries()
>>>>>>> 07fc952a43 (refactor: remove attribute check on 'repost_required')
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"

View File

@@ -569,7 +569,6 @@ class SalesInvoice(SellingController):
self.repost_future_sle_and_gle()
self.db_set("status", "Cancelled")
self.db_set("repost_required", 0)
if frappe.db.get_single_value("Selling Settings", "sales_update_frequency") == "Each Transaction":
update_company_current_month_sales(self.company)
@@ -716,6 +715,7 @@ class SalesInvoice(SellingController):
data.sales_invoice = sales_invoice
def on_update_after_submit(self):
<<<<<<< HEAD
if hasattr(self, "repost_required"):
fields_to_check = [
"additional_discount_account",
@@ -734,6 +734,25 @@ class SalesInvoice(SellingController):
self.validate_for_repost()
self.db_set("repost_required", self.needs_repost)
self.repost_accounting_entries()
=======
fields_to_check = [
"additional_discount_account",
"cash_bank_account",
"account_for_change_amount",
"write_off_account",
"loyalty_redemption_account",
"unrealized_profit_loss_account",
"is_opening",
]
child_tables = {
"items": ("income_account", "expense_account", "discount_account"),
"taxes": ("account_head",),
}
self.needs_repost = self.check_if_fields_updated(fields_to_check, child_tables)
if self.needs_repost:
self.validate_for_repost()
self.repost_accounting_entries()
>>>>>>> 07fc952a43 (refactor: remove attribute check on 'repost_required')
def set_paid_amount(self):
paid_amount = 0.0