refactor: allow reconciliation date for exchange gain / loss

This commit is contained in:
ruthra kumar
2025-01-23 13:48:09 +05:30
parent 5257413a93
commit 95af63e305
3 changed files with 6 additions and 4 deletions

View File

@@ -531,7 +531,7 @@
"fieldname": "exchange_gain_loss_posting_date", "fieldname": "exchange_gain_loss_posting_date",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Posting Date Inheritance for Exchange Gain / Loss", "label": "Posting Date Inheritance for Exchange Gain / Loss",
"options": "Invoice\nPayment" "options": "Invoice\nPayment\nReconciliation Date"
} }
], ],
"icon": "icon-cog", "icon": "icon-cog",
@@ -539,7 +539,7 @@
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"issingle": 1, "issingle": 1,
"links": [], "links": [],
"modified": "2025-01-22 17:53:47.968079", "modified": "2025-01-23 13:15:44.077853",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Accounts Settings", "name": "Accounts Settings",
@@ -568,4 +568,4 @@
"sort_order": "ASC", "sort_order": "ASC",
"states": [], "states": [],
"track_changes": 1 "track_changes": 1
} }

View File

@@ -45,7 +45,7 @@ class AccountsSettings(Document):
enable_fuzzy_matching: DF.Check enable_fuzzy_matching: DF.Check
enable_immutable_ledger: DF.Check enable_immutable_ledger: DF.Check
enable_party_matching: 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 frozen_accounts_modifier: DF.Link | None
general_ledger_remarks_length: DF.Int general_ledger_remarks_length: DF.Int
ignore_account_closing_balance: DF.Check ignore_account_closing_balance: DF.Check

View File

@@ -455,6 +455,8 @@ class PaymentReconciliation(Document):
res.update({"gain_loss_posting_date": pay.get("posting_date")}) res.update({"gain_loss_posting_date": pay.get("posting_date")})
if exc_gain_loss_posting_date == "Invoice": if exc_gain_loss_posting_date == "Invoice":
res.update({"gain_loss_posting_date": inv.get("invoice_date")}) 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: if pay.get("amount") == 0:
entries.append(res) entries.append(res)