Rounding to the highest integer number

I was trying out the code for rounding to the highest integer number. and i did small modification on stockentry.py file. That is

import math (at the top)

self.add_to_stock_entry_detail({
item.name: {
“to_warehouse”: to_warehouse,
“from_warehouse”: “”,
“qty”: math.ceil(self.fg_completed_qty),
“item_name”: item.item_name,
“description”: item.description,
“stock_uom”: item.stock_uom,
“expense_account”: item.expense_account,
“cost_center”: item.buying_cost_center,
}
}, bom_no = self.bom_no)

I saved the file and made a new Production order => Transfer to Manufacture.But it is not working. What did i miss or is it the wrong place.

The rounded result should come on each items qty field in the Transfer to manufacture form.
Thanks

You are doing upper rounding in the wrong place. You need to do it inside add_to_stock_entry_detail function. Following lines should be modified:

se_child.qty = math.ceil(flt(item_dict[d]["qty"]))

se_child.transfer_qty = math.ceil(flt(item_dict[d]["qty"]))

Thanks Nabin,
I did the changes but sill no rounding happens

What is the matter?

Had this same error while using custom js script.

Solution: It is a typo, instead of math.ceil(), use Math.ceil()