Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import frappe
- from frappe.model.document import Document
- class ItemWizard(Document):
- pass
- @frappe.whitelist()
- def get_item_group_filter_data(item_group):
- doctype = "Item Group"
- doc = frappe.get_doc(doctype, item_group)
- data = {
- "brand": [item.brand for item in doc.brand]
- }
- return data
- ----------------------------------------------------------------------------------------------------
- var item_group
- frappe.ui.form.on("Item Wizard", {
- // refresh: function(frm) {
- // }
- item_group: function (frm) {
- frappe.call({
- method:"ss_custom_erpnext.ss_custom_erpnext.doctype.item_wizard.item_wizard.get_item_group_filter_data",
- args: {item_group:frm.doc.item_group},
- async: false,
- callback: function(r) {
- item_group = r.message
- }
- });
- frm.set_query("brand", function () {
- return {
- filters: {
- name: ["in", item_group.brand],
- },
- };
- });
- },
- });
Advertisement
Add Comment
Please, Sign In to add comment