mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-23 13:12:22 +01:00
test: regional account correctly added to round off accounts
This commit is contained in:
31
erpnext/controllers/tests/test_taxes_and_totals.py
Normal file
31
erpnext/controllers/tests/test_taxes_and_totals.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from unittest.mock import patch
|
||||
|
||||
import frappe
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
from erpnext.controllers.taxes_and_totals import calculate_taxes_and_totals
|
||||
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
|
||||
|
||||
|
||||
class TestTaxesAndTotals(IntegrationTestCase):
|
||||
def test_regional_round_off_accounts(self):
|
||||
"""
|
||||
Regional overrides cannot extend the list in-place — the return
|
||||
value must be assigned back to frappe.flags.round_off_applicable_accounts.
|
||||
"""
|
||||
test_account = "_Test Round Off Account"
|
||||
|
||||
def mock_regional(company, account_list: list) -> list:
|
||||
# Simulates a regional override
|
||||
account_list.extend([test_account])
|
||||
return account_list
|
||||
|
||||
so = make_sales_order(do_not_save=True)
|
||||
|
||||
with patch(
|
||||
"erpnext.controllers.taxes_and_totals.get_regional_round_off_accounts",
|
||||
mock_regional,
|
||||
):
|
||||
calculate_taxes_and_totals(so)
|
||||
|
||||
self.assertIn(test_account, frappe.flags.round_off_applicable_accounts)
|
||||
Reference in New Issue
Block a user