mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 08:54:45 +00:00
chore: resolve conflict
This commit is contained in:
@@ -4135,91 +4135,7 @@ class TestSalesInvoice(FrappeTestCase):
|
|||||||
self.assertEqual(len(actual), 4)
|
self.assertEqual(len(actual), 4)
|
||||||
self.assertEqual(expected, actual)
|
self.assertEqual(expected, actual)
|
||||||
|
|
||||||
<<<<<<< HEAD
|
@change_settings("Accounts Settings", {"enable_common_party_accounting": True})
|
||||||
=======
|
|
||||||
@IntegrationTestCase.change_settings("Accounts Settings", {"enable_common_party_accounting": True})
|
|
||||||
def test_common_party_with_foreign_currency_jv(self):
|
|
||||||
from erpnext.accounts.doctype.account.test_account import create_account
|
|
||||||
from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import (
|
|
||||||
make_customer,
|
|
||||||
)
|
|
||||||
from erpnext.accounts.doctype.party_link.party_link import create_party_link
|
|
||||||
from erpnext.buying.doctype.supplier.test_supplier import create_supplier
|
|
||||||
from erpnext.setup.utils import get_exchange_rate
|
|
||||||
|
|
||||||
creditors = create_account(
|
|
||||||
account_name="Creditors USD",
|
|
||||||
parent_account="Accounts Payable - _TC",
|
|
||||||
company="_Test Company",
|
|
||||||
account_currency="USD",
|
|
||||||
account_type="Payable",
|
|
||||||
)
|
|
||||||
debtors = create_account(
|
|
||||||
account_name="Debtors USD",
|
|
||||||
parent_account="Accounts Receivable - _TC",
|
|
||||||
company="_Test Company",
|
|
||||||
account_currency="USD",
|
|
||||||
account_type="Receivable",
|
|
||||||
)
|
|
||||||
|
|
||||||
# create a customer
|
|
||||||
customer = make_customer(customer="_Test Common Party USD")
|
|
||||||
cust_doc = frappe.get_doc("Customer", customer)
|
|
||||||
cust_doc.default_currency = "USD"
|
|
||||||
test_account_details = {
|
|
||||||
"company": "_Test Company",
|
|
||||||
"account": debtors,
|
|
||||||
}
|
|
||||||
cust_doc.append("accounts", test_account_details)
|
|
||||||
cust_doc.save()
|
|
||||||
|
|
||||||
# create a supplier
|
|
||||||
supplier = create_supplier(supplier_name="_Test Common Party USD").name
|
|
||||||
supp_doc = frappe.get_doc("Supplier", supplier)
|
|
||||||
supp_doc.default_currency = "USD"
|
|
||||||
test_account_details = {
|
|
||||||
"company": "_Test Company",
|
|
||||||
"account": creditors,
|
|
||||||
}
|
|
||||||
supp_doc.append("accounts", test_account_details)
|
|
||||||
supp_doc.save()
|
|
||||||
|
|
||||||
# create a party link between customer & supplier
|
|
||||||
create_party_link("Supplier", supplier, customer)
|
|
||||||
|
|
||||||
# create a sales invoice
|
|
||||||
si = create_sales_invoice(
|
|
||||||
customer=customer,
|
|
||||||
currency="USD",
|
|
||||||
conversion_rate=get_exchange_rate("USD", "INR"),
|
|
||||||
debit_to=debtors,
|
|
||||||
do_not_save=1,
|
|
||||||
)
|
|
||||||
si.party_account_currency = "USD"
|
|
||||||
si.save()
|
|
||||||
si.submit()
|
|
||||||
|
|
||||||
# check outstanding of sales invoice
|
|
||||||
si.reload()
|
|
||||||
self.assertEqual(si.status, "Paid")
|
|
||||||
self.assertEqual(flt(si.outstanding_amount), 0.0)
|
|
||||||
|
|
||||||
# check creation of journal entry
|
|
||||||
jv = frappe.get_all(
|
|
||||||
"Journal Entry Account",
|
|
||||||
{
|
|
||||||
"account": si.debit_to,
|
|
||||||
"party_type": "Customer",
|
|
||||||
"party": si.customer,
|
|
||||||
"reference_type": si.doctype,
|
|
||||||
"reference_name": si.name,
|
|
||||||
},
|
|
||||||
pluck="credit_in_account_currency",
|
|
||||||
)
|
|
||||||
self.assertTrue(jv)
|
|
||||||
self.assertEqual(jv[0], si.grand_total)
|
|
||||||
|
|
||||||
@IntegrationTestCase.change_settings("Accounts Settings", {"enable_common_party_accounting": True})
|
|
||||||
def test_common_party_with_different_currency_in_debtor_and_creditor(self):
|
def test_common_party_with_different_currency_in_debtor_and_creditor(self):
|
||||||
from erpnext.accounts.doctype.account.test_account import create_account
|
from erpnext.accounts.doctype.account.test_account import create_account
|
||||||
from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import (
|
from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import (
|
||||||
@@ -4301,34 +4217,6 @@ class TestSalesInvoice(FrappeTestCase):
|
|||||||
self.assertTrue(jv)
|
self.assertTrue(jv)
|
||||||
self.assertEqual(jv[0], si.grand_total)
|
self.assertEqual(jv[0], si.grand_total)
|
||||||
|
|
||||||
def test_invoice_remarks(self):
|
|
||||||
si = frappe.copy_doc(self.globalTestRecords["Sales Invoice"][0])
|
|
||||||
si.po_no = "Test PO"
|
|
||||||
si.po_date = nowdate()
|
|
||||||
si.save()
|
|
||||||
si.submit()
|
|
||||||
self.assertEqual(si.remarks, f"Against Customer Order Test PO dated {format_date(nowdate())}")
|
|
||||||
|
|
||||||
def test_gl_voucher_subtype(self):
|
|
||||||
si = create_sales_invoice()
|
|
||||||
gl_entries = frappe.get_all(
|
|
||||||
"GL Entry",
|
|
||||||
filters={"voucher_type": "Sales Invoice", "voucher_no": si.name},
|
|
||||||
pluck="voucher_subtype",
|
|
||||||
)
|
|
||||||
|
|
||||||
self.assertTrue(all([x == "Sales Invoice" for x in gl_entries]))
|
|
||||||
|
|
||||||
si = create_sales_invoice(is_return=1, qty=-1)
|
|
||||||
gl_entries = frappe.get_all(
|
|
||||||
"GL Entry",
|
|
||||||
filters={"voucher_type": "Sales Invoice", "voucher_no": si.name},
|
|
||||||
pluck="voucher_subtype",
|
|
||||||
)
|
|
||||||
|
|
||||||
self.assertTrue(all([x == "Credit Note" for x in gl_entries]))
|
|
||||||
|
|
||||||
>>>>>>> e371f68d66 (fix: handle multi currency in common party journal entry)
|
|
||||||
|
|
||||||
def set_advance_flag(company, flag, default_account):
|
def set_advance_flag(company, flag, default_account):
|
||||||
frappe.db.set_value(
|
frappe.db.set_value(
|
||||||
|
|||||||
Reference in New Issue
Block a user