fixed conflict

This commit is contained in:
Nabin Hait 2013-01-25 17:42:25 +05:30
commit 163bebb670
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
// -----------------------------------------
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'
def autoname(self):
self.doc.name = self.doc.cost_center_name + ' - ' + self.doc.company_abbr
def get_abbr(self):
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
company_abbr = webnotes.conn.sql("select abbr from tabCompany where name=%s",
self.doc.company_name)[0][0]
self.doc.name = self.doc.cost_center_name + ' - ' + company_abbr
def validate_mandatory(self):
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,
"modified": "2013-01-22 14:55:59",
"modified": "2013-01-25 15:04:03",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -88,16 +88,6 @@
"options": "Company",
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "company_abbr",
"fieldtype": "Data",
"hidden": 1,
"label": "Company Abbr",
"oldfieldname": "company_abbr",
"oldfieldtype": "Data",
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "cb0",

View File

@ -47,37 +47,23 @@ class DocType:
return flt(bal)
def add_ac(self,arg):
arg = eval(arg)
ac = Document('Account')
for d in arg.keys():
ac.fields[d] = arg[d]
ac.old_parent = ''
ac_obj = get_obj(doc=ac)
ac_obj.doc.freeze_account='No'
ac_obj.validate()
ac_obj.doc.save(1)
ac_obj.on_update()
ac = webnotes.model_wrapper(eval(arg))
ac.doc.doctype = "Account"
ac.doc.old_parent = ""
ac.doc.freeze_account = "No"
ac.insert()
return ac_obj.doc.name
return ac.doc.name
# Add a new cost center
#----------------------
def add_cc(self,arg):
arg = eval(arg)
cc = Document('Cost Center')
# map fields
for d in arg.keys():
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 = webnotes.model_wrapper(eval(arg))
cc.doc.doctype = "Cost Center"
cc.doc.old_parent = ""
cc.insert()
cc_obj = get_obj(doc=cc)
cc_obj.validate()
cc_obj.doc.save(1)
cc_obj.on_update()
return cc_obj.doc.name
return cc.doc.name
# 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_landed_cost_master",
"patches.january_2013.reload_print_format",
"patches.january_2013.rebuild_tree",
]

View File

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