Merge pull request #2565 from alexandre-00/patch-11

Update bom.py
This commit is contained in:
Nabin Hait 2015-01-14 11:39:08 +05:30
commit c481e27d88

View File

@ -8,6 +8,8 @@ from frappe.utils import cint, cstr, flt
from frappe import _
from frappe.model.document import Document
from operator import itemgetter
class BOM(Document):
def autoname(self):
@ -360,7 +362,7 @@ class BOM(Document):
"Add items to Flat BOM table"
frappe.db.sql("""delete from `tabBOM Explosion Item` where parent=%s""", self.name)
self.set('flat_bom_details', [])
for d in self.cur_exploded_items:
for d in sorted(self.cur_exploded_items, key=itemgetter(0)):
ch = self.append('flat_bom_details', {})
for i in self.cur_exploded_items[d].keys():
ch.set(i, self.cur_exploded_items[d][i])