Merge pull request #45255 from frappe/mergify/bp/version-15-hotfix/pr-45074

fix: set billing and shipping address on change of company (backport #45074)
This commit is contained in:
ruthra kumar
2025-01-14 10:22:42 +05:30
committed by GitHub
2 changed files with 18 additions and 3 deletions

View File

@@ -157,10 +157,17 @@ erpnext.buying = {
if(!frappe.meta.has_field(this.frm.doc.doctype, "billing_address")) return;
frappe.call({
method: "erpnext.setup.doctype.company.company.get_default_company_address",
args: { name: this.frm.doc.company, existing_address:this.frm.doc.billing_address },
method: "erpnext.setup.doctype.company.company.get_billing_shipping_address",
args: {
name: this.frm.doc.company,
billing_address:this.frm.doc.billing_address,
shipping_address: this.frm.doc.shipping_address
},
callback: (r) => {
this.frm.set_value("billing_address", r.message || "");
this.frm.set_value("billing_address", r.message.primary_address || "");
if(!frappe.meta.has_field(this.frm.doc.doctype, "shipping_address")) return;
this.frm.set_value("shipping_address", r.message.shipping_address || "");
},
});
}