fix: remove enable_allow_cost_center_in_entry_of_bs_account
This commit is contained in:
parent
0a42d81993
commit
706c239cf6
@ -20,7 +20,6 @@ class AccountsSettings(Document):
|
||||
|
||||
self.validate_stale_days()
|
||||
self.enable_payment_schedule_in_print()
|
||||
self.enable_fields_for_cost_center_settings()
|
||||
|
||||
def validate_stale_days(self):
|
||||
if not self.allow_stale and cint(self.stale_days) <= 0:
|
||||
@ -33,8 +32,3 @@ class AccountsSettings(Document):
|
||||
for doctype in ("Sales Order", "Sales Invoice", "Purchase Order", "Purchase Invoice"):
|
||||
make_property_setter(doctype, "due_date", "print_hide", show_in_print, "Check")
|
||||
make_property_setter(doctype, "payment_schedule", "print_hide", 0 if show_in_print else 1, "Check")
|
||||
|
||||
def enable_fields_for_cost_center_settings(self):
|
||||
show_field = 0 if cint(self.allow_cost_center_in_entry_of_bs_account) else 1
|
||||
for doctype in ("Sales Invoice", "Purchase Invoice", "Payment Entry"):
|
||||
make_property_setter(doctype, "cost_center", "hidden", show_field, "Check")
|
||||
|
@ -204,11 +204,8 @@ class TestJournalEntry(unittest.TestCase):
|
||||
self.assertEqual(jv.inter_company_journal_entry_reference, "")
|
||||
self.assertEqual(jv1.inter_company_journal_entry_reference, "")
|
||||
|
||||
def test_jv_for_enable_allow_cost_center_in_entry_of_bs_account(self):
|
||||
def test_jv_with_cost_centre(self):
|
||||
from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center
|
||||
accounts_settings = frappe.get_doc('Accounts Settings', 'Accounts Settings')
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 1
|
||||
accounts_settings.save()
|
||||
cost_center = "_Test Cost Center for BS Account - _TC"
|
||||
create_cost_center(cost_center_name="_Test Cost Center for BS Account", company="_Test Company")
|
||||
jv = make_journal_entry("_Test Cash - _TC", "_Test Bank - _TC", 100, cost_center = cost_center, save=False)
|
||||
@ -237,15 +234,9 @@ class TestJournalEntry(unittest.TestCase):
|
||||
for gle in gl_entries:
|
||||
self.assertEqual(expected_values[gle.account]["cost_center"], gle.cost_center)
|
||||
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 0
|
||||
accounts_settings.save()
|
||||
|
||||
def test_jv_account_and_party_balance_for_enable_allow_cost_center_in_entry_of_bs_account(self):
|
||||
def test_jv_account_and_party_balance_with_cost_centre(self):
|
||||
from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center
|
||||
from erpnext.accounts.utils import get_balance_on
|
||||
accounts_settings = frappe.get_doc('Accounts Settings', 'Accounts Settings')
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 1
|
||||
accounts_settings.save()
|
||||
cost_center = "_Test Cost Center for BS Account - _TC"
|
||||
create_cost_center(cost_center_name="_Test Cost Center for BS Account", company="_Test Company")
|
||||
jv = make_journal_entry("_Test Cash - _TC", "_Test Bank - _TC", 100, cost_center = cost_center, save=False)
|
||||
@ -261,9 +252,6 @@ class TestJournalEntry(unittest.TestCase):
|
||||
account_balance = get_balance_on(account="_Test Bank - _TC", cost_center=cost_center)
|
||||
self.assertEqual(expected_account_balance, account_balance)
|
||||
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 0
|
||||
accounts_settings.save()
|
||||
|
||||
def make_journal_entry(account1, account2, amount, cost_center=None, posting_date=None, exchange_rate=1, save=True, submit=False, project=None):
|
||||
if not cost_center:
|
||||
cost_center = "_Test Cost Center - _TC"
|
||||
|
@ -438,11 +438,8 @@ class TestPaymentEntry(unittest.TestCase):
|
||||
outstanding_amount = flt(frappe.db.get_value("Sales Invoice", si.name, "outstanding_amount"))
|
||||
self.assertEqual(outstanding_amount, 0)
|
||||
|
||||
def test_payment_entry_against_sales_invoice_for_enable_allow_cost_center_in_entry_of_bs_account(self):
|
||||
def test_payment_entry_against_sales_invoice_with_cost_centre(self):
|
||||
from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center
|
||||
accounts_settings = frappe.get_doc('Accounts Settings', 'Accounts Settings')
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 1
|
||||
accounts_settings.save()
|
||||
cost_center = "_Test Cost Center for BS Account - _TC"
|
||||
create_cost_center(cost_center_name="_Test Cost Center for BS Account", company="_Test Company")
|
||||
|
||||
@ -477,39 +474,8 @@ class TestPaymentEntry(unittest.TestCase):
|
||||
for gle in gl_entries:
|
||||
self.assertEqual(expected_values[gle.account]["cost_center"], gle.cost_center)
|
||||
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 0
|
||||
accounts_settings.save()
|
||||
|
||||
def test_payment_entry_against_sales_invoice_for_disable_allow_cost_center_in_entry_of_bs_account(self):
|
||||
accounts_settings = frappe.get_doc('Accounts Settings', 'Accounts Settings')
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 0
|
||||
accounts_settings.save()
|
||||
si = create_sales_invoice(debit_to="Debtors - _TC")
|
||||
|
||||
pe = get_payment_entry("Sales Invoice", si.name, bank_account="_Test Bank - _TC")
|
||||
|
||||
pe.reference_no = "112211-2"
|
||||
pe.reference_date = nowdate()
|
||||
pe.paid_to = "_Test Bank - _TC"
|
||||
pe.paid_amount = si.grand_total
|
||||
pe.insert()
|
||||
pe.submit()
|
||||
|
||||
gl_entries = frappe.db.sql("""select account, cost_center, account_currency, debit, credit,
|
||||
debit_in_account_currency, credit_in_account_currency
|
||||
from `tabGL Entry` where voucher_type='Payment Entry' and voucher_no=%s
|
||||
order by account asc""", pe.name, as_dict=1)
|
||||
|
||||
self.assertTrue(gl_entries)
|
||||
|
||||
for gle in gl_entries:
|
||||
self.assertEqual(gle.cost_center, None)
|
||||
|
||||
def test_payment_entry_against_purchase_invoice_for_enable_allow_cost_center_in_entry_of_bs_account(self):
|
||||
def test_payment_entry_against_purchase_invoice_with_cost_center(self):
|
||||
from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center
|
||||
accounts_settings = frappe.get_doc('Accounts Settings', 'Accounts Settings')
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 1
|
||||
accounts_settings.save()
|
||||
cost_center = "_Test Cost Center for BS Account - _TC"
|
||||
create_cost_center(cost_center_name="_Test Cost Center for BS Account", company="_Test Company")
|
||||
|
||||
@ -544,40 +510,9 @@ class TestPaymentEntry(unittest.TestCase):
|
||||
for gle in gl_entries:
|
||||
self.assertEqual(expected_values[gle.account]["cost_center"], gle.cost_center)
|
||||
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 0
|
||||
accounts_settings.save()
|
||||
|
||||
def test_payment_entry_against_purchase_invoice_for_disable_allow_cost_center_in_entry_of_bs_account(self):
|
||||
accounts_settings = frappe.get_doc('Accounts Settings', 'Accounts Settings')
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 0
|
||||
accounts_settings.save()
|
||||
pi = make_purchase_invoice(credit_to="Creditors - _TC")
|
||||
|
||||
pe = get_payment_entry("Purchase Invoice", pi.name, bank_account="_Test Bank - _TC")
|
||||
|
||||
pe.reference_no = "112222-2"
|
||||
pe.reference_date = nowdate()
|
||||
pe.paid_from = "_Test Bank - _TC"
|
||||
pe.paid_amount = pi.grand_total
|
||||
pe.insert()
|
||||
pe.submit()
|
||||
|
||||
gl_entries = frappe.db.sql("""select account, cost_center, account_currency, debit, credit,
|
||||
debit_in_account_currency, credit_in_account_currency
|
||||
from `tabGL Entry` where voucher_type='Payment Entry' and voucher_no=%s
|
||||
order by account asc""", pe.name, as_dict=1)
|
||||
|
||||
self.assertTrue(gl_entries)
|
||||
|
||||
for gle in gl_entries:
|
||||
self.assertEqual(gle.cost_center, None)
|
||||
|
||||
def test_payment_entry_account_and_party_balance_for_enable_allow_cost_center_in_entry_of_bs_account(self):
|
||||
def test_payment_entry_account_and_party_balance_with_cost_center(self):
|
||||
from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center
|
||||
from erpnext.accounts.utils import get_balance_on
|
||||
accounts_settings = frappe.get_doc('Accounts Settings', 'Accounts Settings')
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 1
|
||||
accounts_settings.save()
|
||||
cost_center = "_Test Cost Center for BS Account - _TC"
|
||||
create_cost_center(cost_center_name="_Test Cost Center for BS Account", company="_Test Company")
|
||||
|
||||
@ -606,7 +541,4 @@ class TestPaymentEntry(unittest.TestCase):
|
||||
self.assertEqual(pe.cost_center, si.cost_center)
|
||||
self.assertEqual(expected_account_balance, account_balance)
|
||||
self.assertEqual(expected_party_balance, party_balance)
|
||||
self.assertEqual(expected_party_account_balance, party_account_balance)
|
||||
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 0
|
||||
accounts_settings.save()
|
||||
self.assertEqual(expected_party_account_balance, party_account_balance)
|
@ -791,11 +791,8 @@ class TestPurchaseInvoice(unittest.TestCase):
|
||||
pi_doc = frappe.get_doc('Purchase Invoice', pi.name)
|
||||
self.assertEqual(pi_doc.outstanding_amount, 0)
|
||||
|
||||
def test_purchase_invoice_for_enable_allow_cost_center_in_entry_of_bs_account(self):
|
||||
def test_purchase_invoice_with_cost_center(self):
|
||||
from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center
|
||||
accounts_settings = frappe.get_doc('Accounts Settings', 'Accounts Settings')
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 1
|
||||
accounts_settings.save()
|
||||
cost_center = "_Test Cost Center for BS Account - _TC"
|
||||
create_cost_center(cost_center_name="_Test Cost Center for BS Account", company="_Test Company")
|
||||
|
||||
@ -821,13 +818,7 @@ class TestPurchaseInvoice(unittest.TestCase):
|
||||
for gle in gl_entries:
|
||||
self.assertEqual(expected_values[gle.account]["cost_center"], gle.cost_center)
|
||||
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 0
|
||||
accounts_settings.save()
|
||||
|
||||
def test_purchase_invoice_for_disable_allow_cost_center_in_entry_of_bs_account(self):
|
||||
accounts_settings = frappe.get_doc('Accounts Settings', 'Accounts Settings')
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 0
|
||||
accounts_settings.save()
|
||||
def test_purchase_invoice_without_cost_center(self):
|
||||
cost_center = "_Test Cost Center - _TC"
|
||||
pi = make_purchase_invoice(credit_to="Creditors - _TC")
|
||||
|
||||
|
@ -1633,11 +1633,8 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
si_doc = frappe.get_doc('Sales Invoice', si.name)
|
||||
self.assertEqual(si_doc.outstanding_amount, 0)
|
||||
|
||||
def test_sales_invoice_for_enable_allow_cost_center_in_entry_of_bs_account(self):
|
||||
def test_sales_invoice_with_cost_center(self):
|
||||
from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center
|
||||
accounts_settings = frappe.get_doc('Accounts Settings', 'Accounts Settings')
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 1
|
||||
accounts_settings.save()
|
||||
cost_center = "_Test Cost Center for BS Account - _TC"
|
||||
create_cost_center(cost_center_name="_Test Cost Center for BS Account", company="_Test Company")
|
||||
|
||||
@ -1663,13 +1660,7 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
for gle in gl_entries:
|
||||
self.assertEqual(expected_values[gle.account]["cost_center"], gle.cost_center)
|
||||
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 0
|
||||
accounts_settings.save()
|
||||
|
||||
def test_sales_invoice_for_disable_allow_cost_center_in_entry_of_bs_account(self):
|
||||
accounts_settings = frappe.get_doc('Accounts Settings', 'Accounts Settings')
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 1
|
||||
accounts_settings.save()
|
||||
def test_sales_invoice_without_cost_center(self):
|
||||
cost_center = "_Test Cost Center - _TC"
|
||||
si = create_sales_invoice(debit_to="Debtors - _TC")
|
||||
|
||||
@ -1692,9 +1683,6 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
for gle in gl_entries:
|
||||
self.assertEqual(expected_values[gle.account]["cost_center"], gle.cost_center)
|
||||
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 0
|
||||
accounts_settings.save()
|
||||
|
||||
def test_deferred_revenue(self):
|
||||
deferred_account = create_account(account_name="Deferred Revenue",
|
||||
parent_account="Current Liabilities - _TC", company="_Test Company")
|
||||
|
@ -547,11 +547,8 @@ class TestDeliveryNote(unittest.TestCase):
|
||||
dt = make_delivery_trip(dn.name)
|
||||
self.assertEqual(dn.name, dt.delivery_stops[0].delivery_note)
|
||||
|
||||
def test_delivery_note_for_enable_allow_cost_center_in_entry_of_bs_account(self):
|
||||
def test_delivery_note_with_cost_center(self):
|
||||
from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center
|
||||
accounts_settings = frappe.get_doc('Accounts Settings', 'Accounts Settings')
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 1
|
||||
accounts_settings.save()
|
||||
cost_center = "_Test Cost Center for BS Account - TCP1"
|
||||
create_cost_center(cost_center_name="_Test Cost Center for BS Account", company="_Test Company with perpetual inventory")
|
||||
|
||||
@ -577,13 +574,8 @@ class TestDeliveryNote(unittest.TestCase):
|
||||
}
|
||||
for i, gle in enumerate(gl_entries):
|
||||
self.assertEqual(expected_values[gle.account]["cost_center"], gle.cost_center)
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 0
|
||||
accounts_settings.save()
|
||||
|
||||
def test_delivery_note_for_disable_allow_cost_center_in_entry_of_bs_account(self):
|
||||
accounts_settings = frappe.get_doc('Accounts Settings', 'Accounts Settings')
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 0
|
||||
accounts_settings.save()
|
||||
def test_delivery_note_without_cost_center(self):
|
||||
cost_center = "Main - TCP1"
|
||||
|
||||
company = frappe.db.get_value('Warehouse', 'Stores - TCP1', 'company')
|
||||
|
@ -372,11 +372,8 @@ class TestPurchaseReceipt(unittest.TestCase):
|
||||
location = frappe.db.get_value('Asset', assets[0].name, 'location')
|
||||
self.assertEquals(location, "Test Location")
|
||||
|
||||
def test_purchase_receipt_for_enable_allow_cost_center_in_entry_of_bs_account(self):
|
||||
def test_purchase_receipt_cost_center(self):
|
||||
from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center
|
||||
accounts_settings = frappe.get_doc('Accounts Settings', 'Accounts Settings')
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 1
|
||||
accounts_settings.save()
|
||||
cost_center = "_Test Cost Center for BS Account - TCP1"
|
||||
create_cost_center(cost_center_name="_Test Cost Center for BS Account", company="_Test Company with perpetual inventory")
|
||||
|
||||
@ -404,14 +401,7 @@ class TestPurchaseReceipt(unittest.TestCase):
|
||||
for i, gle in enumerate(gl_entries):
|
||||
self.assertEqual(expected_values[gle.account]["cost_center"], gle.cost_center)
|
||||
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 0
|
||||
accounts_settings.save()
|
||||
|
||||
def test_purchase_receipt_for_disable_allow_cost_center_in_entry_of_bs_account(self):
|
||||
accounts_settings = frappe.get_doc('Accounts Settings', 'Accounts Settings')
|
||||
accounts_settings.allow_cost_center_in_entry_of_bs_account = 0
|
||||
accounts_settings.save()
|
||||
|
||||
def test_purchase_receipt_without_cost_center(self):
|
||||
if not frappe.db.exists('Location', 'Test Location'):
|
||||
frappe.get_doc({
|
||||
'doctype': 'Location',
|
||||
|
Loading…
x
Reference in New Issue
Block a user