refactor: allow reconciliation date for exchange gain / loss

(cherry picked from commit 95af63e305)

# Conflicts:
#	erpnext/accounts/doctype/accounts_settings/accounts_settings.json
This commit is contained in:
ruthra kumar
2025-01-23 13:48:09 +05:30
committed by Mergify
parent 035139d4c7
commit 5a62bd6e85
3 changed files with 12 additions and 2 deletions

View File

@@ -537,8 +537,12 @@
"fieldname": "exchange_gain_loss_posting_date",
"fieldtype": "Select",
"label": "Posting Date Inheritance for Exchange Gain / Loss",
<<<<<<< HEAD
"options": "Invoice\nPayment"
>>>>>>> 3fbd2ca0d9 (refactor: configurable posting date for Exc Gain / Loss journal)
=======
"options": "Invoice\nPayment\nReconciliation Date"
>>>>>>> 95af63e305 (refactor: allow reconciliation date for exchange gain / loss)
}
],
"icon": "icon-cog",
@@ -546,11 +550,15 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
<<<<<<< HEAD
<<<<<<< HEAD
"modified": "2024-01-22 12:10:10.151819",
=======
"modified": "2025-01-22 17:53:47.968079",
>>>>>>> 3fbd2ca0d9 (refactor: configurable posting date for Exc Gain / Loss journal)
=======
"modified": "2025-01-23 13:15:44.077853",
>>>>>>> 95af63e305 (refactor: allow reconciliation date for exchange gain / loss)
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounts Settings",
@@ -579,4 +587,4 @@
"sort_order": "ASC",
"states": [],
"track_changes": 1
}
}

View File

@@ -46,7 +46,7 @@ class AccountsSettings(Document):
enable_fuzzy_matching: DF.Check
enable_immutable_ledger: DF.Check
enable_party_matching: DF.Check
exchange_gain_loss_posting_date: DF.Literal["Invoice", "Payment"]
exchange_gain_loss_posting_date: DF.Literal["Invoice", "Payment", "Reconciliation Date"]
frozen_accounts_modifier: DF.Link | None
general_ledger_remarks_length: DF.Int
ignore_account_closing_balance: DF.Check

View File

@@ -385,6 +385,8 @@ class PaymentReconciliation(Document):
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 pay.get("amount") == 0:
entries.append(res)