mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-27 10:38:30 +00:00
Co-authored-by: sarathibalamurugan <sarathigreen4@gmail.com>
This commit is contained in:
@@ -2105,6 +2105,37 @@ class TestPaymentEntry(ERPNextTestSuite):
|
|||||||
self.assertEqual(ref.voucher_no, so.name)
|
self.assertEqual(ref.voucher_no, so.name)
|
||||||
self.assertIsNotNone(ref.payment_term)
|
self.assertIsNotNone(ref.payment_term)
|
||||||
|
|
||||||
|
def test_project_name_in_exchange_gain_loss_entry(self):
|
||||||
|
si = create_sales_invoice(
|
||||||
|
customer="_Test Customer USD",
|
||||||
|
debit_to="_Test Receivable USD - _TC",
|
||||||
|
currency="USD",
|
||||||
|
conversion_rate=50,
|
||||||
|
do_not_submit=True,
|
||||||
|
)
|
||||||
|
from erpnext.projects.doctype.project.test_project import make_project
|
||||||
|
|
||||||
|
si.project = make_project({"project_name": "_Test Project for Exchange Gain Loss Entry"}).name
|
||||||
|
|
||||||
|
si.submit()
|
||||||
|
|
||||||
|
pe = get_payment_entry("Sales Invoice", si.name)
|
||||||
|
|
||||||
|
pe.source_exchange_rate = 100
|
||||||
|
|
||||||
|
pe.insert()
|
||||||
|
pe.submit()
|
||||||
|
|
||||||
|
rows = frappe.get_all(
|
||||||
|
"Journal Entry Account",
|
||||||
|
or_filters=[{"reference_name": pe.name}, {"reference_name": si.name}],
|
||||||
|
fields=["project"],
|
||||||
|
)
|
||||||
|
self.assertEqual(len(rows), 2)
|
||||||
|
|
||||||
|
self.assertEqual(rows[0].project, si.project)
|
||||||
|
self.assertEqual(rows[1].project, si.project)
|
||||||
|
|
||||||
|
|
||||||
def create_payment_entry(**args):
|
def create_payment_entry(**args):
|
||||||
payment_entry = frappe.new_doc("Payment Entry")
|
payment_entry = frappe.new_doc("Payment Entry")
|
||||||
|
|||||||
@@ -2513,6 +2513,7 @@ def create_gain_loss_journal(
|
|||||||
ref2_detail_no,
|
ref2_detail_no,
|
||||||
cost_center,
|
cost_center,
|
||||||
dimensions,
|
dimensions,
|
||||||
|
project=None,
|
||||||
) -> str:
|
) -> str:
|
||||||
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"
|
||||||
@@ -2539,6 +2540,7 @@ def create_gain_loss_journal(
|
|||||||
"account_currency": party_account_currency,
|
"account_currency": party_account_currency,
|
||||||
"exchange_rate": 0,
|
"exchange_rate": 0,
|
||||||
"cost_center": cost_center or erpnext.get_default_cost_center(company),
|
"cost_center": cost_center or erpnext.get_default_cost_center(company),
|
||||||
|
"project": project,
|
||||||
"reference_type": ref1_dt,
|
"reference_type": ref1_dt,
|
||||||
"reference_name": ref1_dn,
|
"reference_name": ref1_dn,
|
||||||
"reference_detail_no": ref1_detail_no,
|
"reference_detail_no": ref1_detail_no,
|
||||||
@@ -2556,6 +2558,7 @@ def create_gain_loss_journal(
|
|||||||
"account_currency": gain_loss_account_currency,
|
"account_currency": gain_loss_account_currency,
|
||||||
"exchange_rate": 1,
|
"exchange_rate": 1,
|
||||||
"cost_center": cost_center or erpnext.get_default_cost_center(company),
|
"cost_center": cost_center or erpnext.get_default_cost_center(company),
|
||||||
|
"project": project,
|
||||||
"reference_type": ref2_dt,
|
"reference_type": ref2_dt,
|
||||||
"reference_name": ref2_dn,
|
"reference_name": ref2_dn,
|
||||||
"reference_detail_no": ref2_detail_no,
|
"reference_detail_no": ref2_detail_no,
|
||||||
|
|||||||
@@ -1768,6 +1768,7 @@ class AccountsController(TransactionBase):
|
|||||||
arg.get("referenced_row"),
|
arg.get("referenced_row"),
|
||||||
arg.get("cost_center"),
|
arg.get("cost_center"),
|
||||||
dimensions_dict,
|
dimensions_dict,
|
||||||
|
arg.get("project"),
|
||||||
)
|
)
|
||||||
frappe.msgprint(
|
frappe.msgprint(
|
||||||
_("Exchange Gain/Loss amount has been booked through {0}").format(
|
_("Exchange Gain/Loss amount has been booked through {0}").format(
|
||||||
@@ -1852,6 +1853,7 @@ class AccountsController(TransactionBase):
|
|||||||
d.idx,
|
d.idx,
|
||||||
self.cost_center,
|
self.cost_center,
|
||||||
dimensions_dict,
|
dimensions_dict,
|
||||||
|
self.project,
|
||||||
)
|
)
|
||||||
frappe.msgprint(
|
frappe.msgprint(
|
||||||
_("Exchange Gain/Loss amount has been booked through {0}").format(
|
_("Exchange Gain/Loss amount has been booked through {0}").format(
|
||||||
|
|||||||
Reference in New Issue
Block a user