mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-14 20:35:09 +00:00
feat: add repost accounting ledger entry for payment entry
(cherry picked from commit 5676d60ed3)
This commit is contained in:
@@ -25,6 +25,10 @@ from erpnext.accounts.doctype.invoice_discounting.invoice_discounting import (
|
|||||||
get_party_account_based_on_invoice_discounting,
|
get_party_account_based_on_invoice_discounting,
|
||||||
)
|
)
|
||||||
from erpnext.accounts.doctype.journal_entry.journal_entry import get_default_bank_cash_account
|
from erpnext.accounts.doctype.journal_entry.journal_entry import get_default_bank_cash_account
|
||||||
|
from erpnext.accounts.doctype.repost_accounting_ledger.repost_accounting_ledger import (
|
||||||
|
validate_docs_for_deferred_accounting,
|
||||||
|
validate_docs_for_voucher_types,
|
||||||
|
)
|
||||||
from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import (
|
from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import (
|
||||||
get_party_tax_withholding_details,
|
get_party_tax_withholding_details,
|
||||||
)
|
)
|
||||||
@@ -114,6 +118,23 @@ class PaymentEntry(AccountsController):
|
|||||||
self.update_advance_paid() # advance_paid_status depends on the payment request amount
|
self.update_advance_paid() # advance_paid_status depends on the payment request amount
|
||||||
self.set_status()
|
self.set_status()
|
||||||
|
|
||||||
|
def validate_for_repost(self):
|
||||||
|
validate_docs_for_voucher_types(["Payment Entry"])
|
||||||
|
validate_docs_for_deferred_accounting([self.name], [])
|
||||||
|
|
||||||
|
def on_update_after_submit(self):
|
||||||
|
# Flag will be set on Reconciliation
|
||||||
|
# Reconciliation tool will anyways repost ledger entries. So, no need to check and do implicit repost.
|
||||||
|
if self.flags.get("ignore_reposting_on_reconciliation"):
|
||||||
|
return
|
||||||
|
|
||||||
|
self.needs_repost = self.check_if_fields_updated(
|
||||||
|
fields_to_check=[], child_tables={"references": [], "taxes": [], "deductions": []}
|
||||||
|
)
|
||||||
|
if self.needs_repost:
|
||||||
|
self.validate_for_repost()
|
||||||
|
self.repost_accounting_entries()
|
||||||
|
|
||||||
def set_liability_account(self):
|
def set_liability_account(self):
|
||||||
# Auto setting liability account should only be done during 'draft' status
|
# Auto setting liability account should only be done during 'draft' status
|
||||||
if self.docstatus > 0 or self.payment_type == "Internal Transfer":
|
if self.docstatus > 0 or self.payment_type == "Internal Transfer":
|
||||||
|
|||||||
@@ -773,6 +773,8 @@ def update_reference_in_payment_entry(
|
|||||||
frappe._dict({"difference_posting_date": d.difference_posting_date}), dimensions_dict
|
frappe._dict({"difference_posting_date": d.difference_posting_date}), dimensions_dict
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Ledgers will be reposted by Reconciliation tool
|
||||||
|
payment_entry.flags.ignore_reposting_on_reconciliation = True
|
||||||
if not do_not_save:
|
if not do_not_save:
|
||||||
payment_entry.save(ignore_permissions=True)
|
payment_entry.save(ignore_permissions=True)
|
||||||
return row, update_advance_paid
|
return row, update_advance_paid
|
||||||
|
|||||||
Reference in New Issue
Block a user