Merge pull request #31026 from ankush/item_attr_limit
fix: remove item attribute limit from variant selector
diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js
index bbf1ff6..58eb891 100644
--- a/erpnext/public/js/controllers/buying.js
+++ b/erpnext/public/js/controllers/buying.js
@@ -90,7 +90,7 @@
else {
return{
query: "erpnext.controllers.queries.item_query",
- filters: { 'supplier': me.frm.doc.supplier, 'is_purchase_item': 1 }
+ filters: { 'supplier': me.frm.doc.supplier, 'is_purchase_item': 1, 'has_variants': 0}
}
}
});
diff --git a/erpnext/public/js/utils/barcode_scanner.js b/erpnext/public/js/utils/barcode_scanner.js
index 3ae1234..d378118 100644
--- a/erpnext/public/js/utils/barcode_scanner.js
+++ b/erpnext/public/js/utils/barcode_scanner.js
@@ -31,30 +31,39 @@
}
process_scan() {
- let me = this;
+ return new Promise((resolve, reject) => {
+ let me = this;
- const input = this.scan_barcode_field.value;
- if (!input) {
- return;
- }
+ const input = this.scan_barcode_field.value;
+ if (!input) {
+ return;
+ }
- frappe
- .call({
- method: this.scan_api,
- args: {
- search_value: input,
- },
- })
- .then((r) => {
- const data = r && r.message;
- if (!data || Object.keys(data).length === 0) {
- this.show_alert(__("Cannot find Item with this Barcode"), "red");
- this.clean_up();
- return;
- }
+ frappe
+ .call({
+ method: this.scan_api,
+ args: {
+ search_value: input,
+ },
+ })
+ .then((r) => {
+ const data = r && r.message;
+ if (!data || Object.keys(data).length === 0) {
+ this.show_alert(__("Cannot find Item with this Barcode"), "red");
+ this.clean_up();
+ reject();
+ return;
+ }
- me.update_table(data);
- });
+ const row = me.update_table(data);
+ if (row) {
+ resolve(row);
+ }
+ else {
+ reject();
+ }
+ });
+ });
}
update_table(data) {
@@ -90,6 +99,7 @@
this.set_batch_no(row, batch_no);
this.set_barcode(row, barcode);
this.clean_up();
+ return row;
}
// batch and serial selector is reduandant when all info can be added by scan
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index 98131f9..0954de4 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -64,7 +64,7 @@
this.frm.set_query("item_code", "items", function() {
return {
query: "erpnext.controllers.queries.item_query",
- filters: {'is_sales_item': 1, 'customer': cur_frm.doc.customer}
+ filters: {'is_sales_item': 1, 'customer': cur_frm.doc.customer, 'has_variants': 0}
}
});
}