mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 20:29:09 +00:00
[cleanup] #402 changed fieldname company_name to company in Cost Center
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-02-22 01:27:37",
|
||||
"creation": "2013-03-07 11:55:04",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:19",
|
||||
"modified": "2013-07-09 14:44:37",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -44,7 +44,7 @@
|
||||
"label": "Budget Allocated",
|
||||
"oldfieldname": "budget_allocated",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company_name:default_currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
@@ -54,7 +54,7 @@
|
||||
"label": "Actual",
|
||||
"oldfieldname": "actual",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company_name:default_currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
var intro_txt = '';
|
||||
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') {
|
||||
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
|
||||
cur_frm.fields_dict['budget_details'].grid.get_field('account').get_query = function(doc) {
|
||||
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){
|
||||
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
|
||||
cur_frm.cscript.parent_cost_center = function(doc,cdt,cdn){
|
||||
if(!doc.company_name){
|
||||
if(!doc.company){
|
||||
alert('Please enter company name first');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,16 +28,16 @@ class DocType(DocTypeNestedSet):
|
||||
|
||||
def autoname(self):
|
||||
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
|
||||
|
||||
def validate_mandatory(self):
|
||||
if not self.doc.group_or_ledger:
|
||||
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)
|
||||
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)
|
||||
|
||||
def convert_group_to_ledger(self):
|
||||
@@ -81,14 +81,14 @@ class DocType(DocTypeNestedSet):
|
||||
"""
|
||||
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)
|
||||
|
||||
self.validate_mandatory()
|
||||
self.validate_budget_details()
|
||||
|
||||
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(" - ")
|
||||
|
||||
if parts[-1].lower() != company_abbr.lower():
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-23 19:57:17",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-05 14:33:05",
|
||||
"modified": "2013-07-09 14:43:41",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -81,7 +81,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company_name",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"label": "Company",
|
||||
"oldfieldname": "company_name",
|
||||
|
||||
@@ -3,7 +3,7 @@ test_records = [
|
||||
"doctype": "Cost Center",
|
||||
"cost_center_name": "_Test Cost Center",
|
||||
"parent_cost_center": "_Test Company - _TC",
|
||||
"company_name": "_Test Company",
|
||||
"company": "_Test Company",
|
||||
"group_or_ledger": "Ledger"
|
||||
}],
|
||||
]
|
||||
@@ -120,7 +120,7 @@ class DocType:
|
||||
def _get_cost_center_company():
|
||||
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.doc.cost_center, "company_name")
|
||||
self.doc.cost_center, "company")
|
||||
|
||||
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) {
|
||||
return {
|
||||
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
|
||||
// -----------------------------
|
||||
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
|
||||
|
||||
@@ -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) {
|
||||
return {
|
||||
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) {
|
||||
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
|
||||
//-----------------------
|
||||
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
|
||||
@@ -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) {
|
||||
return {
|
||||
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) {
|
||||
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';
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user