Antony-PB

Untitled

May 19th, 2023
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1.  
  2. import frappe
  3. from frappe.model.document import Document
  4.  
  5. class ItemWizard(Document):
  6. pass
  7.  
  8.  
  9. @frappe.whitelist()
  10. def get_item_group_filter_data(item_group):
  11. doctype = "Item Group"
  12. doc = frappe.get_doc(doctype, item_group)
  13.  
  14. data = {
  15. "brand": [item.brand for item in doc.brand]
  16. }
  17.  
  18. return data
  19.  
  20. ----------------------------------------------------------------------------------------------------
  21.  
  22. var item_group
  23.  
  24. frappe.ui.form.on("Item Wizard", {
  25. // refresh: function(frm) {
  26.  
  27. // }
  28. item_group: function (frm) {
  29.  
  30. frappe.call({
  31. method:"ss_custom_erpnext.ss_custom_erpnext.doctype.item_wizard.item_wizard.get_item_group_filter_data",
  32. args: {item_group:frm.doc.item_group},
  33. async: false,
  34. callback: function(r) {
  35. item_group = r.message
  36. }
  37. });
  38.  
  39.  
  40. frm.set_query("brand", function () {
  41. return {
  42. filters: {
  43. name: ["in", item_group.brand],
  44. },
  45. };
  46. });
  47. },
  48. });
  49.  
Advertisement
Add Comment
Please, Sign In to add comment