started cleanup of address / contact calls - partly fixed for customer, to fix shipping_address, get_pos_values, for all supplier transactions

This commit is contained in:
Rushabh Mehta
2014-01-02 11:47:23 +05:30
parent 3f7e2729bb
commit b09d9dabc5
24 changed files with 508 additions and 565 deletions

View File

@@ -0,0 +1,46 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
wn.provide("erpnext.utils");
erpnext.utils.get_customer_details = function(frm, method, args) {
if(!method)
method = "erpnext.selling.doctype.customer.customer.get_customer_details";
if(!args)
args = { customer: frm.doc.customer };
wn.call({
method: method,
args: args,
callback: function(r) {
if(r.message) {
frm.updating_customer_details = true;
frm.set_value(r.message);
frm.updating_customer_details = false;
}
}
});
}
erpnext.utils.get_address_display = function(frm, address_field) {
if(frm.updating_customer_details) return;
if(!address_field) address_field = "customer_address";
wn.call({
method: "erpnext.utilities.doctype.address.address.get_address_display",
args: {address: frm.doc[address_field] },
callback: function(r) {
if(r.message)
frm.set_value("address_display", r.message)
}
})
}
erpnext.utils.get_contact_details = function(frm) {
if(frm.updating_customer_details) return;
wn.call({
method: "erpnext.utilities.doctype.contact.contact.get_contact_details",
args: {address: frm.doc.contact_person },
callback: function(r) {
if(r.message)
frm.set_value(r.message);
}
})
}