From a6e2ca9d3b26948f92e2e5f33d75df0368541555 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 15 Apr 2014 17:12:15 +0530 Subject: [PATCH] Fixes #1491 --- .../purchase_invoice/purchase_invoice.js | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 49f43f0bc6..3431ff45f1 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -13,7 +13,7 @@ frappe.provide("erpnext.accounts"); erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ onload: function() { this._super(); - + if(!this.frm.doc.__islocal) { // show credit_to in print format if(!this.frm.doc.supplier && this.frm.doc.credit_to) { @@ -21,15 +21,15 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ } } }, - + refresh: function(doc) { this._super(); - + // Show / Hide button if(doc.docstatus==1 && doc.outstanding_amount > 0) this.frm.add_custom_button(__('Make Payment Entry'), this.make_bank_voucher); - if(doc.docstatus==1) { + if(doc.docstatus==1) { cur_frm.appframe.add_button(__('View Ledger'), function() { frappe.route_options = { "voucher_no": doc.name, @@ -43,7 +43,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ } if(doc.docstatus===0) { - cur_frm.add_custom_button(__('From Purchase Order'), + cur_frm.add_custom_button(__('From Purchase Order'), function() { frappe.model.map_current_doc({ method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_invoice", @@ -58,7 +58,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ }) }); - cur_frm.add_custom_button(__('From Purchase Receipt'), + cur_frm.add_custom_button(__('From Purchase Receipt'), function() { frappe.model.map_current_doc({ method: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice", @@ -69,8 +69,8 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ company: cur_frm.doc.company } }) - }); - + }); + } this.is_opening(doc); @@ -79,7 +79,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ supplier: function() { if(this.frm.updating_party_details) return; - erpnext.utils.get_party_details(this.frm, + erpnext.utils.get_party_details(this.frm, "erpnext.accounts.party.get_party_details", { posting_date: this.frm.doc.posting_date, party: this.frm.doc.supplier, @@ -88,25 +88,25 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ price_list: this.frm.doc.buying_price_list, }) }, - + credit_to: function() { this.supplier(); }, - + write_off_amount: function() { this.calculate_outstanding_amount(); this.frm.refresh_fields(); }, - + allocated_amount: function() { this.calculate_total_advance("Purchase Invoice", "advance_allocation_details"); this.frm.refresh_fields(); - }, + }, tc_name: function() { this.get_terms(); }, - + entries_add: function(doc, cdt, cdn) { var row = frappe.get_doc(cdt, cdn); this.frm.script_manager.copy_from_first_row("entries", row, ["expense_account", "cost_center"]); @@ -143,16 +143,16 @@ cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) { cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { return{ filters:{'supplier': doc.supplier} - } + } } cur_frm.fields_dict['entries'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) { return { query: "erpnext.controllers.queries.item_query", filters:{ - 'is_purchase_item': 'Yes' + 'is_purchase_item': 'Yes' } - } + } } cur_frm.fields_dict['credit_to'].get_query = function(doc) { @@ -162,7 +162,7 @@ cur_frm.fields_dict['credit_to'].get_query = function(doc) { 'group_or_ledger': 'Ledger', 'company': doc.company } - } + } } // Get Print Heading @@ -171,12 +171,12 @@ return{ filters:[ ['Print Heading', 'docstatus', '!=', 2] ] - } + } } cur_frm.set_query("expense_account", "entries", function(doc) { return{ - query: "accounts.doctype.purchase_invoice.purchase_invoice.get_expense_account", + query: "erpnext.accounts.doctype.purchase_invoice.purchase_invoice.get_expense_account", filters: {'company': doc.company} } }); @@ -194,7 +194,7 @@ cur_frm.cscript.expense_account = function(doc, cdt, cdn){ cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) { return { - filters: { + filters: { 'company': doc.company, 'group_or_ledger': 'Ledger' } @@ -218,7 +218,7 @@ cur_frm.fields_dict['entries'].grid.get_field('project_name').get_query = functi filters:[ ['Project', 'status', 'not in', 'Completed, Cancelled'] ] - } + } } @@ -229,4 +229,4 @@ cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){ } else cur_frm.pformat.print_heading = __("Purchase Invoice"); -} \ No newline at end of file +}