Merge pull request #26201 from noahjacob/shipping_address_fix_v13

fix: fetch preferred shipping address (bp #26132)
This commit is contained in:
Deepesh Garg 2021-06-24 17:35:34 +05:30 committed by GitHub
commit 79daed00c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -33,6 +33,8 @@ def get_shipping_address(company, address = None):
if address and frappe.db.get_value('Dynamic Link',
{'parent': address, 'link_name': company}):
filters.append(["Address", "name", "=", address])
if not address:
filters.append(["Address", "is_shipping_address", "=", 1])
address = frappe.get_all("Address", filters=filters, fields=fields) or {}

View File

@ -274,9 +274,9 @@ erpnext.utils.validate_mandatory = function(frm, label, value, trigger_on) {
return true;
}
erpnext.utils.get_shipping_address = function(frm, callback){
erpnext.utils.get_shipping_address = function(frm, callback) {
if (frm.doc.company) {
if (!(frm.doc.inter_com_order_reference || frm.doc.internal_invoice_reference ||
if ((frm.doc.inter_company_order_reference || frm.doc.internal_invoice_reference ||
frm.doc.internal_order_reference)) {
if (callback) {
return callback();