From 00ba2ce8b4a7cab13bafc52b2977c96aeec86da1 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 2 May 2012 16:04:42 +0530 Subject: [PATCH] fixes in sales and pur return --- .../sales_and_purchase_return_tool.js | 14 +++++--------- .../sales_and_purchase_return_tool.py | 4 ++-- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.js b/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.js index 19cec92a2e..30242d4222 100644 --- a/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.js +++ b/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.js @@ -43,21 +43,17 @@ cur_frm.fields_dict.purchase_receipt_no.get_query = function(doc) { //---------------------------------- cur_frm.cscript.return_type = function(doc, cdt, cdn) { var cp = wn.control_panel; - hide_field(['purchase_receipt_no', 'delivery_note_no', 'sales_invoice_no', - 'return_details', 'get_items', 'Make Excise Invoice', 'Make Stock Entry', - 'Make Debit Note', 'Make Credit Note']); + hide_field(['purchase_receipt_no', 'delivery_note_no', 'sales_invoice_no', 'return_details', 'get_items', 'make_excise_invoice', 'make_stock_entry', 'make_debit_note', 'make_credit_note']); if(doc.return_type == 'Sales Return') { - unhide_field(['delivery_note_no', 'sales_invoice_no', 'get_items', - 'return_details', 'Make Credit Note', 'Make Stock Entry']); + unhide_field(['delivery_note_no', 'sales_invoice_no', 'get_items', 'return_details', 'make_credit_note', 'make_stock_entry']); - if(cp.country == 'India') { unhide_field(['Make Excise Invoice']); } + if(cp.country == 'India') { unhide_field(['make_excise_invoice']); } } else if(doc.return_type == 'Purchase Return') { - unhide_field(['purchase_receipt_no', 'get_items', 'return_details', - 'Make Debit Note', 'Make Stock Entry']); + unhide_field(['purchase_receipt_no', 'get_items', 'return_details', 'make_debit_note', 'make_stock_entry']); - if(cp.country == 'India') { unhide_field(['Make Excise Invoice']); } + if(cp.country == 'India') { unhide_field(['make_excise_invoice']);} } cur_frm.cscript.clear_fields(doc); diff --git a/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py b/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py index fcf909ca90..7ff351bf64 100644 --- a/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py +++ b/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py @@ -42,9 +42,9 @@ class DocType : def pull_item_details(self): if self.doc.return_type == 'Sales Return': if self.doc.delivery_note_no: - det = sql("select t1.name, t1.item_code, t1.description, t1.qty, t1.uom, t2.export_rate * t3.conversion_rate, t3.customer, t3.customer_name, t3.customer_address, t2.serial_no, t2.batch_no from `tabDelivery Note Packing Detail` t1, `tabDelivery Note Detail` t2, `tabDelivery Note` t3 where t1.parent = t3.name and t2.parent = t3.name and t1.parent_detail_docname = t2.name and t3.name = '%s' and t3.docstatus = 1" % self.doc.delivery_note_no) + det = sql("select t1.name, t1.item_code, t1.description, t1.qty, t1.uom, t2.export_rate * t3.conversion_rate, t3.customer, t3.customer_name, t3.customer_address, t2.serial_no, t2.batch_no from `tabDelivery Note Packing Item` t1, `tabDelivery Note Item` t2, `tabDelivery Note` t3 where t1.parent = t3.name and t2.parent = t3.name and t1.parent_detail_docname = t2.name and t3.name = '%s' and t3.docstatus = 1" % self.doc.delivery_note_no) elif self.doc.sales_invoice_no: - det = sql("select t1.name, t1.item_code, t1.description, t1.qty, t1.stock_uom, t1.export_rate * t2.conversion_rate, t2.customer, t2.customer_name, t2.customer_address, t1.serial_no from `tabRV Detail` t1, `tabReceivable Voucher` t2 where t1.parent = t2.name and t2.name = '%s' and t2.docstatus = 1" % self.doc.sales_invoice_no) + det = sql("select t1.name, t1.item_code, t1.description, t1.qty, t1.stock_uom, t1.export_rate * t2.conversion_rate, t2.customer, t2.customer_name, t2.customer_address, t1.serial_no from `tabSales Invoice Item` t1, `tabSales Invoice` t2 where t1.parent = t2.name and t2.name = '%s' and t2.docstatus = 1" % self.doc.sales_invoice_no) elif self.doc.return_type == 'Purchase Return' and self.doc.purchase_receipt_no: det = sql("select t1.name, t1.item_code, t1.description, t1.received_qty, t1.uom, t1.purchase_rate, t2.supplier, t2.supplier_name, t2.supplier_address, t1.serial_no, t1.batch_no from `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 where t1.parent = t2.name and t2.name = '%s' and t2.docstatus = 1" % self.doc.purchase_receipt_no)