fix: Drop Shipping address based on customer shopping address

(cherry picked from commit c7499f3528)
This commit is contained in:
Nihantra Patel
2024-11-13 14:55:45 +05:30
committed by Mergify
parent bce7acf9cc
commit 8af005cef0
2 changed files with 19 additions and 6 deletions

View File

@@ -956,9 +956,14 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
if (frappe.meta.get_docfield(this.frm.doctype, "shipping_address") &&
['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'].includes(this.frm.doctype)) {
erpnext.utils.get_shipping_address(this.frm, function() {
set_party_account(set_pricing);
});
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);
});
}
} else {
set_party_account(set_pricing);

View File

@@ -1402,9 +1402,17 @@ def make_purchase_order(source_name, selected_items=None, target_doc=None):
target.payment_schedule = []
if is_drop_ship_order(target):
target.customer = source.customer
target.customer_name = source.customer_name
target.shipping_address = source.shipping_address_name
if source.shipping_address_name:
target.shipping_address = source.shipping_address_name
target.shipping_address_display = source.shipping_address
else:
target.shipping_address = source.customer_address
target.shipping_address_display = source.address_display
target.customer_contact_person = source.contact_person
target.customer_contact_display = source.contact_display
target.customer_contact_mobile = source.contact_mobile
target.customer_contact_email = source.contact_email
else:
target.customer = target.customer_name = target.shipping_address = None