fix: sider issues
This commit is contained in:
parent
6099af5d00
commit
5b0ec6437b
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import cint
|
|
||||||
from frappe.utils.nestedset import NestedSet
|
from frappe.utils.nestedset import NestedSet
|
||||||
|
|
||||||
from erpnext.accounts.utils import validate_field_number
|
from erpnext.accounts.utils import validate_field_number
|
||||||
|
@ -58,11 +58,9 @@ class CostCenterAllocation(Document):
|
|||||||
|
|
||||||
if future_allocation:
|
if future_allocation:
|
||||||
frappe.msgprint(_("Another Cost Center Allocation record {0} applicable from {1}, hence this allocation will be applicable upto {2}")
|
frappe.msgprint(_("Another Cost Center Allocation record {0} applicable from {1}, hence this allocation will be applicable upto {2}")
|
||||||
.format(
|
.format(frappe.bold(future_allocation.name), frappe.bold(format_date(future_allocation.valid_from)),
|
||||||
frappe.bold(future_allocation.name),
|
frappe.bold(format_date(add_days(future_allocation.valid_from, -1)))),
|
||||||
frappe.bold(format_date(future_allocation.valid_from)),
|
title=_("Warning!"), indicator="orange", alert=1
|
||||||
frappe.bold(format_date(add_days(future_allocation.valid_from, -1)))
|
|
||||||
), title=_("Warning!"), indicator="orange", alert=1
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def validate_main_cost_center(self):
|
def validate_main_cost_center(self):
|
||||||
|
@ -1,13 +1,21 @@
|
|||||||
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
|
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
# See license.txt
|
# See license.txt
|
||||||
|
|
||||||
import frappe
|
|
||||||
import unittest
|
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.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.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):
|
class TestCostCenterAllocation(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -82,7 +90,6 @@ class TestCostCenterAllocation(unittest.TestCase):
|
|||||||
|
|
||||||
cca1.cancel()
|
cca1.cancel()
|
||||||
|
|
||||||
|
|
||||||
def test_if_child_cost_center_has_any_allocation_record(self):
|
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",
|
cca1 = create_cost_center_allocation("_Test Company", "Main Cost Center 1 - _TC",
|
||||||
@ -129,7 +136,6 @@ class TestCostCenterAllocation(unittest.TestCase):
|
|||||||
|
|
||||||
jv.cancel()
|
jv.cancel()
|
||||||
|
|
||||||
|
|
||||||
def create_cost_center_allocation(company, main_cost_center, allocation_percentages,
|
def create_cost_center_allocation(company, main_cost_center, allocation_percentages,
|
||||||
valid_from=None, valid_upto=None, save=True, submit=True):
|
valid_from=None, valid_upto=None, save=True, submit=True):
|
||||||
doc = frappe.new_doc("Cost Center Allocation")
|
doc = frappe.new_doc("Cost Center Allocation")
|
||||||
|
@ -4,5 +4,6 @@
|
|||||||
# import frappe
|
# import frappe
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
|
|
||||||
class CostCenterAllocationPercentage(Document):
|
class CostCenterAllocationPercentage(Document):
|
||||||
pass
|
pass
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
# License: GNU General Public License v3. See license.txt
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
|
||||||
import frappe
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.model.meta import get_field_precision
|
from frappe.model.meta import get_field_precision
|
||||||
from frappe.utils import cint, cstr, flt, formatdate, getdate, now
|
from frappe.utils import cint, cstr, flt, formatdate, getdate, now
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import today
|
from frappe.utils import today
|
||||||
|
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
for dt in ("cost_center_allocation", "cost_center_allocation_percentage"):
|
for dt in ("cost_center_allocation", "cost_center_allocation_percentage"):
|
||||||
frappe.reload_doc('accounts', 'doctype', dt)
|
frappe.reload_doc('accounts', 'doctype', dt)
|
||||||
@ -22,7 +23,6 @@ def create_new_cost_center_allocation_records(cc_allocations):
|
|||||||
"cost_center": child_cc,
|
"cost_center": child_cc,
|
||||||
"percentage": percentage
|
"percentage": percentage
|
||||||
}))
|
}))
|
||||||
|
|
||||||
cca.save()
|
cca.save()
|
||||||
cca.submit()
|
cca.submit()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user