resoved conflict in patch, company and renaming tools

This commit is contained in:
nabinhait
2011-07-01 16:32:03 +05:30
8 changed files with 1267 additions and 649 deletions

View File

@@ -72,6 +72,7 @@ cur_frm.fields_dict['master_name'].get_query=function(doc){
else alert("Please select master type");
}
/*
// Get customer/supplier address
// -----------------------------------------
cur_frm.cscript.master_name = function(doc,cdt,cdn){
@@ -79,6 +80,7 @@ cur_frm.cscript.master_name = function(doc,cdt,cdn){
get_server_fields('get_address','','',doc,cdt,cdn);
}
}
*/
// parent account get query
// -----------------------------------------

View File

@@ -260,3 +260,16 @@ class DocType:
def on_restore(self):
# rebuild tree
self.update_nsm_model()
# on rename
# ---------
def on_rename(self,newdn,olddn):
company_abbr = sql("select tc.abbr from `tabAccount` ta, `tabCompany` tc where ta.company = tc.name and ta.name=%s", olddn)[0][0]
newdnchk = newdn.split(" - ")
if newdnchk[-1].lower() != company_abbr.lower():
msgprint("Please add company abbreviation <b>%s</b>" %(company_abbr), raise_exception=1)
else:
account_name = " - ".join(newdnchk[:-1])
sql("update `tabAccount` set account_name = '%s' where name = '%s'" %(account_name,olddn))