Hi,
In the following code, I would like to get the sum(item.qty) only for a particular item_code
total_qty = sum((item.qty for item in self.get(“items”)))
How do I do that?
thanks
Krithi
Hi,
In the following code, I would like to get the sum(item.qty) only for a particular item_code
total_qty = sum((item.qty for item in self.get(“items”)))
How do I do that?
thanks
Krithi
total_qty = sum([item.qty for item in self.get("items") if item.item_code = 'x'])
Shouldn’t it will run in backend? Just in curiosity, how can i do this in client-side? I am looking for just a simple demonstration, nothing else.
var sum = 0;
cur_frm.doc.items.forEach(function(item){
sum += item.item_code === 'x' ? item.qty : 0;
});
Thank you
how to use for loop in items
like
for (var i;i<=doc.items.length ;i++)
for (var i =0; i < cur_frm.doc.items.length; i++)
{
cur_frm.doc.items[i].date = cur_frm.doc.delivery_date;
}
cur_frm.refresh_field('items');
Hi @NCP , does this one can be apply/use in custom print format which use Jinja templating ? Can you guide/ show an example please ?
Thankyou in advanced.