[cleanup] #402 changed fieldname company_name to company in Cost Center
This commit is contained in:
parent
c120776931
commit
1357c0b2df
@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-02-22 01:27:37",
|
"creation": "2013-03-07 11:55:04",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-03-07 07:03:19",
|
"modified": "2013-07-09 14:44:37",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -44,7 +44,7 @@
|
|||||||
"label": "Budget Allocated",
|
"label": "Budget Allocated",
|
||||||
"oldfieldname": "budget_allocated",
|
"oldfieldname": "budget_allocated",
|
||||||
"oldfieldtype": "Currency",
|
"oldfieldtype": "Currency",
|
||||||
"options": "Company:company_name:default_currency",
|
"options": "Company:company:default_currency",
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -54,7 +54,7 @@
|
|||||||
"label": "Actual",
|
"label": "Actual",
|
||||||
"oldfieldname": "actual",
|
"oldfieldname": "actual",
|
||||||
"oldfieldtype": "Currency",
|
"oldfieldtype": "Currency",
|
||||||
"options": "Company:company_name:default_currency",
|
"options": "Company:company:default_currency",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||||
var intro_txt = '';
|
var intro_txt = '';
|
||||||
cur_frm.toggle_display('cost_center_name', doc.__islocal);
|
cur_frm.toggle_display('cost_center_name', doc.__islocal);
|
||||||
cur_frm.toggle_enable(['group_or_ledger', 'company_name'], doc.__islocal);
|
cur_frm.toggle_enable(['group_or_ledger', 'company'], doc.__islocal);
|
||||||
|
|
||||||
if(!doc.__islocal && doc.group_or_ledger=='Group') {
|
if(!doc.__islocal && doc.group_or_ledger=='Group') {
|
||||||
intro_txt += '<p><b>Note:</b> This Cost Center is a <i>Group</i>, \
|
intro_txt += '<p><b>Note:</b> This Cost Center is a <i>Group</i>, \
|
||||||
@ -36,16 +36,16 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
//Account filtering for cost center
|
//Account filtering for cost center
|
||||||
cur_frm.fields_dict['budget_details'].grid.get_field('account').get_query = function(doc) {
|
cur_frm.fields_dict['budget_details'].grid.get_field('account').get_query = function(doc) {
|
||||||
var mydoc = locals[this.doctype][this.docname];
|
var mydoc = locals[this.doctype][this.docname];
|
||||||
return 'SELECT DISTINCT `tabAccount`.`name`,`tabAccount`.debit_or_credit,`tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.`company` = "' + doc.company_name + '" AND `tabAccount`.docstatus != 2 AND `tabAccount`.`is_pl_account` = "Yes" AND `tabAccount`.debit_or_credit = "Debit" AND `tabAccount`.`group_or_ledger` != "Group" AND `tabAccount`.`group_or_ledger` is not NULL AND `tabAccount`.`name` LIKE "%s" ORDER BY `tabAccount`.`name` LIMIT 50';
|
return 'SELECT DISTINCT `tabAccount`.`name`,`tabAccount`.debit_or_credit,`tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.`company` = "' + doc.company + '" AND `tabAccount`.docstatus != 2 AND `tabAccount`.`is_pl_account` = "Yes" AND `tabAccount`.debit_or_credit = "Debit" AND `tabAccount`.`group_or_ledger` != "Group" AND `tabAccount`.`group_or_ledger` is not NULL AND `tabAccount`.`name` LIKE "%s" ORDER BY `tabAccount`.`name` LIMIT 50';
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict['parent_cost_center'].get_query = function(doc){
|
cur_frm.fields_dict['parent_cost_center'].get_query = function(doc){
|
||||||
return 'SELECT DISTINCT `tabCost Center`.name FROM `tabCost Center` WHERE `tabCost Center`.group_or_ledger="Group" AND `tabCost Center`.docstatus != 2 AND `tabCost Center`.company_name="'+ doc.company_name+'" AND `tabCost Center`.company_name is not NULL AND `tabCost Center`.name LIKE "%s" ORDER BY `tabCost Center`.name LIMIT 50';
|
return 'SELECT DISTINCT `tabCost Center`.name FROM `tabCost Center` WHERE `tabCost Center`.group_or_ledger="Group" AND `tabCost Center`.docstatus != 2 AND `tabCost Center`.company="'+ doc.company+'" AND `tabCost Center`.company is not NULL AND `tabCost Center`.name LIKE "%s" ORDER BY `tabCost Center`.name LIMIT 50';
|
||||||
}
|
}
|
||||||
|
|
||||||
//parent cost center
|
//parent cost center
|
||||||
cur_frm.cscript.parent_cost_center = function(doc,cdt,cdn){
|
cur_frm.cscript.parent_cost_center = function(doc,cdt,cdn){
|
||||||
if(!doc.company_name){
|
if(!doc.company){
|
||||||
alert('Please enter company name first');
|
alert('Please enter company name first');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,16 +28,16 @@ class DocType(DocTypeNestedSet):
|
|||||||
|
|
||||||
def autoname(self):
|
def autoname(self):
|
||||||
company_abbr = webnotes.conn.sql("select abbr from tabCompany where name=%s",
|
company_abbr = webnotes.conn.sql("select abbr from tabCompany where name=%s",
|
||||||
self.doc.company_name)[0][0]
|
self.doc.company)[0][0]
|
||||||
self.doc.name = self.doc.cost_center_name.strip() + ' - ' + company_abbr
|
self.doc.name = self.doc.cost_center_name.strip() + ' - ' + company_abbr
|
||||||
|
|
||||||
def validate_mandatory(self):
|
def validate_mandatory(self):
|
||||||
if not self.doc.group_or_ledger:
|
if not self.doc.group_or_ledger:
|
||||||
msgprint("Please select Group or Ledger value", raise_exception=1)
|
msgprint("Please select Group or Ledger value", raise_exception=1)
|
||||||
|
|
||||||
if self.doc.cost_center_name != self.doc.company_name and not self.doc.parent_cost_center:
|
if self.doc.cost_center_name != self.doc.company and not self.doc.parent_cost_center:
|
||||||
msgprint("Please enter parent cost center", raise_exception=1)
|
msgprint("Please enter parent cost center", raise_exception=1)
|
||||||
elif self.doc.cost_center_name == self.doc.company_name and self.doc.parent_cost_center:
|
elif self.doc.cost_center_name == self.doc.company and self.doc.parent_cost_center:
|
||||||
msgprint(_("Root cannot have a parent cost center"), raise_exception=1)
|
msgprint(_("Root cannot have a parent cost center"), raise_exception=1)
|
||||||
|
|
||||||
def convert_group_to_ledger(self):
|
def convert_group_to_ledger(self):
|
||||||
@ -81,14 +81,14 @@ class DocType(DocTypeNestedSet):
|
|||||||
"""
|
"""
|
||||||
Cost Center name must be unique
|
Cost Center name must be unique
|
||||||
"""
|
"""
|
||||||
if (self.doc.fields.get("__islocal") or not self.doc.name) and webnotes.conn.sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)):
|
if (self.doc.fields.get("__islocal") or not self.doc.name) and webnotes.conn.sql("select name from `tabCost Center` where cost_center_name = %s and company=%s", (self.doc.cost_center_name, self.doc.company)):
|
||||||
msgprint("Cost Center Name already exists, please rename", raise_exception=1)
|
msgprint("Cost Center Name already exists, please rename", raise_exception=1)
|
||||||
|
|
||||||
self.validate_mandatory()
|
self.validate_mandatory()
|
||||||
self.validate_budget_details()
|
self.validate_budget_details()
|
||||||
|
|
||||||
def on_rename(self, new, old, merge=False):
|
def on_rename(self, new, old, merge=False):
|
||||||
company_abbr = webnotes.conn.get_value("Company", self.doc.company_name, "abbr")
|
company_abbr = webnotes.conn.get_value("Company", self.doc.company, "abbr")
|
||||||
parts = new.split(" - ")
|
parts = new.split(" - ")
|
||||||
|
|
||||||
if parts[-1].lower() != company_abbr.lower():
|
if parts[-1].lower() != company_abbr.lower():
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-01-23 19:57:17",
|
"creation": "2013-01-23 19:57:17",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-05 14:33:05",
|
"modified": "2013-07-09 14:43:41",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -81,7 +81,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "company_name",
|
"fieldname": "company",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Company",
|
"label": "Company",
|
||||||
"oldfieldname": "company_name",
|
"oldfieldname": "company_name",
|
||||||
|
@ -3,7 +3,7 @@ test_records = [
|
|||||||
"doctype": "Cost Center",
|
"doctype": "Cost Center",
|
||||||
"cost_center_name": "_Test Cost Center",
|
"cost_center_name": "_Test Cost Center",
|
||||||
"parent_cost_center": "_Test Company - _TC",
|
"parent_cost_center": "_Test Company - _TC",
|
||||||
"company_name": "_Test Company",
|
"company": "_Test Company",
|
||||||
"group_or_ledger": "Ledger"
|
"group_or_ledger": "Ledger"
|
||||||
}],
|
}],
|
||||||
]
|
]
|
@ -120,7 +120,7 @@ class DocType:
|
|||||||
def _get_cost_center_company():
|
def _get_cost_center_company():
|
||||||
if not self.cost_center_company.get(self.doc.cost_center):
|
if not self.cost_center_company.get(self.doc.cost_center):
|
||||||
self.cost_center_company[self.doc.cost_center] = webnotes.conn.get_value("Cost Center",
|
self.cost_center_company[self.doc.cost_center] = webnotes.conn.get_value("Cost Center",
|
||||||
self.doc.cost_center, "company_name")
|
self.doc.cost_center, "company")
|
||||||
|
|
||||||
return self.cost_center_company[self.doc.cost_center]
|
return self.cost_center_company[self.doc.cost_center]
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ cur_frm.fields_dict['entries'].grid.get_field('account').get_query = function(do
|
|||||||
cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) {
|
cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) {
|
||||||
return {
|
return {
|
||||||
query: "accounts.utils.get_cost_center_list",
|
query: "accounts.utils.get_cost_center_list",
|
||||||
filters: { company_name: doc.company}
|
filters: { company: doc.company}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) {
|
|||||||
// Cost Center
|
// Cost Center
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) {
|
cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) {
|
||||||
return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50';
|
return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50';
|
||||||
}
|
}
|
||||||
|
|
||||||
//get query select Territory
|
//get query select Territory
|
||||||
|
@ -191,7 +191,7 @@ cur_frm.cscript.expense_head = function(doc, cdt, cdn){
|
|||||||
cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) {
|
cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) {
|
||||||
return {
|
return {
|
||||||
query: "accounts.utils.get_cost_center_list",
|
query: "accounts.utils.get_cost_center_list",
|
||||||
filters: { company_name: doc.company}
|
filters: { company: doc.company}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ cur_frm.fields_dict['purchase_tax_details'].grid.get_field("account_head").get_q
|
|||||||
|
|
||||||
|
|
||||||
cur_frm.fields_dict['purchase_tax_details'].grid.get_field("cost_center").get_query = function(doc) {
|
cur_frm.fields_dict['purchase_tax_details'].grid.get_field("cost_center").get_query = function(doc) {
|
||||||
return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50';
|
return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ cur_frm.fields_dict.write_off_account.get_query = function(doc) {
|
|||||||
// Write off cost center
|
// Write off cost center
|
||||||
//-----------------------
|
//-----------------------
|
||||||
cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) {
|
cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) {
|
||||||
return 'SELECT `tabCost Center`.name FROM `tabCost Center` WHERE `tabCost Center`.group_or_ledger="Ledger" AND `tabCost Center`.docstatus!=2 AND `tabCost Center`.company_name="'+doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s"'
|
return 'SELECT `tabCost Center`.name FROM `tabCost Center` WHERE `tabCost Center`.group_or_ledger="Ledger" AND `tabCost Center`.docstatus!=2 AND `tabCost Center`.company="'+doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s"'
|
||||||
}
|
}
|
||||||
|
|
||||||
//project name
|
//project name
|
||||||
@ -315,7 +315,7 @@ cur_frm.fields_dict['entries'].grid.get_field('warehouse').get_query= function(d
|
|||||||
cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) {
|
cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) {
|
||||||
return {
|
return {
|
||||||
query: "accounts.utils.get_cost_center_list",
|
query: "accounts.utils.get_cost_center_list",
|
||||||
filters: { company_name: doc.company}
|
filters: { company: doc.company}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ cur_frm.fields_dict['other_charges'].grid.get_field("account_head").get_query =
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict['other_charges'].grid.get_field("cost_center").get_query = function(doc) {
|
cur_frm.fields_dict['other_charges'].grid.get_field("cost_center").get_query = function(doc) {
|
||||||
return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50';
|
return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ erpnext.AccountsChart = Class.extend({
|
|||||||
var node = me.selected_node();
|
var node = me.selected_node();
|
||||||
|
|
||||||
v.parent_cost_center = node.data('label');
|
v.parent_cost_center = node.data('label');
|
||||||
v.company_name = me.company;
|
v.company = me.company;
|
||||||
|
|
||||||
wn.call({
|
wn.call({
|
||||||
args: v,
|
args: v,
|
||||||
|
@ -28,16 +28,14 @@ def get_children():
|
|||||||
args = webnotes.form_dict
|
args = webnotes.form_dict
|
||||||
ctype, company = args['ctype'], args['comp']
|
ctype, company = args['ctype'], args['comp']
|
||||||
|
|
||||||
company_field = ctype=='Account' and 'company' or 'company_name'
|
|
||||||
|
|
||||||
# root
|
# root
|
||||||
if args['parent'] in ("Accounts", "Cost Centers"):
|
if args['parent'] in ("Accounts", "Cost Centers"):
|
||||||
acc = webnotes.conn.sql(""" select
|
acc = webnotes.conn.sql(""" select
|
||||||
name as value, if(group_or_ledger='Group', 1, 0) as expandable
|
name as value, if(group_or_ledger='Group', 1, 0) as expandable
|
||||||
from `tab%s`
|
from `tab%s`
|
||||||
where ifnull(parent_%s,'') = ''
|
where ifnull(parent_%s,'') = ''
|
||||||
and %s = %s and docstatus<2
|
and `company` = %s and docstatus<2
|
||||||
order by name""" % (ctype, ctype.lower().replace(' ','_'), company_field, '%s'),
|
order by name""" % (ctype, ctype.lower().replace(' ','_'), '%s'),
|
||||||
company, as_dict=1)
|
company, as_dict=1)
|
||||||
else:
|
else:
|
||||||
# other
|
# other
|
||||||
|
@ -79,7 +79,7 @@ def get_costcenter_target_details(filters):
|
|||||||
cc.parent_cost_center, bd.account, bd.budget_allocated
|
cc.parent_cost_center, bd.account, bd.budget_allocated
|
||||||
from `tabCost Center` cc, `tabBudget Detail` bd
|
from `tabCost Center` cc, `tabBudget Detail` bd
|
||||||
where bd.parent=cc.name and bd.fiscal_year=%s and
|
where bd.parent=cc.name and bd.fiscal_year=%s and
|
||||||
cc.company_name=%s and ifnull(cc.distribution_id, '')!=''
|
cc.company=%s and ifnull(cc.distribution_id, '')!=''
|
||||||
order by cc.name""" % ('%s', '%s'),
|
order by cc.name""" % ('%s', '%s'),
|
||||||
(filters.get("fiscal_year"), filters.get("company")), as_dict=1)
|
(filters.get("fiscal_year"), filters.get("company")), as_dict=1)
|
||||||
|
|
||||||
|
6
patches/july_2013/p03_cost_center_company.py
Normal file
6
patches/july_2013/p03_cost_center_company.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import webnotes
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
webnotes.reload_doc("accounts", "doctype", "cost_center")
|
||||||
|
webnotes.conn.sql("""update `tabCost Center` set company=company_name""")
|
||||||
|
webnotes.conn.sql_ddl("""alter table `tabCost Center` drop column company_name""")
|
@ -79,9 +79,9 @@ def add_accounts(accounts_to_add, check_fn=None):
|
|||||||
def add_aii_cost_center():
|
def add_aii_cost_center():
|
||||||
for company, abbr in webnotes.conn.sql("""select name, abbr from `tabCompany`"""):
|
for company, abbr in webnotes.conn.sql("""select name, abbr from `tabCompany`"""):
|
||||||
if not webnotes.conn.sql("""select name from `tabCost Center` where cost_center_name =
|
if not webnotes.conn.sql("""select name from `tabCost Center` where cost_center_name =
|
||||||
'Auto Inventory Accounting' and company_name = %s""", company):
|
'Auto Inventory Accounting' and company = %s""", company):
|
||||||
parent_cost_center = webnotes.conn.get_value("Cost Center",
|
parent_cost_center = webnotes.conn.get_value("Cost Center",
|
||||||
{"parent_cost_center['']": '', "company_name": company})
|
{"parent_cost_center['']": '', "company": company})
|
||||||
|
|
||||||
if not parent_cost_center:
|
if not parent_cost_center:
|
||||||
webnotes.errprint("Company " + company + "does not have a root cost center")
|
webnotes.errprint("Company " + company + "does not have a root cost center")
|
||||||
@ -92,7 +92,7 @@ def add_aii_cost_center():
|
|||||||
"cost_center_name": "Auto Inventory Accounting",
|
"cost_center_name": "Auto Inventory Accounting",
|
||||||
"parent_cost_center": parent_cost_center,
|
"parent_cost_center": parent_cost_center,
|
||||||
"group_or_ledger": "Ledger",
|
"group_or_ledger": "Ledger",
|
||||||
"company_name": company
|
"company": company
|
||||||
})
|
})
|
||||||
cc.insert()
|
cc.insert()
|
||||||
|
|
||||||
|
@ -249,4 +249,5 @@ patch_list = [
|
|||||||
"execute:webnotes.delete_doc('Report', 'Delivered Items To Be Billed')",
|
"execute:webnotes.delete_doc('Report', 'Delivered Items To Be Billed')",
|
||||||
"execute:webnotes.delete_doc('Report', 'Received Items To Be Billed')",
|
"execute:webnotes.delete_doc('Report', 'Received Items To Be Billed')",
|
||||||
"patches.july_2013.p02_copy_shipping_address",
|
"patches.july_2013.p02_copy_shipping_address",
|
||||||
|
"patches.july_2013.p03_cost_center_company",
|
||||||
]
|
]
|
@ -215,13 +215,13 @@ class DocType:
|
|||||||
cc_list = [
|
cc_list = [
|
||||||
{
|
{
|
||||||
'cost_center_name': self.doc.name,
|
'cost_center_name': self.doc.name,
|
||||||
'company_name':self.doc.name,
|
'company':self.doc.name,
|
||||||
'group_or_ledger':'Group',
|
'group_or_ledger':'Group',
|
||||||
'parent_cost_center':''
|
'parent_cost_center':''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'cost_center_name':'Main',
|
'cost_center_name':'Main',
|
||||||
'company_name':self.doc.name,
|
'company':self.doc.name,
|
||||||
'group_or_ledger':'Ledger',
|
'group_or_ledger':'Ledger',
|
||||||
'parent_cost_center':self.doc.name + ' - ' + self.doc.abbr
|
'parent_cost_center':self.doc.name + ' - ' + self.doc.abbr
|
||||||
},
|
},
|
||||||
@ -266,9 +266,9 @@ class DocType:
|
|||||||
webnotes.conn.sql("delete from `tabAccount` where company = %s order by lft desc, rgt desc", self.doc.name)
|
webnotes.conn.sql("delete from `tabAccount` where company = %s order by lft desc, rgt desc", self.doc.name)
|
||||||
|
|
||||||
#delete cost center child table - budget detail
|
#delete cost center child table - budget detail
|
||||||
webnotes.conn.sql("delete bd.* from `tabBudget Detail` bd, `tabCost Center` cc where bd.parent = cc.name and cc.company_name = %s", self.doc.name)
|
webnotes.conn.sql("delete bd.* from `tabBudget Detail` bd, `tabCost Center` cc where bd.parent = cc.name and cc.company = %s", self.doc.name)
|
||||||
#delete cost center
|
#delete cost center
|
||||||
webnotes.conn.sql("delete from `tabCost Center` WHERE company_name = %s order by lft desc, rgt desc", self.doc.name)
|
webnotes.conn.sql("delete from `tabCost Center` WHERE company = %s order by lft desc, rgt desc", self.doc.name)
|
||||||
|
|
||||||
webnotes.defaults.clear_default("company", value=self.doc.name)
|
webnotes.defaults.clear_default("company", value=self.doc.name)
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ if (sys_defaults.auto_inventory_accounting) {
|
|||||||
cur_frm.fields_dict.delivery_note_details.grid.get_field("cost_center").get_query = function(doc) {
|
cur_frm.fields_dict.delivery_note_details.grid.get_field("cost_center").get_query = function(doc) {
|
||||||
return {
|
return {
|
||||||
query: "accounts.utils.get_cost_center_list",
|
query: "accounts.utils.get_cost_center_list",
|
||||||
filters: { company_name: doc.company}
|
filters: { company: doc.company}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user