refactor: gain/loss should use same posting date as payment
This commit is contained in:
parent
6a7bdeffdf
commit
f7865da4d2
@ -647,6 +647,7 @@ def reconcile_dr_cr_note(dr_cr_notes, company):
|
|||||||
|
|
||||||
create_gain_loss_journal(
|
create_gain_loss_journal(
|
||||||
company,
|
company,
|
||||||
|
today(),
|
||||||
inv.party_type,
|
inv.party_type,
|
||||||
inv.party,
|
inv.party,
|
||||||
inv.account,
|
inv.account,
|
||||||
|
@ -1888,6 +1888,7 @@ class QueryPaymentLedger(object):
|
|||||||
|
|
||||||
def create_gain_loss_journal(
|
def create_gain_loss_journal(
|
||||||
company,
|
company,
|
||||||
|
posting_date,
|
||||||
party_type,
|
party_type,
|
||||||
party,
|
party,
|
||||||
party_account,
|
party_account,
|
||||||
@ -1906,7 +1907,7 @@ def create_gain_loss_journal(
|
|||||||
journal_entry = frappe.new_doc("Journal Entry")
|
journal_entry = frappe.new_doc("Journal Entry")
|
||||||
journal_entry.voucher_type = "Exchange Gain Or Loss"
|
journal_entry.voucher_type = "Exchange Gain Or Loss"
|
||||||
journal_entry.company = company
|
journal_entry.company = company
|
||||||
journal_entry.posting_date = nowdate()
|
journal_entry.posting_date = posting_date or nowdate()
|
||||||
journal_entry.multi_currency = 1
|
journal_entry.multi_currency = 1
|
||||||
journal_entry.is_system_generated = True
|
journal_entry.is_system_generated = True
|
||||||
|
|
||||||
|
@ -1096,8 +1096,10 @@ class AccountsController(TransactionBase):
|
|||||||
self.name,
|
self.name,
|
||||||
arg.get("referenced_row"),
|
arg.get("referenced_row"),
|
||||||
):
|
):
|
||||||
|
posting_date = frappe.db.get_value(arg.voucher_type, arg.voucher_no, "posting_date")
|
||||||
je = create_gain_loss_journal(
|
je = create_gain_loss_journal(
|
||||||
self.company,
|
self.company,
|
||||||
|
posting_date,
|
||||||
arg.get("party_type"),
|
arg.get("party_type"),
|
||||||
arg.get("party"),
|
arg.get("party"),
|
||||||
party_account,
|
party_account,
|
||||||
@ -1177,6 +1179,7 @@ class AccountsController(TransactionBase):
|
|||||||
|
|
||||||
je = create_gain_loss_journal(
|
je = create_gain_loss_journal(
|
||||||
self.company,
|
self.company,
|
||||||
|
self.posting_date,
|
||||||
self.party_type,
|
self.party_type,
|
||||||
self.party,
|
self.party,
|
||||||
party_account,
|
party_account,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user