mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-16 11:39:18 +00:00
refactor: configurable posting date for Exc Gain / Loss journal
This commit is contained in:
@@ -47,6 +47,7 @@
|
|||||||
"auto_reconciliation_job_trigger",
|
"auto_reconciliation_job_trigger",
|
||||||
"reconciliation_queue_size",
|
"reconciliation_queue_size",
|
||||||
"column_break_resa",
|
"column_break_resa",
|
||||||
|
"exchange_gain_loss_posting_date",
|
||||||
"invoicing_settings_tab",
|
"invoicing_settings_tab",
|
||||||
"accounts_transactions_settings_section",
|
"accounts_transactions_settings_section",
|
||||||
"over_billing_allowance",
|
"over_billing_allowance",
|
||||||
@@ -523,6 +524,14 @@
|
|||||||
"fieldname": "ignore_is_opening_check_for_reporting",
|
"fieldname": "ignore_is_opening_check_for_reporting",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Ignore Is Opening check for reporting"
|
"label": "Ignore Is Opening check for reporting"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "Payment",
|
||||||
|
"description": "Only applies for Normal Payments",
|
||||||
|
"fieldname": "exchange_gain_loss_posting_date",
|
||||||
|
"fieldtype": "Select",
|
||||||
|
"label": "Posting Date Inheritance for Exchange Gain / Loss",
|
||||||
|
"options": "Invoice\nPayment"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "icon-cog",
|
"icon": "icon-cog",
|
||||||
@@ -530,7 +539,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-01-18 21:24:19.840745",
|
"modified": "2025-01-22 17:53:47.968079",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Accounts Settings",
|
"name": "Accounts Settings",
|
||||||
|
|||||||
@@ -45,6 +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"]
|
||||||
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
|
||||||
|
|||||||
@@ -424,6 +424,9 @@ class PaymentReconciliation(Document):
|
|||||||
def allocate_entries(self, args):
|
def allocate_entries(self, args):
|
||||||
self.validate_entries()
|
self.validate_entries()
|
||||||
|
|
||||||
|
exc_gain_loss_posting_date = frappe.db.get_single_value(
|
||||||
|
"Accounts Settings", "exchange_gain_loss_posting_date", cache=True
|
||||||
|
)
|
||||||
invoice_exchange_map = self.get_invoice_exchange_map(args.get("invoices"), args.get("payments"))
|
invoice_exchange_map = self.get_invoice_exchange_map(args.get("invoices"), args.get("payments"))
|
||||||
default_exchange_gain_loss_account = frappe.get_cached_value(
|
default_exchange_gain_loss_account = frappe.get_cached_value(
|
||||||
"Company", self.company, "exchange_gain_loss_account"
|
"Company", self.company, "exchange_gain_loss_account"
|
||||||
@@ -450,6 +453,8 @@ class PaymentReconciliation(Document):
|
|||||||
res.difference_account = default_exchange_gain_loss_account
|
res.difference_account = default_exchange_gain_loss_account
|
||||||
res.exchange_rate = inv.get("exchange_rate")
|
res.exchange_rate = inv.get("exchange_rate")
|
||||||
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":
|
||||||
|
res.update({"gain_loss_posting_date": inv.get("invoice_date")})
|
||||||
|
|
||||||
if pay.get("amount") == 0:
|
if pay.get("amount") == 0:
|
||||||
entries.append(res)
|
entries.append(res)
|
||||||
|
|||||||
Reference in New Issue
Block a user