refactor: clean up product bundle client side code (#31455)

refactor: clean up product bundle cient side code

- Remove deprecated CUR_FRM scripts
- Remove client side fetches and move it to doctype schema
This commit is contained in:
Ankush Menat 2022-06-27 15:54:54 +05:30 committed by GitHub
parent 173588e169
commit 20dac08f5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 18 deletions

View File

@ -1,19 +1,13 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.toggle_enable('new_item_code', doc.__islocal);
}
cur_frm.fields_dict.new_item_code.get_query = function() {
return{
query: "erpnext.selling.doctype.product_bundle.product_bundle.get_new_item_code"
}
}
cur_frm.fields_dict.new_item_code.query_description = __('Please select Item where "Is Stock Item" is "No" and "Is Sales Item" is "Yes" and there is no other Product Bundle');
cur_frm.cscript.onload = function() {
// set add fetch for item_code's item_name and description
cur_frm.add_fetch('item_code', 'stock_uom', 'uom');
cur_frm.add_fetch('item_code', 'description', 'description');
}
frappe.ui.form.on("Product Bundle", {
refresh: function (frm) {
frm.toggle_enable("new_item_code", frm.is_new());
frm.set_query("new_item_code", () => {
return {
query: "erpnext.selling.doctype.product_bundle.product_bundle.get_new_item_code",
};
});
},
});

View File

@ -33,6 +33,8 @@
"reqd": 1
},
{
"fetch_from": "item_code.description",
"fetch_if_empty": 1,
"fieldname": "description",
"fieldtype": "Text Editor",
"in_list_view": 1,
@ -51,6 +53,8 @@
"print_hide": 1
},
{
"fetch_from": "item_code.stock_uom",
"fetch_if_empty": 1,
"fieldname": "uom",
"fieldtype": "Link",
"in_list_view": 1,
@ -64,7 +68,7 @@
"idx": 1,
"istable": 1,
"links": [],
"modified": "2020-02-28 14:06:05.725655",
"modified": "2022-06-27 05:30:18.475150",
"modified_by": "Administrator",
"module": "Selling",
"name": "Product Bundle Item",
@ -72,5 +76,6 @@
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}