mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
32 lines
967 B
Python
32 lines
967 B
Python
from unittest.mock import patch
|
|
|
|
import frappe
|
|
|
|
from erpnext.controllers.taxes_and_totals import calculate_taxes_and_totals
|
|
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
|
|
from erpnext.tests.utils import ERPNextTestSuite
|
|
|
|
|
|
class TestTaxesAndTotals(ERPNextTestSuite):
|
|
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)
|