fix: preserve address if present

This commit is contained in:
ravibharathi656
2025-10-07 12:46:09 +05:30
parent ff0969ace6
commit 0678638106
2 changed files with 10 additions and 7 deletions

View File

@@ -174,13 +174,15 @@ erpnext.buying = {
shipping_address: this.frm.doc.shipping_address, shipping_address: this.frm.doc.shipping_address,
}, },
callback: (r) => { callback: (r) => {
this.frm.set_value("billing_address", r.message.primary_address || ""); if (!this.frm.doc.billing_address)
this.frm.set_value("billing_address", r.message.primary_address || "");
if (!frappe.meta.has_field(this.frm.doc.doctype, "shipping_address")) return; if (
this.frm.set_value( !frappe.meta.has_field(this.frm.doc.doctype, "shipping_address") ||
"shipping_address", this.frm.doc.shipping_address
r.message.shipping_address || this.frm.doc.shipping_address || "" )
); return;
this.frm.set_value("shipping_address", r.message.shipping_address || "");
}, },
}); });
erpnext.utils.set_letter_head(this.frm); erpnext.utils.set_letter_head(this.frm);

View File

@@ -1170,7 +1170,8 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
if ( if (
frappe.meta.get_docfield(this.frm.doctype, "shipping_address") && frappe.meta.get_docfield(this.frm.doctype, "shipping_address") &&
["Purchase Order", "Purchase Receipt", "Purchase Invoice"].includes(this.frm.doctype) ["Purchase Order", "Purchase Receipt", "Purchase Invoice"].includes(this.frm.doctype) &&
!this.frm.doc.shipping_address
) { ) {
let is_drop_ship = me.frm.doc.items.some((item) => item.delivered_by_supplier); let is_drop_ship = me.frm.doc.items.some((item) => item.delivered_by_supplier);