From a88912a2f50d55e92dcab0b8df7aa15626b57d46 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 14 Jan 2016 10:43:07 +0530 Subject: [PATCH] [fix] Item query and exchange rate --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 6 ++++-- .../doctype/production_order/production_order.js | 9 ++++----- .../doctype/stock_reconciliation/stock_reconciliation.js | 8 +++++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 7deca523c9..a64548b46d 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -611,8 +611,10 @@ def get_payment_entry_against_invoice(dt, dn, amount=None, journal_entry=False, def get_payment_entry(ref_doc, args): cost_center = frappe.db.get_value("Company", ref_doc.company, "cost_center") - exchange_rate = get_exchange_rate(args.get("party_account"), args.get("party_account_currency"), - ref_doc.company, ref_doc.doctype, ref_doc.name) + exchange_rate = 1 + if args.get("party_account"): + exchange_rate = get_exchange_rate(args.get("party_account"), args.get("party_account_currency"), + ref_doc.company, ref_doc.doctype, ref_doc.name) je = frappe.new_doc("Journal Entry") je.update({ diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js index 7349447ffd..f72163e19b 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.js +++ b/erpnext/manufacturing/doctype/production_order/production_order.js @@ -256,11 +256,10 @@ cur_frm.cscript['Update Finished Goods'] = function() { cur_frm.fields_dict['production_item'].get_query = function(doc) { return { - filters:[ - ['Item', 'is_pro_applicable', '=', 1], - ['Item', 'has_variants', '=', 0], - ['Item', 'end_of_life', '>=', frappe.datetime.nowdate()] - ] + query: "erpnext.controllers.queries.item_query", + filters:{ + 'is_pro_applicable': 1, + } } } diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js index 535e397c55..ac10fb6e43 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js @@ -10,9 +10,11 @@ frappe.ui.form.on("Stock Reconciliation", { // end of life frm.set_query("item_code", "items", function(doc, cdt, cdn) { return { - filters:[ - ['Item', 'end_of_life', '>=', frappe.datetime.nowdate()] - ] + query: "erpnext.controllers.queries.item_query", + filters:{ + "is_stock_item": 1, + "has_serial_no": 0 + } } }); },