In gross profit report, if incoming rate not found from last sle, consider average valuation rate
This commit is contained in:
parent
3e43f275a0
commit
77c970549b
@ -5,6 +5,7 @@ from __future__ import unicode_literals
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe import _, scrub
|
from frappe import _, scrub
|
||||||
from erpnext.stock.utils import get_incoming_rate
|
from erpnext.stock.utils import get_incoming_rate
|
||||||
|
from erpnext.stock.stock_ledger import get_valuation_rate
|
||||||
from frappe.utils import flt
|
from frappe.utils import flt
|
||||||
|
|
||||||
|
|
||||||
@ -220,7 +221,10 @@ class GrossProfitGenerator(object):
|
|||||||
from `tabPurchase Invoice Item`
|
from `tabPurchase Invoice Item`
|
||||||
where item_code = %s and docstatus=1""", item_code)[0][0])
|
where item_code = %s and docstatus=1""", item_code)[0][0])
|
||||||
else:
|
else:
|
||||||
self.average_buying_rate[item_code] = get_incoming_rate(row)
|
average_buying_rate = get_incoming_rate(row)
|
||||||
|
if not average_buying_rate:
|
||||||
|
average_buying_rate = get_valuation_rate(item_code, row.warehouse, allow_zero_rate=True)
|
||||||
|
self.average_buying_rate[item_code] = average_buying_rate
|
||||||
|
|
||||||
return self.average_buying_rate[item_code]
|
return self.average_buying_rate[item_code]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user