fixes in sales and pur return

This commit is contained in:
Nabin Hait 2012-05-02 16:04:42 +05:30
parent a4561e14aa
commit 00ba2ce8b4
2 changed files with 7 additions and 11 deletions

View File

@ -43,21 +43,17 @@ cur_frm.fields_dict.purchase_receipt_no.get_query = function(doc) {
//---------------------------------- //----------------------------------
cur_frm.cscript.return_type = function(doc, cdt, cdn) { cur_frm.cscript.return_type = function(doc, cdt, cdn) {
var cp = wn.control_panel; var cp = wn.control_panel;
hide_field(['purchase_receipt_no', 'delivery_note_no', 'sales_invoice_no', 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']);
'return_details', 'get_items', 'Make Excise Invoice', 'Make Stock Entry',
'Make Debit Note', 'Make Credit Note']);
if(doc.return_type == 'Sales Return') { if(doc.return_type == 'Sales Return') {
unhide_field(['delivery_note_no', 'sales_invoice_no', 'get_items', unhide_field(['delivery_note_no', 'sales_invoice_no', 'get_items', 'return_details', 'make_credit_note', 'make_stock_entry']);
'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') { } else if(doc.return_type == 'Purchase Return') {
unhide_field(['purchase_receipt_no', 'get_items', 'return_details', unhide_field(['purchase_receipt_no', 'get_items', 'return_details', 'make_debit_note', 'make_stock_entry']);
'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); cur_frm.cscript.clear_fields(doc);

View File

@ -42,9 +42,9 @@ class DocType :
def pull_item_details(self): def pull_item_details(self):
if self.doc.return_type == 'Sales Return': if self.doc.return_type == 'Sales Return':
if self.doc.delivery_note_no: 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: 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: 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) 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)