Merge pull request #22563 from AndyOverLord/patch-6

fix: fetch item price in sales invoice
This commit is contained in:
rohitwaghchaure 2020-07-06 14:18:03 +05:30 committed by GitHub
commit 71e1d2cc79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -637,6 +637,10 @@ def get_item_price(args, item_code, ignore_party=False):
conditions += """ and %(transaction_date)s between conditions += """ and %(transaction_date)s between
ifnull(valid_from, '2000-01-01') and ifnull(valid_upto, '2500-12-31')""" 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 return frappe.db.sql(""" select name, price_list_rate, uom
from `tabItem Price` {conditions} from `tabItem Price` {conditions}
order by valid_from desc, uom desc """.format(conditions=conditions), args) order by valid_from desc, uom desc """.format(conditions=conditions), args)
@ -657,6 +661,7 @@ def get_price_list_rate_for(args, item_code):
"supplier": args.get('supplier'), "supplier": args.get('supplier'),
"uom": args.get('uom'), "uom": args.get('uom'),
"transaction_date": args.get('transaction_date'), "transaction_date": args.get('transaction_date'),
"posting_date": args.get('posting_date'),
} }
item_price_data = 0 item_price_data = 0