refactor: only apply configuration on normal payments

patch to update default value
This commit is contained in:
ruthra kumar
2025-01-23 14:10:15 +05:30
parent 95af63e305
commit b2c3da135e
3 changed files with 9 additions and 4 deletions

View File

@@ -335,6 +335,7 @@ class PaymentReconciliation(Document):
for payment in non_reconciled_payments:
row = self.append("payments", {})
row.update(payment)
row.is_advance = payment.book_advance_payments_in_separate_party_account
def get_invoice_entries(self):
# Fetch JVs, Sales and Purchase Invoices for 'invoices' to reconcile against
@@ -453,10 +454,11 @@ class PaymentReconciliation(Document):
res.difference_account = default_exchange_gain_loss_account
res.exchange_rate = inv.get("exchange_rate")
res.update({"gain_loss_posting_date": pay.get("posting_date")})
if exc_gain_loss_posting_date == "Invoice":
res.update({"gain_loss_posting_date": inv.get("invoice_date")})
elif exc_gain_loss_posting_date == "Reconciliation Date":
res.update({"gain_loss_posting_date": nowdate()})
if not pay.get("is_advance"):
if exc_gain_loss_posting_date == "Invoice":
res.update({"gain_loss_posting_date": inv.get("invoice_date")})
elif exc_gain_loss_posting_date == "Reconciliation Date":
res.update({"gain_loss_posting_date": nowdate()})
if pay.get("amount") == 0:
entries.append(res)

View File

@@ -2993,6 +2993,7 @@ def get_advance_payment_entries(
(payment_ref.allocated_amount).as_("amount"),
(payment_ref.name).as_("reference_row"),
(payment_ref.reference_name).as_("against_order"),
(payment_entry.book_advance_payments_in_separate_party_account),
)
q = q.where(payment_ref.reference_doctype == order_doctype)
@@ -3037,6 +3038,7 @@ def get_common_query(
(payment_entry.name).as_("reference_name"),
payment_entry.posting_date,
(payment_entry.remarks).as_("remarks"),
(payment_entry.book_advance_payments_in_separate_party_account),
)
.where(payment_entry.payment_type == payment_type)
.where(payment_entry.party_type == party_type)

View File

@@ -398,3 +398,4 @@ erpnext.patches.v15_0.update_asset_status_to_work_in_progress
erpnext.patches.v15_0.rename_manufacturing_settings_field
erpnext.patches.v15_0.migrate_checkbox_to_select_for_reconciliation_effect
erpnext.patches.v15_0.sync_auto_reconcile_config
execute:frappe.db.set_single_value("Accounts Settings", "exchange_gain_loss_posting_date", "Payment")