From 94329abd020a2a47fdcf6d256c6c76677c868b02 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 19 Apr 2012 16:08:33 +0530 Subject: [PATCH] modifed format for raw material report in prod plan --- .../production_planning_tool.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/erpnext/production/doctype/production_planning_tool/production_planning_tool.py b/erpnext/production/doctype/production_planning_tool/production_planning_tool.py index 2bec00f61d..272d13f6af 100644 --- a/erpnext/production/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/production/doctype/production_planning_tool/production_planning_tool.py @@ -201,7 +201,6 @@ class DocType: def download_raw_materials(self): """ Create csv data for required raw material to produce finished goods""" - self.test = [] bom_dict = self.get_distinct_bom(action = 'download_rm') self.get_raw_materials(bom_dict) return self.get_csv() @@ -242,17 +241,22 @@ class DocType: def make_items_dict(self, item_list): - for i in item_list: self.item_dict[i[0]] = [(flt(self.item_dict.get(i[0], [0])[0]) + flt(i[1])), i[2], i[3]] def get_csv(self): - item_list = [['Item Code', 'Description', 'Stock UOM', 'Required Qty', 'Indented Qty', 'Ordered Qty', 'Actual Qty']] + item_list = [['Item Code', 'Description', 'Stock UOM', 'Required Qty', 'Warehouse', 'Indented Qty', 'Ordered Qty', 'Actual Qty']] for d in self.item_dict: - item_qty= sql("select sum(indented_qty), sum(ordered_qty), sum(actual_qty) from `tabBin` where item_code = %s", d) - item_list.append([d, self.item_dict[d][1], self.item_dict[d][2], self.item_dict[d][0], flt(item_qty[0][0]), flt(item_qty[0][1]), flt(item_qty[0][2])]) - item_list.append(self.test) + item_list.append([d, self.item_dict[d][1], self.item_dict[d][2], self.item_dict[d][0]]), + item_qty= sql("select warehouse, indented_qty, ordered_qty, actual_qty from `tabBin` where item_code = %s", d) + i_qty, o_qty, a_qty = 0,0,0 + for w in item_qty: + i_qty, o_qty, a_qty = i_qty + flt(w[1]), o_qty + flt(w[2]), a_qty + flt(w[3]) + item_list.append(['', '', '', '', w[0], flt(w[1]), flt(w[2]), flt(w[3])]) + if item_qty: + item_list.append(['', '', '', '', 'Total', i_qty, o_qty, a_qty]) + return item_list