Skip to content

Commit

Permalink
fix: get address if multiple companies
Browse files Browse the repository at this point in the history
(cherry picked from commit c6cf1be)
  • Loading branch information
Nihantra-Patel authored and mergify[bot] committed Apr 16, 2024
1 parent f59e433 commit ccdbad9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions erpnext/selling/doctype/sales_order/sales_order.js
Expand Up @@ -169,6 +169,27 @@ frappe.ui.form.on("Sales Order", {
);
},

// When multiple companies are set up. in case company name is changed set default company address
company: function (frm) {
if (frm.doc.company) {
frappe.call({
method: "erpnext.setup.doctype.company.company.get_default_company_address",
args: {
name: frm.doc.company,
existing_address: frm.doc.company_address || ""
},
debounce: 2000,
callback: function (r) {
if (r.message) {
frm.set_value("company_address", r.message);
} else {
frm.set_value("company_address", "");
}
},
});
}
},

onload: function (frm) {
if (!frm.doc.transaction_date) {
frm.set_value("transaction_date", frappe.datetime.get_today());
Expand Down

0 comments on commit ccdbad9

Please sign in to comment.