Enumerate numeric values in variant dialog
This commit is contained in:
parent
e45f957ad9
commit
be368fe94b
@ -444,16 +444,15 @@ $.extend(erpnext.item, {
|
||||
return selected_attributes;
|
||||
}
|
||||
|
||||
let attribute_names = frm.doc.attributes.map(d => d.attribute);
|
||||
|
||||
attribute_names.forEach(function(attribute) {
|
||||
frm.doc.attributes.forEach(function(d) {
|
||||
let p = new Promise(resolve => {
|
||||
if(!d.numeric_values) {
|
||||
frappe.call({
|
||||
method:"frappe.client.get_list",
|
||||
args:{
|
||||
doctype:"Item Attribute Value",
|
||||
filters: [
|
||||
["parent","=", attribute]
|
||||
["parent","=", d.attribute]
|
||||
],
|
||||
fields: ["attribute_value"],
|
||||
limit_start: 0,
|
||||
@ -461,10 +460,32 @@ $.extend(erpnext.item, {
|
||||
}
|
||||
}).then((r) => {
|
||||
if(r.message) {
|
||||
attr_val_fields[attribute] = r.message.map(function(d) { return d.attribute_value; });
|
||||
attr_val_fields[d.attribute] = r.message.map(function(d) { return d.attribute_value; });
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
frappe.call({
|
||||
method:"frappe.client.get",
|
||||
args:{
|
||||
doctype:"Item Attribute",
|
||||
name: d.attribute
|
||||
}
|
||||
}).then((r) => {
|
||||
if(r.message) {
|
||||
const from = r.message.from_range;
|
||||
const to = r.message.to_range;
|
||||
const increment = r.message.increment;
|
||||
|
||||
let values = [];
|
||||
for(var i = from; i <= to; i += increment) {
|
||||
values.push(i);
|
||||
}
|
||||
attr_val_fields[d.attribute] = values;
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
promises.push(p);
|
||||
|
Loading…
x
Reference in New Issue
Block a user