fix: PO/PINV - Check if doctype has company_address field before setting the value (#27441)

Co-authored-by: Vama Mehta <vama.mehta@inqubit.in>
(cherry picked from commit 666eaae6ce)

# Conflicts:
#	erpnext/public/js/controllers/transaction.js
This commit is contained in:
vama
2021-09-18 13:21:45 +05:30
committed by Mergify
parent c3b45c933a
commit fc473d6a24

View File

@@ -988,11 +988,31 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'].includes(this.frm.doctype)) {
let is_drop_ship = me.frm.doc.items.some(item => item.delivered_by_supplier);
<<<<<<< HEAD
if (!is_drop_ship) {
erpnext.utils.get_shipping_address(this.frm, function() {
set_party_account(set_pricing);
});
}
=======
// Get default company billing address in Purchase Invoice, Order and Receipt
if (this.frm.doc.company && frappe.meta.get_docfield(this.frm.doctype, "billing_address")) {
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 || ""},
debounce: 2000,
callback: function(r) {
if (r.message) {
me.frm.set_value("billing_address", r.message);
} else {
if (frappe.meta.get_docfield(me.frm.doctype, 'company_address')) {
me.frm.set_value("company_address", "");
}
}
}
});
}
>>>>>>> 666eaae6ce (fix: PO/PINV - Check if doctype has company_address field before setting the value (#27441))
} else {
set_party_account(set_pricing);