From b60abb01585be9148f92214e35009071020e14cd Mon Sep 17 00:00:00 2001 From: Andy Zhu Date: Fri, 3 Jul 2020 14:13:15 +1200 Subject: [PATCH] fix: fetch item price in sales invoice When create standalone sales invoice, the item price will not be created fetch. By adding "posting_date" to dict: item_price_args, it will be fetch on building the condition of SQL. --- erpnext/stock/get_item_details.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 0ed3b276e3..0af018bbad 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -636,6 +636,10 @@ def get_item_price(args, item_code, ignore_party=False): if args.get('transaction_date'): conditions += """ and %(transaction_date)s between ifnull(valid_from, '2000-01-01') and ifnull(valid_upto, '2500-12-31')""" + + if args.get('posting_date'): + conditions += """ and %(posting_date)s between + ifnull(valid_from, '2000-01-01') and ifnull(valid_upto, '2500-12-31')""" return frappe.db.sql(""" select name, price_list_rate, uom from `tabItem Price` {conditions} @@ -657,6 +661,7 @@ def get_price_list_rate_for(args, item_code): "supplier": args.get('supplier'), "uom": args.get('uom'), "transaction_date": args.get('transaction_date'), + "posting_date": args.get('posting_date'), } item_price_data = 0