mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-20 07:22:13 +00:00
fix: address and contact filters for SCO and SCR (#42310)
(cherry picked from commit 7656220075)
Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
@@ -9,6 +9,7 @@ frappe.ui.form.on("Subcontracting Order", {
|
|||||||
setup: (frm) => {
|
setup: (frm) => {
|
||||||
frm.get_field("items").grid.cannot_add_rows = true;
|
frm.get_field("items").grid.cannot_add_rows = true;
|
||||||
frm.get_field("items").grid.only_sortable();
|
frm.get_field("items").grid.only_sortable();
|
||||||
|
frm.trigger("set_queries");
|
||||||
|
|
||||||
frm.set_indicator_formatter("item_code", (doc) => (doc.qty <= doc.received_qty ? "green" : "orange"));
|
frm.set_indicator_formatter("item_code", (doc) => (doc.qty <= doc.received_qty ? "green" : "orange"));
|
||||||
|
|
||||||
@@ -93,6 +94,17 @@ frappe.ui.form.on("Subcontracting Order", {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
set_queries: (frm) => {
|
||||||
|
frm.set_query("contact_person", erpnext.queries.contact_query);
|
||||||
|
frm.set_query("supplier_address", erpnext.queries.address_query);
|
||||||
|
|
||||||
|
frm.set_query("billing_address", erpnext.queries.company_address_query);
|
||||||
|
|
||||||
|
frm.set_query("shipping_address", () => {
|
||||||
|
return erpnext.queries.company_address_query(frm.doc);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
onload: (frm) => {
|
onload: (frm) => {
|
||||||
if (!frm.doc.transaction_date) {
|
if (!frm.doc.transaction_date) {
|
||||||
frm.set_value("transaction_date", frappe.datetime.get_today());
|
frm.set_value("transaction_date", frappe.datetime.get_today());
|
||||||
@@ -116,6 +128,8 @@ frappe.ui.form.on("Subcontracting Order", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
refresh: function (frm) {
|
refresh: function (frm) {
|
||||||
|
frappe.dynamic_link = { doc: frm.doc, fieldname: "supplier", doctype: "Supplier" };
|
||||||
|
|
||||||
if (frm.doc.docstatus == 1 && frm.has_perm("submit")) {
|
if (frm.doc.docstatus == 1 && frm.has_perm("submit")) {
|
||||||
if (frm.doc.status == "Closed") {
|
if (frm.doc.status == "Closed") {
|
||||||
frm.add_custom_button(
|
frm.add_custom_button(
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ frappe.ui.form.on("Subcontracting Receipt", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
refresh: (frm) => {
|
refresh: (frm) => {
|
||||||
|
frappe.dynamic_link = { doc: frm.doc, fieldname: "supplier", doctype: "Supplier" };
|
||||||
|
|
||||||
if (frm.doc.docstatus === 1) {
|
if (frm.doc.docstatus === 1) {
|
||||||
frm.add_custom_button(
|
frm.add_custom_button(
|
||||||
__("Stock Ledger"),
|
__("Stock Ledger"),
|
||||||
@@ -165,6 +167,15 @@ frappe.ui.form.on("Subcontracting Receipt", {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frm.set_query("contact_person", erpnext.queries.contact_query);
|
||||||
|
frm.set_query("supplier_address", erpnext.queries.address_query);
|
||||||
|
|
||||||
|
frm.set_query("billing_address", erpnext.queries.company_address_query);
|
||||||
|
|
||||||
|
frm.set_query("shipping_address", () => {
|
||||||
|
return erpnext.queries.company_address_query(frm.doc);
|
||||||
|
});
|
||||||
|
|
||||||
frm.set_query("rejected_warehouse", () => {
|
frm.set_query("rejected_warehouse", () => {
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
|
|||||||
Reference in New Issue
Block a user