fixes in renaming account, supplier, customer; fixes in accounts browser; fixes in customer address contact fetching in opportunity

This commit is contained in:
Anand Doshi
2012-12-03 15:45:03 +05:30
parent 346c832475
commit ef6a76f8aa
5 changed files with 50 additions and 13 deletions

View File

@@ -125,6 +125,7 @@ class DocType(TransactionBase):
parent_account = self.get_receivables_group()
arg = {'account_name':self.doc.name,'parent_account': parent_account, 'group_or_ledger':'Ledger', 'company':self.doc.company,'account_type':'','tax_rate':'0','master_type':'Customer','master_name':self.doc.name,'address':self.doc.address}
# create
ac = get_obj('GL Control').add_ac(cstr(arg))
msgprint("Account Head created for "+ac)
else :
@@ -236,5 +237,11 @@ class DocType(TransactionBase):
for rec in update_fields:
sql("update `tab%s` set customer_name = '%s' where %s = '%s'" %(rec[0],newdn,rec[1],olddn))
old_account = webnotes.conn.get_value("Account", {"master_type": "Customer",
"master_name": olddn})
#update master_name in doctype account
sql("update `tabAccount` set master_name = '%s', master_type = 'Customer' where master_name = '%s'" %(newdn,olddn))
from webnotes.model.rename_doc import rename_doc
rename_doc("Account", old_account, newdn)

View File

@@ -94,8 +94,21 @@ cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){
// customer
cur_frm.cscript.customer = function(doc,dt,dn) {
if(doc.customer) get_server_fields('get_default_customer_address', JSON.stringify({customer: doc.customer}),'', doc, dt, dn, 1);
if(doc.customer) unhide_field(['customer_name','customer_address','contact_person','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
if(doc.customer) {
cur_frm.call({
method: "get_default_customer_address",
args: { customer: doc.customer },
callback: function(r) {
if(!r.exc) {
cur_frm.refresh();
}
}
});
unhide_field(["customer_name", "customer_address", "contact_person",
"address_display", "contact_display", "contact_mobile", "contact_email",
"territory", "customer_group"]);
}
}
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {