mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 13:24:47 +00:00
chore: resolve conflict
This commit is contained in:
@@ -3915,110 +3915,6 @@ class TestSalesInvoice(FrappeTestCase):
|
|||||||
self.assertEqual(len(res), 1)
|
self.assertEqual(len(res), 1)
|
||||||
self.assertEqual(res[0][0], pos_return.return_against)
|
self.assertEqual(res[0][0], pos_return.return_against)
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
def test_validation_on_opening_invoice_with_rounding(self):
|
|
||||||
si = create_sales_invoice(qty=1, rate=99.98, do_not_submit=True)
|
|
||||||
si.is_opening = "Yes"
|
|
||||||
si.items[0].income_account = "Temporary Opening - _TC"
|
|
||||||
si.save()
|
|
||||||
self.assertRaises(frappe.ValidationError, si.submit)
|
|
||||||
|
|
||||||
def _create_opening_roundoff_account(self, company_name):
|
|
||||||
liability_root = frappe.db.get_all(
|
|
||||||
"Account",
|
|
||||||
filters={"company": company_name, "root_type": "Liability", "disabled": 0},
|
|
||||||
order_by="lft",
|
|
||||||
limit=1,
|
|
||||||
)[0]
|
|
||||||
|
|
||||||
# setup round off account
|
|
||||||
if acc := frappe.db.exists(
|
|
||||||
"Account",
|
|
||||||
{
|
|
||||||
"account_name": "Round Off for Opening",
|
|
||||||
"account_type": "Round Off for Opening",
|
|
||||||
"company": company_name,
|
|
||||||
},
|
|
||||||
):
|
|
||||||
frappe.db.set_value("Company", company_name, "round_off_for_opening", acc)
|
|
||||||
else:
|
|
||||||
acc = frappe.new_doc("Account")
|
|
||||||
acc.company = company_name
|
|
||||||
acc.parent_account = liability_root.name
|
|
||||||
acc.account_name = "Round Off for Opening"
|
|
||||||
acc.account_type = "Round Off for Opening"
|
|
||||||
acc.save()
|
|
||||||
frappe.db.set_value("Company", company_name, "round_off_for_opening", acc.name)
|
|
||||||
|
|
||||||
def test_opening_invoice_with_rounding_adjustment(self):
|
|
||||||
si = create_sales_invoice(qty=1, rate=99.98, do_not_submit=True)
|
|
||||||
si.is_opening = "Yes"
|
|
||||||
si.items[0].income_account = "Temporary Opening - _TC"
|
|
||||||
si.save()
|
|
||||||
|
|
||||||
self._create_opening_roundoff_account(si.company)
|
|
||||||
|
|
||||||
si.reload()
|
|
||||||
si.submit()
|
|
||||||
res = frappe.db.get_all(
|
|
||||||
"GL Entry",
|
|
||||||
filters={"voucher_no": si.name, "is_opening": "Yes"},
|
|
||||||
fields=["account", "debit", "credit", "is_opening"],
|
|
||||||
)
|
|
||||||
self.assertEqual(len(res), 3)
|
|
||||||
|
|
||||||
def _create_opening_invoice_with_inclusive_tax(self):
|
|
||||||
si = create_sales_invoice(qty=1, rate=90, do_not_submit=True)
|
|
||||||
si.is_opening = "Yes"
|
|
||||||
si.items[0].income_account = "Temporary Opening - _TC"
|
|
||||||
item_template = si.items[0].as_dict()
|
|
||||||
item_template.name = None
|
|
||||||
item_template.rate = 55
|
|
||||||
si.append("items", item_template)
|
|
||||||
si.append(
|
|
||||||
"taxes",
|
|
||||||
{
|
|
||||||
"charge_type": "On Net Total",
|
|
||||||
"account_head": "_Test Account Service Tax - _TC",
|
|
||||||
"cost_center": "_Test Cost Center - _TC",
|
|
||||||
"description": "Testing...",
|
|
||||||
"rate": 5,
|
|
||||||
"included_in_print_rate": True,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
# there will be 0.01 precision loss between Dr and Cr
|
|
||||||
# caused by 'included_in_print_tax' option
|
|
||||||
si.save()
|
|
||||||
return si
|
|
||||||
|
|
||||||
def test_rounding_validation_for_opening_with_inclusive_tax(self):
|
|
||||||
si = self._create_opening_invoice_with_inclusive_tax()
|
|
||||||
# 'Round Off for Opening' not set in Company master
|
|
||||||
# Ledger level validation must be thrown
|
|
||||||
self.assertRaises(frappe.ValidationError, si.submit)
|
|
||||||
|
|
||||||
def test_ledger_entries_on_opening_invoice_with_rounding_loss_by_inclusive_tax(self):
|
|
||||||
si = self._create_opening_invoice_with_inclusive_tax()
|
|
||||||
# 'Round Off for Opening' is set in Company master
|
|
||||||
self._create_opening_roundoff_account(si.company)
|
|
||||||
|
|
||||||
si.submit()
|
|
||||||
actual = frappe.db.get_all(
|
|
||||||
"GL Entry",
|
|
||||||
filters={"voucher_no": si.name, "is_opening": "Yes", "is_cancelled": False},
|
|
||||||
fields=["account", "debit", "credit", "is_opening"],
|
|
||||||
order_by="account,debit",
|
|
||||||
)
|
|
||||||
expected = [
|
|
||||||
{"account": "_Test Account Service Tax - _TC", "debit": 0.0, "credit": 6.9, "is_opening": "Yes"},
|
|
||||||
{"account": "Debtors - _TC", "debit": 145.0, "credit": 0.0, "is_opening": "Yes"},
|
|
||||||
{"account": "Round Off for Opening - _TC", "debit": 0.0, "credit": 0.01, "is_opening": "Yes"},
|
|
||||||
{"account": "Temporary Opening - _TC", "debit": 0.0, "credit": 138.09, "is_opening": "Yes"},
|
|
||||||
]
|
|
||||||
self.assertEqual(len(actual), 4)
|
|
||||||
self.assertEqual(expected, actual)
|
|
||||||
|
|
||||||
@change_settings("Accounts Settings", {"enable_common_party_accounting": True})
|
@change_settings("Accounts Settings", {"enable_common_party_accounting": True})
|
||||||
def test_common_party_with_foreign_currency_jv(self):
|
def test_common_party_with_foreign_currency_jv(self):
|
||||||
from erpnext.accounts.doctype.account.test_account import create_account
|
from erpnext.accounts.doctype.account.test_account import create_account
|
||||||
@@ -4101,13 +3997,6 @@ class TestSalesInvoice(FrappeTestCase):
|
|||||||
self.assertTrue(jv)
|
self.assertTrue(jv)
|
||||||
self.assertEqual(jv[0], si.grand_total)
|
self.assertEqual(jv[0], si.grand_total)
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
party_link.delete()
|
|
||||||
frappe.db.set_single_value("Accounts Settings", "enable_common_party_accounting", 0)
|
|
||||||
|
|
||||||
>>>>>>> 740a04a704 (test: add unit test for common party with foreign currency)
|
|
||||||
=======
|
|
||||||
>>>>>>> ee94fb37c8 (refactor(test): use change_settings decorator)
|
|
||||||
|
|
||||||
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