fix: sider issues
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.py b/erpnext/accounts/doctype/cost_center/cost_center.py
index 558c516..07cc076 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.py
+++ b/erpnext/accounts/doctype/cost_center/cost_center.py
@@ -4,7 +4,6 @@
import frappe
from frappe import _
-from frappe.utils import cint
from frappe.utils.nestedset import NestedSet
from erpnext.accounts.utils import validate_field_number
diff --git a/erpnext/accounts/doctype/cost_center_allocation/cost_center_allocation.js b/erpnext/accounts/doctype/cost_center_allocation/cost_center_allocation.js
index bdc7b18..ab0baab 100644
--- a/erpnext/accounts/doctype/cost_center_allocation/cost_center_allocation.js
+++ b/erpnext/accounts/doctype/cost_center_allocation/cost_center_allocation.js
@@ -9,7 +9,7 @@
"company": frm.doc.company
});
}
-
+
frm.set_query('main_cost_center', function() {
return {
filters: filters
diff --git a/erpnext/accounts/doctype/cost_center_allocation/cost_center_allocation.py b/erpnext/accounts/doctype/cost_center_allocation/cost_center_allocation.py
index 00a591a..bad3fb4 100644
--- a/erpnext/accounts/doctype/cost_center_allocation/cost_center_allocation.py
+++ b/erpnext/accounts/doctype/cost_center_allocation/cost_center_allocation.py
@@ -58,11 +58,9 @@
if future_allocation:
frappe.msgprint(_("Another Cost Center Allocation record {0} applicable from {1}, hence this allocation will be applicable upto {2}")
- .format(
- frappe.bold(future_allocation.name),
- frappe.bold(format_date(future_allocation.valid_from)),
- frappe.bold(format_date(add_days(future_allocation.valid_from, -1)))
- ), title=_("Warning!"), indicator="orange", alert=1
+ .format(frappe.bold(future_allocation.name), frappe.bold(format_date(future_allocation.valid_from)),
+ frappe.bold(format_date(add_days(future_allocation.valid_from, -1)))),
+ title=_("Warning!"), indicator="orange", alert=1
)
def validate_main_cost_center(self):
diff --git a/erpnext/accounts/doctype/cost_center_allocation/test_cost_center_allocation.py b/erpnext/accounts/doctype/cost_center_allocation/test_cost_center_allocation.py
index 137ab7d..9cf4c00 100644
--- a/erpnext/accounts/doctype/cost_center_allocation/test_cost_center_allocation.py
+++ b/erpnext/accounts/doctype/cost_center_allocation/test_cost_center_allocation.py
@@ -1,13 +1,21 @@
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-import frappe
import unittest
-from frappe.utils import today, add_days
+
+import frappe
+from frappe.utils import add_days, today
+
from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center
+from erpnext.accounts.doctype.cost_center_allocation.cost_center_allocation import (
+ InvalidChildCostCenter,
+ InvalidDateError,
+ InvalidMainCostCenter,
+ MainCostCenterCantBeChild,
+ WrongPercentageAllocation,
+)
from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
-from erpnext.accounts.doctype.cost_center_allocation.cost_center_allocation import (MainCostCenterCantBeChild,
- InvalidMainCostCenter, InvalidChildCostCenter, WrongPercentageAllocation, InvalidDateError)
+
class TestCostCenterAllocation(unittest.TestCase):
def setUp(self):
@@ -22,7 +30,7 @@
"Sub Cost Center 2 - _TC": 40
}
)
-
+
jv = make_journal_entry("_Test Cash - _TC", "Sales - _TC", 100,
cost_center = "Main Cost Center 1 - _TC", submit=True)
@@ -77,14 +85,13 @@
"Sub Cost Center 2 - _TC": 100
}, save=False
)
-
+
self.assertRaises(InvalidMainCostCenter, cca2.save)
cca1.cancel()
-
-
+
def test_if_child_cost_center_has_any_allocation_record(self):
- # Check if any child cost center is used as main cost center in any other existing allocation
+ # Check if any child cost center is used as main cost center in any other existing allocation
cca1 = create_cost_center_allocation("_Test Company", "Main Cost Center 1 - _TC",
{
"Sub Cost Center 1 - _TC": 60,
@@ -98,7 +105,7 @@
"Sub Cost Center 1 - _TC": 40
}, save=False
)
-
+
self.assertRaises(InvalidChildCostCenter, cca2.save)
cca1.cancel()
@@ -128,7 +135,6 @@
self.assertRaises(InvalidDateError, cca.save)
jv.cancel()
-
def create_cost_center_allocation(company, main_cost_center, allocation_percentages,
valid_from=None, valid_upto=None, save=True, submit=True):
diff --git a/erpnext/accounts/doctype/cost_center_allocation_percentage/cost_center_allocation_percentage.py b/erpnext/accounts/doctype/cost_center_allocation_percentage/cost_center_allocation_percentage.py
index 9214884..7d20efb 100644
--- a/erpnext/accounts/doctype/cost_center_allocation_percentage/cost_center_allocation_percentage.py
+++ b/erpnext/accounts/doctype/cost_center_allocation_percentage/cost_center_allocation_percentage.py
@@ -4,5 +4,6 @@
# import frappe
from frappe.model.document import Document
+
class CostCenterAllocationPercentage(Document):
pass
diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py
index 6b73e3c..55bc967 100644
--- a/erpnext/accounts/general_ledger.py
+++ b/erpnext/accounts/general_ledger.py
@@ -2,8 +2,9 @@
# License: GNU General Public License v3. See license.txt
-import frappe
import copy
+
+import frappe
from frappe import _
from frappe.model.meta import get_field_precision
from frappe.utils import cint, cstr, flt, formatdate, getdate, now
@@ -101,7 +102,7 @@
for d in records:
cc_allocation.setdefault(d.main_cost_center, frappe._dict())\
.setdefault(d.cost_center, d.percentage)
-
+
return cc_allocation
def merge_similar_entries(gl_map, precision=None):
diff --git a/erpnext/patches/v14_0/migrate_cost_center_allocations.py b/erpnext/patches/v14_0/migrate_cost_center_allocations.py
index d101307..3d217d8 100644
--- a/erpnext/patches/v14_0/migrate_cost_center_allocations.py
+++ b/erpnext/patches/v14_0/migrate_cost_center_allocations.py
@@ -1,6 +1,7 @@
import frappe
from frappe.utils import today
+
def execute():
for dt in ("cost_center_allocation", "cost_center_allocation_percentage"):
frappe.reload_doc('accounts', 'doctype', dt)
@@ -22,7 +23,6 @@
"cost_center": child_cc,
"percentage": percentage
}))
-
cca.save()
cca.submit()