fix: Minor fixes in cost center
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.js b/erpnext/accounts/doctype/cost_center/cost_center.js
index f341f78..ee23b1b 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.js
+++ b/erpnext/accounts/doctype/cost_center/cost_center.js
@@ -71,8 +71,13 @@
"label": "Cost Center Number",
"fieldname": "cost_center_number",
"fieldtype": "Data",
- "reqd": 1,
"default": frm.doc.cost_center_number
+ },
+ {
+ "label": __("Merge with existing"),
+ "fieldname": "merge",
+ "fieldtype": "Check",
+ "default": 0
}
],
primary_action: function() {
@@ -87,8 +92,9 @@
args: {
docname: frm.doc.name,
cost_center_name: data.cost_center_name,
- cost_center_number: data.cost_center_number,
- company: frm.doc.company
+ cost_center_number: cstr(data.cost_center_number),
+ company: frm.doc.company,
+ merge: data.merge
},
callback: function(r) {
frappe.dom.unfreeze();
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.json b/erpnext/accounts/doctype/cost_center/cost_center.json
index c9bbbab..9c3573b 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.json
+++ b/erpnext/accounts/doctype/cost_center/cost_center.json
@@ -146,7 +146,7 @@
"idx": 1,
"is_tree": 1,
"links": [],
- "modified": "2020-04-29 16:09:30.025214",
+ "modified": "2020-06-12 16:09:30.025214",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Cost Center",
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 5165495..176370c 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -817,7 +817,7 @@
pass
@frappe.whitelist()
-def update_cost_center(docname, cost_center_name, cost_center_number, company):
+def update_cost_center(docname, cost_center_name, cost_center_number, company, merge):
'''
Renames the document by adding the number as a prefix to the current name and updates
all transaction where it was present.
@@ -833,7 +833,7 @@
new_name = get_autoname_with_number(cost_center_number, cost_center_name, docname, company)
if docname != new_name:
- frappe.rename_doc("Cost Center", docname, new_name, force=1)
+ frappe.rename_doc("Cost Center", docname, new_name, force=1, merge=merge)
return new_name
def validate_field_number(doctype_name, docname, number_value, company, field_name):