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;
|
return selected_attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
let attribute_names = frm.doc.attributes.map(d => d.attribute);
|
frm.doc.attributes.forEach(function(d) {
|
||||||
|
|
||||||
attribute_names.forEach(function(attribute) {
|
|
||||||
let p = new Promise(resolve => {
|
let p = new Promise(resolve => {
|
||||||
|
if(!d.numeric_values) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method:"frappe.client.get_list",
|
method:"frappe.client.get_list",
|
||||||
args:{
|
args:{
|
||||||
doctype:"Item Attribute Value",
|
doctype:"Item Attribute Value",
|
||||||
filters: [
|
filters: [
|
||||||
["parent","=", attribute]
|
["parent","=", d.attribute]
|
||||||
],
|
],
|
||||||
fields: ["attribute_value"],
|
fields: ["attribute_value"],
|
||||||
limit_start: 0,
|
limit_start: 0,
|
||||||
@ -461,10 +460,32 @@ $.extend(erpnext.item, {
|
|||||||
}
|
}
|
||||||
}).then((r) => {
|
}).then((r) => {
|
||||||
if(r.message) {
|
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();
|
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);
|
promises.push(p);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user