From 68eb6894501b0886dc853f485e22679b2ac33e1d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 22 Feb 2016 16:14:35 +0530 Subject: [PATCH 1/2] [fix] UOM fixed in Item-wise Purchase History report --- .../item_wise_purchase_history.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/erpnext/buying/report/item_wise_purchase_history/item_wise_purchase_history.json b/erpnext/buying/report/item_wise_purchase_history/item_wise_purchase_history.json index 4cfda963b6..4659b36bca 100644 --- a/erpnext/buying/report/item_wise_purchase_history/item_wise_purchase_history.json +++ b/erpnext/buying/report/item_wise_purchase_history/item_wise_purchase_history.json @@ -2,17 +2,18 @@ "add_total_row": 1, "apply_user_permissions": 1, "creation": "2013-05-03 14:55:53", + "disabled": 0, "docstatus": 0, "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2016-01-28 15:36:46.837095", + "modified": "2016-02-22 11:27:39.445257", "modified_by": "Administrator", "module": "Buying", "name": "Item-wise Purchase History", "owner": "Administrator", - "query": "select\n po_item.item_code as \"Item Code:Link/Item:120\",\n\tpo_item.item_name as \"Item Name::120\",\n po_item.item_group as \"Item Group:Link/Item Group:120\",\n\tpo_item.description as \"Description::150\",\n\tpo_item.qty as \"Qty:Float:100\",\n\tpo_item.stock_uom as \"UOM:Link/UOM:80\",\n\tpo_item.base_rate as \"Rate:Currency:120\",\n\tpo_item.base_amount as \"Amount:Currency:120\",\n\tpo.name as \"Purchase Order:Link/Purchase Order:120\",\n\tpo.transaction_date as \"Transaction Date:Date:140\",\n\tpo.supplier as \"Supplier:Link/Supplier:130\",\n sup.supplier_name as \"Supplier Name::150\",\n\tpo_item.project_name as \"Project:Link/Project:130\",\n\tifnull(po_item.received_qty, 0) as \"Received Qty:Float:120\",\n\tpo.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order` po, `tabPurchase Order Item` po_item, `tabSupplier` sup\nwhere\n\tpo.name = po_item.parent and po.supplier = sup.name and po.docstatus = 1\norder by po.name desc", + "query": "select\n po_item.item_code as \"Item Code:Link/Item:120\",\n\tpo_item.item_name as \"Item Name::120\",\n po_item.item_group as \"Item Group:Link/Item Group:120\",\n\tpo_item.description as \"Description::150\",\n\tpo_item.qty as \"Qty:Float:100\",\n\tpo_item.uom as \"UOM:Link/UOM:80\",\n\tpo_item.base_rate as \"Rate:Currency:120\",\n\tpo_item.base_amount as \"Amount:Currency:120\",\n\tpo.name as \"Purchase Order:Link/Purchase Order:120\",\n\tpo.transaction_date as \"Transaction Date:Date:140\",\n\tpo.supplier as \"Supplier:Link/Supplier:130\",\n sup.supplier_name as \"Supplier Name::150\",\n\tpo_item.project_name as \"Project:Link/Project:130\",\n\tifnull(po_item.received_qty, 0) as \"Received Qty:Float:120\",\n\tpo.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order` po, `tabPurchase Order Item` po_item, `tabSupplier` sup\nwhere\n\tpo.name = po_item.parent and po.supplier = sup.name and po.docstatus = 1\norder by po.name desc", "ref_doctype": "Purchase Order", "report_name": "Item-wise Purchase History", "report_type": "Query Report" -} +} \ No newline at end of file From db746f5bc73ff194cfb0de600fd594af0ccac8ea Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 22 Feb 2016 16:16:58 +0530 Subject: [PATCH 2/2] [fix] Condition for Payment and Return button visibility --- .../doctype/purchase_invoice/purchase_invoice.js | 6 ++++-- .../accounts/doctype/sales_invoice/sales_invoice.js | 12 +++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index d3a72d64d4..b158ea296a 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -24,11 +24,13 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ if(!doc.is_return) { if(doc.docstatus==1) { - if(doc.outstanding_amount != 0) { + if(doc.outstanding_amount < 0) { this.frm.add_custom_button(__('Payment'), this.make_bank_entry, __("Make")); cur_frm.page.set_inner_btn_group_as_primary(__("Make")); } - cur_frm.add_custom_button(__('Debit Note'), this.make_debit_note, __("Make")); + if(Math.abs(flt(doc.outstanding_amount)) < flt(doc.grand_total)) { + cur_frm.add_custom_button(__('Debit Note'), this.make_debit_note, __("Make")); + } } if(doc.docstatus===0) { diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 26a9fa61c9..7b9b803945 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -57,10 +57,12 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte return item.is_delivered_by_supplier ? true : false; }) - cur_frm.add_custom_button(doc.update_stock ? __('Sales Return') : __('Credit Note'), - this.make_sales_return, __("Make")); - cur_frm.page.set_inner_btn_group_as_primary(__("Make")); - + if(Math.abs(flt(doc.outstanding_amount)) < flt(doc.grand_total)) { + cur_frm.add_custom_button(doc.update_stock ? __('Sales Return') : __('Credit Note'), + this.make_sales_return, __("Make")); + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); + } + if(cint(doc.update_stock)!=1) { // show Make Delivery Note button only if Sales Invoice is not created from Delivery Note var from_delivery_note = false; @@ -75,7 +77,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte } } - if(doc.outstanding_amount!=0 && !cint(doc.is_return)) { + if(doc.outstanding_amount>0 && !cint(doc.is_return)) { cur_frm.add_custom_button(__('Payment Request'), this.make_payment_request, __("Make")); cur_frm.add_custom_button(__('Payment'), cur_frm.cscript.make_bank_entry, __("Make")); }