fix: Minor fixes in cost center
This commit is contained in:
parent
7d3c3b9a8b
commit
817cbc4b48
@ -71,8 +71,13 @@ frappe.ui.form.on('Cost Center', {
|
||||
"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 @@ frappe.ui.form.on('Cost Center', {
|
||||
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();
|
||||
|
@ -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",
|
||||
|
@ -817,7 +817,7 @@ def create_payment_gateway_account(gateway):
|
||||
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 @@ def update_cost_center(docname, cost_center_name, cost_center_number, company):
|
||||
|
||||
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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user