mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-25 06:02:09 +01:00
fix: set billing and shipping address on change of company
(cherry picked from commit f46f1bead4)
This commit is contained in:
@@ -157,10 +157,13 @@ erpnext.buying = {
|
|||||||
if(!frappe.meta.has_field(this.frm.doc.doctype, "billing_address")) return;
|
if(!frappe.meta.has_field(this.frm.doc.doctype, "billing_address")) return;
|
||||||
|
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.setup.doctype.company.company.get_default_company_address",
|
method: "erpnext.setup.doctype.company.company.get_billing_shipping_address",
|
||||||
args: { name: this.frm.doc.company, existing_address:this.frm.doc.billing_address },
|
args: { name: this.frm.doc.company, existing_address:this.frm.doc.billing_address },
|
||||||
callback: (r) => {
|
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 || "");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -914,6 +914,14 @@ def get_default_company_address(name, sort_key="is_primary_address", existing_ad
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def get_billing_shipping_address(name, existing_address=None):
|
||||||
|
primart_address = get_default_company_address(name, "is_primary_address", existing_address)
|
||||||
|
shipping_address = get_default_company_address(name, "is_shipping_address", existing_address)
|
||||||
|
|
||||||
|
return {"primary_address": primart_address, "shipping_address": shipping_address}
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def create_transaction_deletion_request(company):
|
def create_transaction_deletion_request(company):
|
||||||
from erpnext.setup.doctype.transaction_deletion_record.transaction_deletion_record import (
|
from erpnext.setup.doctype.transaction_deletion_record.transaction_deletion_record import (
|
||||||
|
|||||||
Reference in New Issue
Block a user