more refactoring to renaming
This commit is contained in:
parent
76c4f61ffb
commit
b536d36771
@ -90,3 +90,17 @@ class DocType(DocTypeNestedSet):
|
|||||||
|
|
||||||
self.validate_mandatory()
|
self.validate_mandatory()
|
||||||
self.validate_budget_details()
|
self.validate_budget_details()
|
||||||
|
|
||||||
|
def on_rename(self, new, old):
|
||||||
|
company_abbr = webnotes.conn.get_value("Company", self.doc.company_name, "abbr")
|
||||||
|
parts = new.split(" - ")
|
||||||
|
|
||||||
|
if parts[-1].lower() != company_abbr.lower():
|
||||||
|
parts.append(company_abbr)
|
||||||
|
|
||||||
|
# rename account name
|
||||||
|
cost_center_name = " - ".join(parts[:-1])
|
||||||
|
webnotes.conn.sql("update `tabCost Center` set cost_center_name = %s where name = %s", \
|
||||||
|
(cost_center_name, old))
|
||||||
|
|
||||||
|
return " - ".join(parts)
|
||||||
|
@ -1,319 +1,262 @@
|
|||||||
# DocType, Cost Center
|
|
||||||
[
|
[
|
||||||
|
{
|
||||||
# These values are common in all dictionaries
|
"owner": "Administrator",
|
||||||
{
|
"docstatus": 0,
|
||||||
'creation': '2012-07-03 13:30:47',
|
"creation": "2012-07-12 23:29:41",
|
||||||
'docstatus': 0,
|
"modified_by": "Administrator",
|
||||||
'modified': '2012-07-11 14:41:39',
|
"modified": "2012-12-06 12:12:46"
|
||||||
'modified_by': u'Administrator',
|
},
|
||||||
'owner': u'Administrator'
|
{
|
||||||
},
|
"in_create": 1,
|
||||||
|
"search_fields": "name,parent_cost_center",
|
||||||
# These values are common for all DocType
|
"module": "Accounts",
|
||||||
{
|
"document_type": "Master",
|
||||||
'_last_update': u'1317365120',
|
"description": "Track separate Income and Expense for product verticals or divisions.",
|
||||||
'allow_copy': 1,
|
"autoname": "field:cost_center_name",
|
||||||
'allow_trash': 1,
|
"name": "__common__",
|
||||||
'autoname': u'field:cost_center_name',
|
"default_print_format": "Standard",
|
||||||
'colour': u'White:FFF',
|
"allow_rename": 1,
|
||||||
'default_print_format': u'Standard',
|
"doctype": "DocType",
|
||||||
'description': u'**Chart of Accounts** is mainly for reporting information for governmental purposes and less for how business actually performs. \n\nMost businesses have multiple activities like different product lines, market segments, areas of business that share some common overheads but should ideally have their own structure to report whether they are profitable or not. For this purpose, there is an alternate structure, called the **Cost Centers**.\n\nA tree of **Cost Centers** to cab be designed to reflect the different units of an organization. Each Income / Expense entry is also tagged against a **Cost Center** and hence you can get Profit and Loss against a **Cost Center** too.\n\n### Budgeting\n\n**Cost Centers** can be used for budgeting purposes too. A budget can be set against each **Account** and the system will either stop, warn or ignore the budget based on the settings in the **Company** master.\n\nBudgets can also be distributed seasonally using **Budget Distribution**.',
|
"allow_copy": 1
|
||||||
'doctype': 'DocType',
|
},
|
||||||
'document_type': u'Master',
|
{
|
||||||
'in_create': 1,
|
"name": "__common__",
|
||||||
'module': u'Accounts',
|
"parent": "Cost Center",
|
||||||
'name': '__common__',
|
"doctype": "DocField",
|
||||||
'search_fields': u'name,parent_cost_center',
|
"parenttype": "DocType",
|
||||||
'section_style': u'Simple',
|
"parentfield": "fields"
|
||||||
'server_code_error': u' ',
|
},
|
||||||
'show_in_menu': 0,
|
{
|
||||||
'version': 1
|
"name": "__common__",
|
||||||
},
|
"parent": "Cost Center",
|
||||||
|
"read": 1,
|
||||||
# These values are common for all DocField
|
"doctype": "DocPerm",
|
||||||
{
|
"parenttype": "DocType",
|
||||||
'doctype': u'DocField',
|
"parentfield": "permissions"
|
||||||
'name': '__common__',
|
},
|
||||||
'parent': u'Cost Center',
|
{
|
||||||
'parentfield': u'fields',
|
"name": "Cost Center",
|
||||||
'parenttype': u'DocType'
|
"doctype": "DocType"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
# These values are common for all DocPerm
|
"doctype": "DocField",
|
||||||
{
|
"label": "Cost Center Details",
|
||||||
'doctype': u'DocPerm',
|
"fieldname": "sb0",
|
||||||
'name': '__common__',
|
"fieldtype": "Section Break",
|
||||||
'parent': u'Cost Center',
|
"permlevel": 0
|
||||||
'parentfield': u'permissions',
|
},
|
||||||
'parenttype': u'DocType',
|
{
|
||||||
'read': 1
|
"oldfieldtype": "Small Text",
|
||||||
},
|
"doctype": "DocField",
|
||||||
|
"label": "Trash Reason",
|
||||||
# DocType, Cost Center
|
"oldfieldname": "trash_reason",
|
||||||
{
|
"fieldname": "trash_reason",
|
||||||
'doctype': 'DocType',
|
"fieldtype": "Small Text",
|
||||||
'name': u'Cost Center'
|
"permlevel": 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
# DocPerm
|
"no_copy": 1,
|
||||||
{
|
"oldfieldtype": "Data",
|
||||||
'amend': 0,
|
"doctype": "DocField",
|
||||||
'cancel': 0,
|
"label": "Cost Center Name",
|
||||||
'create': 0,
|
"oldfieldname": "cost_center_name",
|
||||||
'doctype': u'DocPerm',
|
"fieldname": "cost_center_name",
|
||||||
'permlevel': 1,
|
"fieldtype": "Data",
|
||||||
'role': u'Accounts Manager',
|
"search_index": 0,
|
||||||
'submit': 0,
|
"reqd": 1,
|
||||||
'write': 0
|
"permlevel": 0,
|
||||||
},
|
"in_filter": 0
|
||||||
|
},
|
||||||
# DocPerm
|
{
|
||||||
{
|
"oldfieldtype": "Link",
|
||||||
'amend': 0,
|
"colour": "White:FFF",
|
||||||
'cancel': 1,
|
"doctype": "DocField",
|
||||||
'create': 1,
|
"label": "Parent Cost Center",
|
||||||
'doctype': u'DocPerm',
|
"oldfieldname": "parent_cost_center",
|
||||||
'permlevel': 0,
|
"trigger": "Client",
|
||||||
'role': u'Accounts Manager',
|
"fieldname": "parent_cost_center",
|
||||||
'submit': 0,
|
"fieldtype": "Link",
|
||||||
'write': 1
|
"reqd": 1,
|
||||||
},
|
"options": "Cost Center",
|
||||||
|
"permlevel": 0
|
||||||
# DocPerm
|
},
|
||||||
{
|
{
|
||||||
'amend': 0,
|
"oldfieldtype": "Link",
|
||||||
'cancel': 0,
|
"colour": "White:FFF",
|
||||||
'create': 0,
|
"doctype": "DocField",
|
||||||
'doctype': u'DocPerm',
|
"label": "Company",
|
||||||
'permlevel': 1,
|
"oldfieldname": "company_name",
|
||||||
'role': u'Accounts User',
|
"trigger": "Client",
|
||||||
'submit': 0,
|
"fieldname": "company_name",
|
||||||
'write': 0
|
"fieldtype": "Link",
|
||||||
},
|
"reqd": 1,
|
||||||
|
"options": "Company",
|
||||||
# DocPerm
|
"permlevel": 0
|
||||||
{
|
},
|
||||||
'amend': 0,
|
{
|
||||||
'cancel': 0,
|
"oldfieldtype": "Data",
|
||||||
'create': 0,
|
"colour": "White:FFF",
|
||||||
'doctype': u'DocPerm',
|
"doctype": "DocField",
|
||||||
'permlevel': 0,
|
"label": "Company Abbr",
|
||||||
'role': u'Accounts User',
|
"oldfieldname": "company_abbr",
|
||||||
'submit': 0,
|
"fieldname": "company_abbr",
|
||||||
'write': 0
|
"fieldtype": "Data",
|
||||||
},
|
"hidden": 1,
|
||||||
|
"permlevel": 1
|
||||||
# DocPerm
|
},
|
||||||
{
|
{
|
||||||
'cancel': 1,
|
"doctype": "DocField",
|
||||||
'create': 1,
|
"width": "50%",
|
||||||
'doctype': u'DocPerm',
|
"fieldname": "cb0",
|
||||||
'permlevel': 0,
|
"fieldtype": "Column Break",
|
||||||
'role': u'System Manager',
|
"permlevel": 0
|
||||||
'write': 1
|
},
|
||||||
},
|
{
|
||||||
|
"print_hide": 1,
|
||||||
# DocPerm
|
"no_copy": 1,
|
||||||
{
|
"oldfieldtype": "Select",
|
||||||
'doctype': u'DocPerm',
|
"colour": "White:FFF",
|
||||||
'permlevel': 1,
|
"doctype": "DocField",
|
||||||
'role': u'All'
|
"label": "Group or Ledger",
|
||||||
},
|
"oldfieldname": "group_or_ledger",
|
||||||
|
"permlevel": 0,
|
||||||
# DocField
|
"trigger": "Client",
|
||||||
{
|
"fieldname": "group_or_ledger",
|
||||||
'doctype': u'DocField',
|
"fieldtype": "Select",
|
||||||
'fieldname': u'sb0',
|
"reqd": 1,
|
||||||
'fieldtype': u'Section Break',
|
"hidden": 0,
|
||||||
'label': u'Cost Center Details',
|
"options": "\nGroup\nLedger",
|
||||||
'permlevel': 0
|
"report_hide": 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
# DocField
|
"description": "Define Budget for this Cost Center. To set budget action, see <a href=\"#!List/Company\">Company Master</a>",
|
||||||
{
|
"colour": "White:FFF",
|
||||||
'doctype': u'DocField',
|
"doctype": "DocField",
|
||||||
'fieldname': u'trash_reason',
|
"label": "Budget",
|
||||||
'fieldtype': u'Small Text',
|
"fieldname": "sb1",
|
||||||
'label': u'Trash Reason',
|
"fieldtype": "Section Break",
|
||||||
'oldfieldname': u'trash_reason',
|
"permlevel": 0
|
||||||
'oldfieldtype': u'Small Text',
|
},
|
||||||
'permlevel': 1
|
{
|
||||||
},
|
"description": "Select Budget Distribution, if you want to track based on seasonality.",
|
||||||
|
"oldfieldtype": "Link",
|
||||||
# DocField
|
"colour": "White:FFF",
|
||||||
{
|
"doctype": "DocField",
|
||||||
'doctype': u'DocField',
|
"label": "Distribution Id",
|
||||||
'fieldname': u'cost_center_name',
|
"oldfieldname": "distribution_id",
|
||||||
'fieldtype': u'Data',
|
"options": "Budget Distribution",
|
||||||
'in_filter': 0,
|
"fieldname": "distribution_id",
|
||||||
'label': u'Cost Center Name',
|
"fieldtype": "Link",
|
||||||
'no_copy': 1,
|
"permlevel": 0
|
||||||
'oldfieldname': u'cost_center_name',
|
},
|
||||||
'oldfieldtype': u'Data',
|
{
|
||||||
'permlevel': 0,
|
"description": "Add rows to set annual budgets on Accounts.",
|
||||||
'reqd': 1,
|
"oldfieldtype": "Table",
|
||||||
'search_index': 0
|
"colour": "White:FFF",
|
||||||
},
|
"doctype": "DocField",
|
||||||
|
"label": "Budget Details",
|
||||||
# DocField
|
"oldfieldname": "budget_details",
|
||||||
{
|
"options": "Budget Detail",
|
||||||
'colour': u'White:FFF',
|
"fieldname": "budget_details",
|
||||||
'doctype': u'DocField',
|
"fieldtype": "Table",
|
||||||
'fieldname': u'parent_cost_center',
|
"permlevel": 0
|
||||||
'fieldtype': u'Link',
|
},
|
||||||
'label': u'Parent Cost Center',
|
{
|
||||||
'oldfieldname': u'parent_cost_center',
|
"print_hide": 1,
|
||||||
'oldfieldtype': u'Link',
|
"no_copy": 1,
|
||||||
'options': u'Cost Center',
|
"oldfieldtype": "Int",
|
||||||
'permlevel': 0,
|
"doctype": "DocField",
|
||||||
'reqd': 1,
|
"label": "lft",
|
||||||
'trigger': u'Client'
|
"oldfieldname": "lft",
|
||||||
},
|
"fieldname": "lft",
|
||||||
|
"fieldtype": "Int",
|
||||||
# DocField
|
"search_index": 1,
|
||||||
{
|
"hidden": 1,
|
||||||
'colour': u'White:FFF',
|
"permlevel": 0,
|
||||||
'doctype': u'DocField',
|
"report_hide": 1,
|
||||||
'fieldname': u'company_name',
|
"in_filter": 1
|
||||||
'fieldtype': u'Link',
|
},
|
||||||
'label': u'Company',
|
{
|
||||||
'oldfieldname': u'company_name',
|
"print_hide": 1,
|
||||||
'oldfieldtype': u'Link',
|
"no_copy": 1,
|
||||||
'options': u'Company',
|
"oldfieldtype": "Int",
|
||||||
'permlevel': 0,
|
"doctype": "DocField",
|
||||||
'reqd': 1,
|
"label": "rgt",
|
||||||
'trigger': u'Client'
|
"oldfieldname": "rgt",
|
||||||
},
|
"fieldname": "rgt",
|
||||||
|
"fieldtype": "Int",
|
||||||
# DocField
|
"search_index": 1,
|
||||||
{
|
"reqd": 0,
|
||||||
'colour': u'White:FFF',
|
"hidden": 1,
|
||||||
'doctype': u'DocField',
|
"permlevel": 0,
|
||||||
'fieldname': u'company_abbr',
|
"report_hide": 1,
|
||||||
'fieldtype': u'Data',
|
"in_filter": 1
|
||||||
'hidden': 1,
|
},
|
||||||
'label': u'Company Abbr',
|
{
|
||||||
'oldfieldname': u'company_abbr',
|
"print_hide": 1,
|
||||||
'oldfieldtype': u'Data',
|
"no_copy": 1,
|
||||||
'permlevel': 1
|
"oldfieldtype": "Data",
|
||||||
},
|
"doctype": "DocField",
|
||||||
|
"label": "old_parent",
|
||||||
# DocField
|
"oldfieldname": "old_parent",
|
||||||
{
|
"permlevel": 0,
|
||||||
'doctype': u'DocField',
|
"fieldname": "old_parent",
|
||||||
'fieldname': u'cb0',
|
"fieldtype": "Link",
|
||||||
'fieldtype': u'Column Break',
|
"hidden": 1,
|
||||||
'permlevel': 0,
|
"options": "Cost Center",
|
||||||
'width': u'50%'
|
"report_hide": 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
# DocField
|
"amend": 0,
|
||||||
{
|
"create": 0,
|
||||||
'colour': u'White:FFF',
|
"doctype": "DocPerm",
|
||||||
'doctype': u'DocField',
|
"submit": 0,
|
||||||
'fieldname': u'group_or_ledger',
|
"write": 0,
|
||||||
'fieldtype': u'Select',
|
"role": "Accounts Manager",
|
||||||
'hidden': 0,
|
"cancel": 0,
|
||||||
'label': u'Group or Ledger',
|
"permlevel": 1
|
||||||
'no_copy': 1,
|
},
|
||||||
'oldfieldname': u'group_or_ledger',
|
{
|
||||||
'oldfieldtype': u'Select',
|
"amend": 0,
|
||||||
'options': u'\nGroup\nLedger',
|
"create": 1,
|
||||||
'permlevel': 0,
|
"doctype": "DocPerm",
|
||||||
'print_hide': 1,
|
"submit": 0,
|
||||||
'report_hide': 1,
|
"write": 1,
|
||||||
'reqd': 1,
|
"role": "Accounts Manager",
|
||||||
'trigger': u'Client'
|
"cancel": 1,
|
||||||
},
|
"permlevel": 0
|
||||||
|
},
|
||||||
# DocField
|
{
|
||||||
{
|
"amend": 0,
|
||||||
'colour': u'White:FFF',
|
"create": 0,
|
||||||
'description': u'Define Budget for this Cost Center. To set budget action, see <a href="#!List/Company">Company Master</a>',
|
"doctype": "DocPerm",
|
||||||
'doctype': u'DocField',
|
"submit": 0,
|
||||||
'fieldname': u'sb1',
|
"write": 0,
|
||||||
'fieldtype': u'Section Break',
|
"role": "Accounts User",
|
||||||
'label': u'Budget',
|
"cancel": 0,
|
||||||
'permlevel': 0
|
"permlevel": 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
# DocField
|
"amend": 0,
|
||||||
{
|
"create": 0,
|
||||||
'colour': u'White:FFF',
|
"doctype": "DocPerm",
|
||||||
'description': u'Select Budget Distribution, if you want to track based on seasonality.',
|
"submit": 0,
|
||||||
'doctype': u'DocField',
|
"write": 0,
|
||||||
'fieldname': u'distribution_id',
|
"role": "Accounts User",
|
||||||
'fieldtype': u'Link',
|
"cancel": 0,
|
||||||
'label': u'Distribution Id',
|
"permlevel": 0
|
||||||
'oldfieldname': u'distribution_id',
|
},
|
||||||
'oldfieldtype': u'Link',
|
{
|
||||||
'options': u'Budget Distribution',
|
"create": 1,
|
||||||
'permlevel': 0
|
"doctype": "DocPerm",
|
||||||
},
|
"write": 1,
|
||||||
|
"role": "System Manager",
|
||||||
# DocField
|
"cancel": 1,
|
||||||
{
|
"permlevel": 0
|
||||||
'colour': u'White:FFF',
|
},
|
||||||
'description': u'Add rows to set annual budgets on Accounts.',
|
{
|
||||||
'doctype': u'DocField',
|
"doctype": "DocPerm",
|
||||||
'fieldname': u'budget_details',
|
"role": "All",
|
||||||
'fieldtype': u'Table',
|
"permlevel": 1
|
||||||
'label': u'Budget Details',
|
}
|
||||||
'oldfieldname': u'budget_details',
|
|
||||||
'oldfieldtype': u'Table',
|
|
||||||
'options': u'Budget Detail',
|
|
||||||
'permlevel': 0
|
|
||||||
},
|
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
|
||||||
'doctype': u'DocField',
|
|
||||||
'fieldname': u'lft',
|
|
||||||
'fieldtype': u'Int',
|
|
||||||
'hidden': 1,
|
|
||||||
'in_filter': 1,
|
|
||||||
'label': u'lft',
|
|
||||||
'no_copy': 1,
|
|
||||||
'oldfieldname': u'lft',
|
|
||||||
'oldfieldtype': u'Int',
|
|
||||||
'permlevel': 0,
|
|
||||||
'print_hide': 1,
|
|
||||||
'report_hide': 1,
|
|
||||||
'search_index': 1
|
|
||||||
},
|
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
|
||||||
'doctype': u'DocField',
|
|
||||||
'fieldname': u'rgt',
|
|
||||||
'fieldtype': u'Int',
|
|
||||||
'hidden': 1,
|
|
||||||
'in_filter': 1,
|
|
||||||
'label': u'rgt',
|
|
||||||
'no_copy': 1,
|
|
||||||
'oldfieldname': u'rgt',
|
|
||||||
'oldfieldtype': u'Int',
|
|
||||||
'permlevel': 0,
|
|
||||||
'print_hide': 1,
|
|
||||||
'report_hide': 1,
|
|
||||||
'reqd': 0,
|
|
||||||
'search_index': 1
|
|
||||||
},
|
|
||||||
|
|
||||||
# DocField
|
|
||||||
{
|
|
||||||
'doctype': u'DocField',
|
|
||||||
'fieldname': u'old_parent',
|
|
||||||
'fieldtype': u'Link',
|
|
||||||
'hidden': 1,
|
|
||||||
'label': u'old_parent',
|
|
||||||
'no_copy': 1,
|
|
||||||
'oldfieldname': u'old_parent',
|
|
||||||
'oldfieldtype': u'Data',
|
|
||||||
'options': u'Cost Center',
|
|
||||||
'permlevel': 0,
|
|
||||||
'print_hide': 1,
|
|
||||||
'report_hide': 1
|
|
||||||
}
|
|
||||||
]
|
]
|
@ -1,10 +1,13 @@
|
|||||||
erpnext.updates = [
|
erpnext.updates = [
|
||||||
|
["6th December 2012", [
|
||||||
|
"Rename: Cost Center, Item Group, Customer Group, Supplier Type, Territory, Sales Person can now be renamed.",
|
||||||
|
]],
|
||||||
["5th December 2012", [
|
["5th December 2012", [
|
||||||
"Leave Application: Now can set approver.",
|
"Leave Application: Now can set approver.",
|
||||||
"New Roles Added: Leave Approver and Expense Approver.",
|
"New Roles Added: Leave Approver and Expense Approver.",
|
||||||
"Production Order is now linked with sales order.",
|
"Production Order: Now linked with Sales Order.",
|
||||||
"Production Planning Tool: The field 'Allow SA items as raw material' has been renamed to 'Use multi-level BOM', 'Include in plan' column from SO table has been deleted",
|
"Production Planning Tool: The field 'Allow SA items as raw material' has been renamed to 'Use multi-level BOM', 'Include in plan' column from SO table has been deleted",
|
||||||
"Batch nos are now filtered with item and available qty",
|
"Batch Numbers: Batch nos are now filtered with Item and available qty at time of selection in transactions.",
|
||||||
"BOM: 'Update Costing' button has been deleted, once submitted cost are fixed.",
|
"BOM: 'Update Costing' button has been deleted, once submitted cost are fixed.",
|
||||||
"[For indian customer only] Deprecated TDS related documents and fields. Old TDS amount added into tax table in Purchase Invoice and entries table in case of JV",
|
"[For indian customer only] Deprecated TDS related documents and fields. Old TDS amount added into tax table in Purchase Invoice and entries table in case of JV",
|
||||||
]],
|
]],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user