[minor] [fix] fetch contact details
This commit is contained in:
parent
edac54f58b
commit
deff57826a
@ -104,7 +104,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
if (this.frm.doc.supplier) {
|
if (this.frm.doc.supplier) {
|
||||||
wn.call({
|
wn.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "get_supplier_address",
|
method: "set_supplier_address",
|
||||||
freeze: true,
|
freeze: true,
|
||||||
args: {
|
args: {
|
||||||
supplier: this.frm.doc.supplier,
|
supplier: this.frm.doc.supplier,
|
||||||
|
@ -163,7 +163,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
address: this.frm.doc.customer_address,
|
address: this.frm.doc.customer_address,
|
||||||
contact: this.frm.doc.contact_person
|
contact: this.frm.doc.contact_person
|
||||||
},
|
},
|
||||||
method: "get_customer_address",
|
method: "set_customer_address",
|
||||||
freeze: true,
|
freeze: true,
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
me.frm.refresh_fields();
|
me.frm.refresh_fields();
|
||||||
|
@ -150,6 +150,9 @@ class TransactionBase(StatusUpdater):
|
|||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
def set_customer_address(self, args):
|
||||||
|
self.doc.fields.update(self.get_customer_address(args))
|
||||||
|
|
||||||
# TODO deprecate this - used only in sales_order.js
|
# TODO deprecate this - used only in sales_order.js
|
||||||
def get_shipping_address(self, name):
|
def get_shipping_address(self, name):
|
||||||
shipping_address = get_default_address("customer", name, is_shipping_address=True)
|
shipping_address = get_default_address("customer", name, is_shipping_address=True)
|
||||||
@ -184,6 +187,9 @@ class TransactionBase(StatusUpdater):
|
|||||||
ret.update(map_party_contact_details(contact_name=args['contact']))
|
ret.update(map_party_contact_details(contact_name=args['contact']))
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
def set_supplier_address(self, args):
|
||||||
|
self.doc.fields.update(self.get_supplier_address(args))
|
||||||
|
|
||||||
# Get Supplier Details
|
# Get Supplier Details
|
||||||
# -----------------------
|
# -----------------------
|
||||||
def get_supplier_details(self, name):
|
def get_supplier_details(self, name):
|
||||||
@ -390,12 +396,14 @@ 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
|
||||||
|
|
||||||
if not contact_name:
|
condition = ""
|
||||||
contact_name = get_default_contact(party_field, party_name)
|
if contact_name:
|
||||||
if party_field:
|
condition = " name = '%s'" % contact_name
|
||||||
contact = webnotes.conn.sql("""select * from `tabContact` where `%s`=%s
|
elif party_field and party_name:
|
||||||
order by is_primary_contact desc, name asc limit 1""" % (party_field, "%s"),
|
condition = " `%s`='%s'" % (party_field, party_name)
|
||||||
(party_name,), as_dict=True)
|
|
||||||
|
contact = webnotes.conn.sql("""select * from `tabContact` where %s
|
||||||
|
order by is_primary_contact desc, name asc limit 1""" % condition, as_dict=True)
|
||||||
|
|
||||||
if contact:
|
if contact:
|
||||||
contact = contact[0]
|
contact = contact[0]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user