Merge pull request #39363 from frappe/revert-39248-set-against-accounts-for-backend-JVs
Revert "fix: JV GLEs for auto-set against accounts"
This commit is contained in:
commit
53f6cfb216
@ -765,7 +765,6 @@ class JournalEntry(AccountsController):
|
|||||||
self.get_debited_credited_accounts()
|
self.get_debited_credited_accounts()
|
||||||
if len(self.accounts_credited) > 1 and len(self.accounts_debited) > 1:
|
if len(self.accounts_credited) > 1 and len(self.accounts_debited) > 1:
|
||||||
self.auto_set_against_accounts()
|
self.auto_set_against_accounts()
|
||||||
self.separate_against_account_entries = 0
|
|
||||||
return
|
return
|
||||||
self.get_against_accounts()
|
self.get_against_accounts()
|
||||||
|
|
||||||
@ -1036,7 +1035,7 @@ class JournalEntry(AccountsController):
|
|||||||
transaction_currency_map = self.get_transaction_currency_map()
|
transaction_currency_map = self.get_transaction_currency_map()
|
||||||
company_currency = erpnext.get_company_currency(self.company)
|
company_currency = erpnext.get_company_currency(self.company)
|
||||||
|
|
||||||
self.set_against_account()
|
self.get_against_accounts()
|
||||||
for d in self.get("accounts"):
|
for d in self.get("accounts"):
|
||||||
if d.debit or d.credit or (self.voucher_type == "Exchange Gain Or Loss"):
|
if d.debit or d.credit or (self.voucher_type == "Exchange Gain Or Loss"):
|
||||||
r = [d.user_remark, self.remark]
|
r = [d.user_remark, self.remark]
|
||||||
|
@ -426,86 +426,17 @@ class TestJournalEntry(unittest.TestCase):
|
|||||||
account_balance = get_balance_on(account="_Test Bank - _TC", cost_center=cost_center)
|
account_balance = get_balance_on(account="_Test Bank - _TC", cost_center=cost_center)
|
||||||
self.assertEqual(expected_account_balance, account_balance)
|
self.assertEqual(expected_account_balance, account_balance)
|
||||||
|
|
||||||
def test_auto_set_against_accounts_for_jv(self):
|
|
||||||
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import check_gl_entries
|
|
||||||
|
|
||||||
# Check entries when against accounts are auto-set
|
|
||||||
account_list = [
|
|
||||||
{
|
|
||||||
"account": "_Test Receivable - _TC",
|
|
||||||
"debit_in_account_currency": 1000,
|
|
||||||
"party_type": "Customer",
|
|
||||||
"party": "_Test Customer",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"account": "_Test Bank - _TC",
|
|
||||||
"credit_in_account_currency": 1000,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"account": "Debtors - _TC",
|
|
||||||
"credit_in_account_currency": 2000,
|
|
||||||
"party_type": "Customer",
|
|
||||||
"party": "_Test Customer",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"account": "Sales - _TC",
|
|
||||||
"debit_in_account_currency": 2000,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
jv = make_journal_entry(account_list=account_list, submit=True)
|
|
||||||
expected_gle = [
|
|
||||||
["_Test Bank - _TC", 0.0, 1000.0, nowdate(), "_Test Customer"],
|
|
||||||
["_Test Receivable - _TC", 1000.0, 0.0, nowdate(), "_Test Bank - _TC"],
|
|
||||||
["Debtors - _TC", 0.0, 2000.0, nowdate(), "Sales - _TC"],
|
|
||||||
["Sales - _TC", 2000.0, 0.0, nowdate(), "_Test Customer"],
|
|
||||||
]
|
|
||||||
check_gl_entries(
|
|
||||||
doc=self,
|
|
||||||
voucher_type="Journal Entry",
|
|
||||||
voucher_no=jv.name,
|
|
||||||
posting_date=nowdate(),
|
|
||||||
expected_gle=expected_gle,
|
|
||||||
additional_columns=["against_link"],
|
|
||||||
)
|
|
||||||
|
|
||||||
# Check entries when against accounts are explicitly set
|
|
||||||
account_list[0]["debit_in_account_currency"] = 5000
|
|
||||||
account_list[1]["credit_in_account_currency"] = 7000
|
|
||||||
account_list[2]["credit_in_account_currency"] = 3000
|
|
||||||
account_list[3]["debit_in_account_currency"] = 5000
|
|
||||||
|
|
||||||
# Only set against for Sales Account
|
|
||||||
account_list[3]["against_type"] = "Customer"
|
|
||||||
account_list[3]["against_account_link"] = "_Test Customer"
|
|
||||||
|
|
||||||
jv = make_journal_entry(account_list=account_list, submit=True)
|
|
||||||
expected_gle = [
|
|
||||||
["_Test Bank - _TC", 0.0, 7000.0, nowdate(), None],
|
|
||||||
["_Test Receivable - _TC", 5000.0, 0.0, nowdate(), None],
|
|
||||||
["Debtors - _TC", 0.0, 3000.0, nowdate(), None],
|
|
||||||
["Sales - _TC", 5000.0, 0.0, nowdate(), "_Test Customer"],
|
|
||||||
]
|
|
||||||
check_gl_entries(
|
|
||||||
doc=self,
|
|
||||||
voucher_type="Journal Entry",
|
|
||||||
voucher_no=jv.name,
|
|
||||||
posting_date=nowdate(),
|
|
||||||
expected_gle=expected_gle,
|
|
||||||
additional_columns=["against_link"],
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def make_journal_entry(
|
def make_journal_entry(
|
||||||
account1=None,
|
account1,
|
||||||
account2=None,
|
account2,
|
||||||
amount=None,
|
amount,
|
||||||
cost_center=None,
|
cost_center=None,
|
||||||
posting_date=None,
|
posting_date=None,
|
||||||
exchange_rate=1,
|
exchange_rate=1,
|
||||||
save=True,
|
save=True,
|
||||||
submit=False,
|
submit=False,
|
||||||
project=None,
|
project=None,
|
||||||
account_list=None,
|
|
||||||
):
|
):
|
||||||
if not cost_center:
|
if not cost_center:
|
||||||
cost_center = "_Test Cost Center - _TC"
|
cost_center = "_Test Cost Center - _TC"
|
||||||
@ -517,8 +448,7 @@ def make_journal_entry(
|
|||||||
jv.multi_currency = 1
|
jv.multi_currency = 1
|
||||||
jv.set(
|
jv.set(
|
||||||
"accounts",
|
"accounts",
|
||||||
account_list
|
[
|
||||||
or [
|
|
||||||
{
|
{
|
||||||
"account": account1,
|
"account": account1,
|
||||||
"cost_center": cost_center,
|
"cost_center": cost_center,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user