From c95bad917b82d2d273278853de3922d9f7e0cc16 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 11 Jan 2012 18:28:43 +0530 Subject: [PATCH] open sales order query changes: pull only those which are pending to deliver --- .../production_planning_tool.py | 12 ++++++------ 1 file changed, 6 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 7f65021d53..c2a609de87 100644 --- a/erpnext/production/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/production/doctype/production_planning_tool/production_planning_tool.py @@ -59,11 +59,11 @@ class DocType: select distinct t1.name, t1.transaction_date, t1.customer, t1.grand_total from - `tabSales Order` t1, `tabDelivery Note Packing Detail` t2, tabItem t3 + `tabSales Order` t1, `tabSales Order Detail` t2, `tabDelivery Note Packing Detail` t3, tabItem t4 where - t1.name = t2.parent and t2.parenttype = 'Sales Order' and t1.docstatus = 1 and t3.name = t2.item_code - and ifnull(t1.per_delivered, 0) < 100 and t1.status != 'Stopped' and company = '%s' %s - and (ifnull(t3.is_pro_applicable, 'No') = 'Yes' or ifnull(t3.is_sub_contracted_item, 'No') = 'Yes') + t1.name = t2.parent and t1.name = t3.parent and t3.parenttype = 'Sales Order' and t1.docstatus = 1 and t2.item_code = t3.parent_item + and t4.name = t3.item_code and t1.status != 'Stopped' and t1.company = '%s' and ifnull(t2.qty, 0) > ifnull(t2.delivered_qty, 0) + and (ifnull(t4.is_pro_applicable, 'No') = 'Yes' or ifnull(t4.is_sub_contracted_item, 'No') = 'Yes') %s order by t1.name desc """% (self.doc.company, cond), as_dict = 1) @@ -88,7 +88,7 @@ class DocType: if self.doc.customer: cond += ' and t1.customer = "' + self.doc.customer + '"' if self.doc.fg_item: - cond += ' and t2.item_code = "' + self.doc.fg_item + '"' + cond += ' and t3.item_code = "' + self.doc.fg_item + '"' return cond @@ -120,7 +120,7 @@ class DocType: def get_included_so(self): - so = "'" + "','".join([d.sales_order for d in getlist(self.doclist, 'pp_so_details') if d.include_in_plan]) + "'" + so = "'" + "','".join([cstr(d.sales_order) for d in getlist(self.doclist, 'pp_so_details') if d.include_in_plan]) + "'" return so