-
Notifications
You must be signed in to change notification settings - Fork 3
feat : added product filtering in lead #282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v4_develop
Are you sure you want to change the base?
Changes from 1 commit
bae61e4
754ba5a
a3eeed6
7e39d73
e995091
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,5 +13,20 @@ frappe.ui.form.on("Lead", { | |
| } | ||
| }); | ||
|
|
||
| frappe.ui.form.on('Lead', { | ||
| refresh: function(frm) { | ||
| console.log("Lead form loaded - setting product filter"); | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove |
||
| frm.fields_dict['material_details'].grid.get_field('product_item').get_query = function(doc, cdt, cdn) { | ||
| console.log("Product item field filter applied"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove |
||
| return { | ||
| query: "versa_system.versa_system.custom_script.lead.get_only_products" | ||
| }; | ||
| }; | ||
| } | ||
| }); | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,18 @@ | ||
|
|
||
|
|
||
| frappe.ui.form.on("Quotation", { | ||
| refresh: function(frm) { | ||
| frm.add_custom_button( | ||
| __("GoTo Final Design"), | ||
| function () { | ||
| frappe.model.open_mapped_doc({ | ||
| method: "versa_system.versa_system.doctype.final_design.final_design.map_quotation_to_final_design", | ||
| source_name: frm.doc.name | ||
| }); | ||
| }, | ||
| __("Create") | ||
| ); | ||
| if (frm.doc.workflow_state === "Approved") { | ||
| frm.add_custom_button( | ||
| __("GoTo Final Design"), | ||
| function () { | ||
| frappe.model.open_mapped_doc({ | ||
| method: "versa_system.versa_system.doctype.final_design.final_design.map_quotation_to_final_design", | ||
| source_name: frm.doc.name | ||
| }); | ||
| }, | ||
| __("Create") | ||
| ); // <-- Corrected closing bracket | ||
| } | ||
| } | ||
| }); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import frappe | ||
|
|
||
| @frappe.whitelist() | ||
| def get_only_products(doctype, txt='', searchfield='name', start=0, page_len=20, filters=None): | ||
| """ | ||
| Fetch only 'Products' from the Item doctype. | ||
| """ | ||
| items = frappe.db.get_list( | ||
| "Item", | ||
| filters={"item_group": "Products"}, | ||
| fields=["name"], | ||
| order_by="modified DESC", | ||
| start=start, | ||
| page_length=page_len | ||
| ) | ||
|
|
||
|
|
||
| return [(item["name"],) for item in items] |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do not push commented code |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // Copyright (c) 2025, efeone and contributors | ||
| // For license information, please see license.txt | ||
|
|
||
| frappe.query_reports["Sales Order Report"] = { | ||
| "filters": [ | ||
|
|
||
| ] | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed