fixed conflict

This commit is contained in:
Nabin Hait
2013-01-25 17:42:25 +05:30
7 changed files with 26 additions and 52 deletions

View File

@@ -47,12 +47,6 @@ cur_frm.cscript.parent_cost_center = function(doc,cdt,cdn){
} }
} }
//company abbr
cur_frm.cscript.company_name = function(doc,cdt,cdn){
get_server_fields('get_abbr','','',doc,cdt,cdn,1);
}
// Hide/unhide group or ledger // Hide/unhide group or ledger
// ----------------------------------------- // -----------------------------------------
cur_frm.cscript.hide_unhide_group_ledger = function(doc) { cur_frm.cscript.hide_unhide_group_ledger = function(doc) {

View File

@@ -27,15 +27,9 @@ class DocType(DocTypeNestedSet):
self.nsm_parent_field = 'parent_cost_center' self.nsm_parent_field = 'parent_cost_center'
def autoname(self): def autoname(self):
self.doc.name = self.doc.cost_center_name + ' - ' + self.doc.company_abbr company_abbr = webnotes.conn.sql("select abbr from tabCompany where name=%s",
self.doc.company_name)[0][0]
def get_abbr(self): self.doc.name = self.doc.cost_center_name + ' - ' + company_abbr
abbr = webnotes.conn.sql("select abbr from tabCompany where company_name=%s",
self.doc.company_name)[0][0] or ''
ret = {
'company_abbr' : abbr
}
return ret
def validate_mandatory(self): def validate_mandatory(self):
if not self.doc.group_or_ledger: if not self.doc.group_or_ledger:

View File

@@ -1,8 +1,8 @@
[ [
{ {
"creation": "2013-01-10 16:34:06", "creation": "2013-01-23 19:57:17",
"docstatus": 0, "docstatus": 0,
"modified": "2013-01-22 14:55:59", "modified": "2013-01-25 15:04:03",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@@ -88,16 +88,6 @@
"options": "Company", "options": "Company",
"reqd": 1 "reqd": 1
}, },
{
"doctype": "DocField",
"fieldname": "company_abbr",
"fieldtype": "Data",
"hidden": 1,
"label": "Company Abbr",
"oldfieldname": "company_abbr",
"oldfieldtype": "Data",
"read_only": 1
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "cb0", "fieldname": "cb0",

View File

@@ -47,37 +47,23 @@ class DocType:
return flt(bal) return flt(bal)
def add_ac(self,arg): def add_ac(self,arg):
arg = eval(arg) ac = webnotes.model_wrapper(eval(arg))
ac = Document('Account') ac.doc.doctype = "Account"
for d in arg.keys(): ac.doc.old_parent = ""
ac.fields[d] = arg[d] ac.doc.freeze_account = "No"
ac.old_parent = '' ac.insert()
ac_obj = get_obj(doc=ac)
ac_obj.doc.freeze_account='No'
ac_obj.validate()
ac_obj.doc.save(1)
ac_obj.on_update()
return ac_obj.doc.name return ac.doc.name
# Add a new cost center # Add a new cost center
#---------------------- #----------------------
def add_cc(self,arg): def add_cc(self,arg):
arg = eval(arg) cc = webnotes.model_wrapper(eval(arg))
cc = Document('Cost Center') cc.doc.doctype = "Cost Center"
# map fields cc.doc.old_parent = ""
for d in arg.keys(): cc.insert()
cc.fields[d] = arg[d]
# map company abbr
other_info = webnotes.conn.sql("select company_abbr from `tabCost Center` where name='%s'"%arg['parent_cost_center'])
cc.company_abbr = other_info and other_info[0][0] or arg['company_abbr']
cc_obj = get_obj(doc=cc) return cc.doc.name
cc_obj.validate()
cc_obj.doc.save(1)
cc_obj.on_update()
return cc_obj.doc.name
# Get field values from the voucher # Get field values from the voucher

View File

@@ -0,0 +1,8 @@
from __future__ import unicode_literals
def execute():
from webnotes.utils.nestedset import rebuild_tree
rebuild_tree("Item Group", "parent_item_group")
rebuild_tree("Customer Group", "parent_customer_group")
rebuild_tree("Territory", "parent_territory")
rebuild_tree("Sales Person", "parent_sales_person")

View File

@@ -159,4 +159,5 @@ patch_list = [
"patches.january_2013.remove_unwanted_permission", "patches.january_2013.remove_unwanted_permission",
"patches.january_2013.remove_landed_cost_master", "patches.january_2013.remove_landed_cost_master",
"patches.january_2013.reload_print_format", "patches.january_2013.reload_print_format",
"patches.january_2013.rebuild_tree",
] ]

View File

@@ -39,6 +39,7 @@ class DocType(DocTypeNestedSet):
def on_update(self): def on_update(self):
self.validate_name_with_customer() self.validate_name_with_customer()
super(DocType, self).on_update()
def validate_name_with_customer(self): def validate_name_with_customer(self):
if webnotes.conn.exists("Customer", self.doc.name): if webnotes.conn.exists("Customer", self.doc.name):