fix: don't update reference to SI / PI on advances
This commit is contained in:
@@ -1308,11 +1308,23 @@ class PaymentEntry(AccountsController):
|
|||||||
{
|
{
|
||||||
dr_or_cr: allocated_amount_in_company_currency,
|
dr_or_cr: allocated_amount_in_company_currency,
|
||||||
dr_or_cr + "_in_account_currency": d.allocated_amount,
|
dr_or_cr + "_in_account_currency": d.allocated_amount,
|
||||||
"against_voucher_type": d.reference_doctype,
|
|
||||||
"against_voucher": d.reference_name,
|
|
||||||
"cost_center": cost_center,
|
"cost_center": cost_center,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if self.book_advance_payments_in_separate_party_account and d.reference_doctype in [
|
||||||
|
"Sales Order",
|
||||||
|
"Purchase Order",
|
||||||
|
]:
|
||||||
|
gle.update(
|
||||||
|
{
|
||||||
|
"against_voucher_type": d.reference_doctype,
|
||||||
|
"against_voucher": d.reference_name,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
gle.update({"against_voucher_type": self.doctype, "against_voucher": self.name})
|
||||||
|
|
||||||
gl_entries.append(gle)
|
gl_entries.append(gle)
|
||||||
|
|
||||||
if self.unallocated_amount:
|
if self.unallocated_amount:
|
||||||
|
|||||||
@@ -488,8 +488,12 @@ def reconcile_against_document(
|
|||||||
|
|
||||||
# For payments with `Advance` in separate account feature enabled, only new ledger entries are posted for each reference.
|
# For payments with `Advance` in separate account feature enabled, only new ledger entries are posted for each reference.
|
||||||
# No need to cancel/delete payment ledger entries
|
# No need to cancel/delete payment ledger entries
|
||||||
|
repost_whole_ledger = any([x.voucher_detail_no for x in entries])
|
||||||
if voucher_type == "Payment Entry" and doc.book_advance_payments_in_separate_party_account:
|
if voucher_type == "Payment Entry" and doc.book_advance_payments_in_separate_party_account:
|
||||||
doc.make_advance_gl_entries(cancel=1)
|
if repost_whole_ledger:
|
||||||
|
doc.make_gl_entries(cancel=1)
|
||||||
|
else:
|
||||||
|
doc.make_advance_gl_entries(cancel=1)
|
||||||
else:
|
else:
|
||||||
_delete_pl_entries(voucher_type, voucher_no)
|
_delete_pl_entries(voucher_type, voucher_no)
|
||||||
|
|
||||||
@@ -525,7 +529,10 @@ def reconcile_against_document(
|
|||||||
if voucher_type == "Payment Entry" and doc.book_advance_payments_in_separate_party_account:
|
if voucher_type == "Payment Entry" and doc.book_advance_payments_in_separate_party_account:
|
||||||
# both ledgers must be posted to for `Advance` in separate account feature
|
# both ledgers must be posted to for `Advance` in separate account feature
|
||||||
# TODO: find a more efficient way post only for the new linked vouchers
|
# TODO: find a more efficient way post only for the new linked vouchers
|
||||||
doc.make_advance_gl_entries()
|
if repost_whole_ledger:
|
||||||
|
doc.make_gl_entries()
|
||||||
|
else:
|
||||||
|
doc.make_advance_gl_entries()
|
||||||
else:
|
else:
|
||||||
gl_map = doc.build_gl_map()
|
gl_map = doc.build_gl_map()
|
||||||
# Make sure there is no overallocation
|
# Make sure there is no overallocation
|
||||||
|
|||||||
Reference in New Issue
Block a user