[minor] [fix] fetch contact details

This commit is contained in:
Anand Doshi 2013-07-24 12:08:42 +05:30
parent deff57826a
commit ba8ea7dbfd
3 changed files with 5 additions and 20 deletions

View File

@ -111,11 +111,6 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
address: this.frm.doc.supplier_address, address: this.frm.doc.supplier_address,
contact: this.frm.doc.contact_person contact: this.frm.doc.contact_person
}, },
callback: function(r) {
if(!r.exc) {
me.frm.refresh_fields();
}
}
}); });
} }
}, },

View File

@ -165,9 +165,6 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
}, },
method: "set_customer_address", method: "set_customer_address",
freeze: true, freeze: true,
callback: function(r) {
me.frm.refresh_fields();
}
}); });
} }
}, },

View File

@ -136,9 +136,6 @@ class TransactionBase(StatusUpdater):
def set_lead_defaults(self): def set_lead_defaults(self):
self.doc.fields.update(self.get_lead_defaults()) self.doc.fields.update(self.get_lead_defaults())
# Get Customer Address
# -----------------------
def get_customer_address(self, args): def get_customer_address(self, args):
args = load_json(args) args = load_json(args)
ret = { ret = {
@ -396,14 +393,10 @@ def map_party_contact_details(contact_name=None, party_field=None, party_name=No
"contact_mobile", "contact_phone", "contact_designation", "contact_department"]: "contact_mobile", "contact_phone", "contact_designation", "contact_department"]:
out[fieldname] = None out[fieldname] = None
condition = "" if not contact_name and party_field:
if contact_name: contact_name = get_default_contact(party_field, party_name)
condition = " name = '%s'" % contact_name
elif party_field and party_name:
condition = " `%s`='%s'" % (party_field, party_name)
contact = webnotes.conn.sql("""select * from `tabContact` where %s contact = webnotes.conn.sql("""select * from `tabContact` where name=%s""", contact_name, as_dict=True)
order by is_primary_contact desc, name asc limit 1""" % condition, as_dict=True)
if contact: if contact:
contact = contact[0] contact = contact[0]