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",
|
"label": "Cost Center Number",
|
||||||
"fieldname": "cost_center_number",
|
"fieldname": "cost_center_number",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"reqd": 1,
|
|
||||||
"default": frm.doc.cost_center_number
|
"default": frm.doc.cost_center_number
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": __("Merge with existing"),
|
||||||
|
"fieldname": "merge",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"default": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
primary_action: function() {
|
primary_action: function() {
|
||||||
@ -87,8 +92,9 @@ frappe.ui.form.on('Cost Center', {
|
|||||||
args: {
|
args: {
|
||||||
docname: frm.doc.name,
|
docname: frm.doc.name,
|
||||||
cost_center_name: data.cost_center_name,
|
cost_center_name: data.cost_center_name,
|
||||||
cost_center_number: data.cost_center_number,
|
cost_center_number: cstr(data.cost_center_number),
|
||||||
company: frm.doc.company
|
company: frm.doc.company,
|
||||||
|
merge: data.merge
|
||||||
},
|
},
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
frappe.dom.unfreeze();
|
frappe.dom.unfreeze();
|
||||||
|
@ -146,7 +146,7 @@
|
|||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_tree": 1,
|
"is_tree": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-04-29 16:09:30.025214",
|
"modified": "2020-06-12 16:09:30.025214",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Cost Center",
|
"name": "Cost Center",
|
||||||
|
@ -817,7 +817,7 @@ def create_payment_gateway_account(gateway):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@frappe.whitelist()
|
@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
|
Renames the document by adding the number as a prefix to the current name and updates
|
||||||
all transaction where it was present.
|
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)
|
new_name = get_autoname_with_number(cost_center_number, cost_center_name, docname, company)
|
||||||
if docname != new_name:
|
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
|
return new_name
|
||||||
|
|
||||||
def validate_field_number(doctype_name, docname, number_value, company, field_name):
|
def validate_field_number(doctype_name, docname, number_value, company, field_name):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user