feat: add Company Contact Person in selling transactions (backport #44362) (#44398)

* feat: add Company Contact Person in selling transactions (#44362)

(cherry picked from commit f6776c7d6b)

* chore: resolve merge conflicts

---------

Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com>
This commit is contained in:
mergify[bot]
2024-11-27 18:55:43 +01:00
committed by GitHub
parent 1f683afa43
commit 70b5b08d58
12 changed files with 69 additions and 16 deletions

View File

@@ -56,6 +56,17 @@ $.extend(erpnext.queries, {
}
},
company_contact_query: function (doc) {
if (!doc.company) {
frappe.throw(__("Please set {0}", [__(frappe.meta.get_label(doc.doctype, "company", doc.name))]));
}
return {
query: "frappe.contacts.doctype.contact.contact.contact_query",
filters: { link_doctype: "Company", link_name: doc.company },
};
},
address_query: function (doc) {
if (frappe.dynamic_link) {
if (!doc[frappe.dynamic_link.fieldname]) {

View File

@@ -49,6 +49,7 @@ erpnext.sales_common = {
);
me.frm.set_query("contact_person", erpnext.queries.contact_query);
me.frm.set_query("company_contact_person", erpnext.queries.company_contact_query);
me.frm.set_query("customer_address", erpnext.queries.address_query);
me.frm.set_query("shipping_address_name", erpnext.queries.address_query);
me.frm.set_query("dispatch_address_name", erpnext.queries.dispatch_address_query);