Merge pull request #4852 from nabinhait/fixes72

Fixes
This commit is contained in:
Nabin Hait
2016-02-22 16:51:20 +05:30
3 changed files with 15 additions and 10 deletions

View File

@@ -24,11 +24,13 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
if(!doc.is_return) { if(!doc.is_return) {
if(doc.docstatus==1) { 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")); this.frm.add_custom_button(__('Payment'), this.make_bank_entry, __("Make"));
cur_frm.page.set_inner_btn_group_as_primary(__("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) { if(doc.docstatus===0) {

View File

@@ -57,10 +57,12 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
return item.is_delivered_by_supplier ? true : false; return item.is_delivered_by_supplier ? true : false;
}) })
cur_frm.add_custom_button(doc.update_stock ? __('Sales Return') : __('Credit Note'), if(Math.abs(flt(doc.outstanding_amount)) < flt(doc.grand_total)) {
this.make_sales_return, __("Make")); cur_frm.add_custom_button(doc.update_stock ? __('Sales Return') : __('Credit Note'),
cur_frm.page.set_inner_btn_group_as_primary(__("Make")); this.make_sales_return, __("Make"));
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
}
if(cint(doc.update_stock)!=1) { if(cint(doc.update_stock)!=1) {
// show Make Delivery Note button only if Sales Invoice is not created from Delivery Note // show Make Delivery Note button only if Sales Invoice is not created from Delivery Note
var from_delivery_note = false; 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 Request'), this.make_payment_request, __("Make"));
cur_frm.add_custom_button(__('Payment'), cur_frm.cscript.make_bank_entry, __("Make")); cur_frm.add_custom_button(__('Payment'), cur_frm.cscript.make_bank_entry, __("Make"));
} }

View File

@@ -2,17 +2,18 @@
"add_total_row": 1, "add_total_row": 1,
"apply_user_permissions": 1, "apply_user_permissions": 1,
"creation": "2013-05-03 14:55:53", "creation": "2013-05-03 14:55:53",
"disabled": 0,
"docstatus": 0, "docstatus": 0,
"doctype": "Report", "doctype": "Report",
"idx": 1, "idx": 1,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2016-01-28 15:36:46.837095", "modified": "2016-02-22 11:27:39.445257",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Item-wise Purchase History", "name": "Item-wise Purchase History",
"owner": "Administrator", "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", "ref_doctype": "Purchase Order",
"report_name": "Item-wise Purchase History", "report_name": "Item-wise Purchase History",
"report_type": "Query Report" "report_type": "Query Report"
} }