From 0adfebee85c58bf0585b259f28f803ad852af182 Mon Sep 17 00:00:00 2001 From: Sanket322 Date: Wed, 25 Dec 2024 18:14:10 +0530 Subject: [PATCH] fix: set/update billing address on change of company --- .../accounts/doctype/purchase_invoice/purchase_invoice.js | 8 ++++++++ erpnext/public/js/controllers/transaction.js | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index adf49c42d41..b7c17221215 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -721,6 +721,14 @@ frappe.ui.form.on("Purchase Invoice", { if (response) frm.set_value("credit_to", response.message); }, }); + + frappe.call({ + method: "erpnext.setup.doctype.company.company.get_default_company_address", + args: { name: frm.doc.company }, + callback: (r) => { + frm.set_value("billing_address", r.message || ""); + }, + }); } }, }); diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 281dfeef97e..250f7c70c7a 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -983,7 +983,6 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe let is_drop_ship = me.frm.doc.items.some(item => item.delivered_by_supplier); if (!is_drop_ship) { - console.log('get_shipping_address'); erpnext.utils.get_shipping_address(this.frm, function() { set_party_account(set_pricing); });